-
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
5
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.
Open
Changes from all commits
Commits
Show all changes
5 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 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
| 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
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,105 @@ | ||
| .ob-onboarding-promo { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 24px; | ||
| background: $primary; | ||
| border-radius: 16px; | ||
| padding: 18px 24px; | ||
| margin: 32px 0; | ||
| } | ||
|
|
||
| .ob-onboarding-promo-badge { | ||
| background: rgba(255, 255, 255, 0.2); | ||
| color: $inverted-text; | ||
| border-radius: 10px; | ||
| padding: 8px 14px; | ||
| text-transform: uppercase; | ||
| font-size: 14px; | ||
| line-height: 20px; | ||
| font-weight: 700; | ||
| letter-spacing: 0.06em; | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| .ob-onboarding-promo-content { | ||
| flex: 1; | ||
|
|
||
| h3 { | ||
| margin: 0 0 6px; | ||
| color: $inverted-text; | ||
| font-size: 20px; | ||
| line-height: 30px; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| p { | ||
| margin: 0; | ||
| color: rgba(255, 255, 255, 0.92); | ||
| font-size: 15px; | ||
| line-height: 24px; | ||
| font-weight: 400; | ||
| } | ||
|
|
||
| .ob-onboarding-promo-link { | ||
| color: $inverted-text; | ||
| font-weight: 700; | ||
| text-decoration: underline; | ||
| } | ||
| } | ||
|
|
||
| .ob-onboarding-promo-close { | ||
| border: 0; | ||
| background: rgba(255, 255, 255, 0.2); | ||
| color: $inverted-text; | ||
| width: 40px; | ||
| height: 40px; | ||
| border-radius: 12px; | ||
| font-size: 24px; | ||
| line-height: 1; | ||
| cursor: pointer; | ||
| display: inline-flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| @media (max-width: #{$laptop}) { | ||
| .ob-onboarding-promo { | ||
| padding: 16px; | ||
| gap: 16px; | ||
| } | ||
|
|
||
| .ob-onboarding-promo-badge { | ||
| font-size: 12px; | ||
| line-height: 18px; | ||
| padding: 6px 10px; | ||
| } | ||
|
|
||
| .ob-onboarding-promo-content { | ||
| h3 { | ||
| font-size: 18px; | ||
| line-height: 28px; | ||
| } | ||
|
|
||
| p { | ||
| font-size: 14px; | ||
| line-height: 22px; | ||
| } | ||
| } | ||
|
|
||
| .ob-onboarding-promo-close { | ||
| width: 36px; | ||
| height: 36px; | ||
| font-size: 20px; | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: #{$tablet}) { | ||
| .ob-onboarding-promo { | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| .ob-onboarding-promo-close { | ||
| margin-left: auto; | ||
| } | ||
| } |
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
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.