-
Notifications
You must be signed in to change notification settings - Fork 8
starter-sites-onboarding-notice #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
harshitarora-in
wants to merge
12
commits into
development
Choose a base branch
from
feature/starter-sites-onboarding-notice
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+531
−3
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9804031
starter-sites-onboarding-notice
harshitarora-in b8878bd
Apply review feedback: fix i18n, AJAX response, license tier logic, a…
Claude b988732
fix onboarding promo notice lint and revert lockfile noise
Copilot dff96ae
refine onboarding promo notice interpolation
Copilot 5776780
Fix security and sanitization issues in AJAX handler
Claude a579d54
Fix onboarding promo review feedback
Copilot b7de07e
Refine onboarding promo test coverage
Copilot 190c7fb
Polish onboarding promo validation fixes
Copilot 2e794e3
Address final onboarding promo review nits
Copilot bc86136
Fix final onboarding promo test nit
Copilot f5d7e3a
Finalize onboarding promo validation followups
Copilot eeac6df
Tighten onboarding promo test helpers
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* global tiobDash */ | ||
| import { __, sprintf } from '@wordpress/i18n'; | ||
| import { createInterpolateElement, useState } from '@wordpress/element'; | ||
| import { ajaxAction } from '../utils/rest'; | ||
|
|
||
| const OnboardingPromoNotice = () => { | ||
| const shouldShowNotice = Boolean( tiobDash.onboardingPromoNotice?.show ); | ||
| const showProMessage = Boolean( tiobDash.onboardingShowProNoticeText ); | ||
|
|
||
| const emailBody = sprintf( | ||
| /* translators: %s: double line break in the starter site request email template */ | ||
| __( | ||
| 'Hi Neve team,%1$sI\'m looking for a starter site for the following project:%1$sProject type: (e.g. Restaurant, Law Firm, SaaS)%1$sKey pages needed: (e.g. Home, About, Services, Contact)%1$sStyle preference: (e.g. Minimal, Bold, Corporate)%1$sAny references: (optional)%1$sThanks', | ||
| 'templates-patterns-collection' | ||
| ), | ||
| '\n\n' | ||
| ); | ||
|
|
||
| const requestSiteLink = | ||
| 'mailto:contact@themeisle.com?subject=' + | ||
| encodeURIComponent( | ||
| __( 'Starter Site Request', 'templates-patterns-collection' ) | ||
| ) + | ||
| '&body=' + | ||
| encodeURIComponent( emailBody ); | ||
|
|
||
| const noticeMessage = showProMessage | ||
| ? createInterpolateElement( | ||
| __( | ||
| 'Fresh designs built for every niche. Can\'t find what you\'re looking for? As a Pro user, <requestSiteLink>request a site</requestSiteLink> and we\'ll build it for you.', | ||
| 'templates-patterns-collection' | ||
| ), | ||
| { | ||
| requestSiteLink: ( | ||
| /* eslint-disable-next-line jsx-a11y/anchor-has-content */ | ||
| <a | ||
| href={ requestSiteLink } | ||
| className="ob-onboarding-promo-link" | ||
| /> | ||
| ), | ||
| } | ||
| ) | ||
| : __( | ||
|
harshitarora-in marked this conversation as resolved.
|
||
| 'From free to pro, fresh designs built for every niche. More coming soon.', | ||
| 'templates-patterns-collection' | ||
| ); | ||
|
|
||
| const [ isVisible, setIsVisible ] = useState( shouldShowNotice ); | ||
|
|
||
| if ( ! isVisible ) { | ||
| return null; | ||
| } | ||
|
|
||
| const dismissNotice = () => { | ||
| setIsVisible( false ); | ||
| ajaxAction( | ||
| tiobDash.onboardingPromoNotice.ajaxURL, | ||
| 'dismiss_onboarding_promo_notice', | ||
| tiobDash.onboardingPromoNotice.nonce | ||
| ).catch( () => null ); | ||
|
Comment on lines
+54
to
+60
Comment on lines
+54
to
+60
|
||
| }; | ||
|
|
||
| return ( | ||
| <div className="ob-onboarding-promo" role="status"> | ||
| <div className="ob-onboarding-promo-badge"> | ||
| { __( 'New', 'templates-patterns-collection' ) } | ||
| </div> | ||
| <div className="ob-onboarding-promo-content"> | ||
| <h3> | ||
| { sprintf( | ||
| /* translators: %s: number of new starter sites */ | ||
| __( | ||
| '%s new starter sites, just landed.', | ||
| 'templates-patterns-collection' | ||
| ), | ||
| '80+' | ||
| ) } | ||
| </h3> | ||
| <p>{ noticeMessage }</p> | ||
| </div> | ||
| <button | ||
| type="button" | ||
| className="ob-onboarding-promo-close" | ||
| onClick={ dismissNotice } | ||
| aria-label={ __( | ||
| 'Dismiss notice', | ||
| 'templates-patterns-collection' | ||
| ) } | ||
| > | ||
| × | ||
| </button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default OnboardingPromoNotice; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.