-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adds billing interval switcher in plugin details and plugins browser. #59128
Conversation
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-22533 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~124 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~1477 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~45 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
7a2ef92
to
df06675
Compare
df06675
to
8109cfa
Compare
client/my-sites/marketplace/components/billing-interval-switcher/index.jsx
Outdated
Show resolved
Hide resolved
client/my-sites/marketplace/components/billing-interval-switcher/index.jsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
client/my-sites/marketplace/components/billing-interval-switcher/index.jsx
Outdated
Show resolved
Hide resolved
@@ -92,6 +95,10 @@ function PluginDetails( props ) { | |||
const isWpcom = selectedSite && ! isJetpack; | |||
const isJetpackSelfHosted = selectedSite && isJetpack && ! isAtomic; | |||
|
|||
// Header Navigation and billing period switcher. | |||
const isWide = useBreakpoint( '>1280px' ); | |||
const [ billingPeriod, setBillingPeriod ] = useState( 'MONTHLY' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is any chance we can have it in global state(redux)? This would allow us to:
- Keep the period selected when moving between pages.
- Easier usage on down the line components as
PluginBrowserItem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I had it in mind. Let's do it in a follow up.
client/my-sites/marketplace/components/billing-interval-switcher/index.jsx
Show resolved
Hide resolved
export enum IntervalLength { | ||
ANNUALLY = 'ANNUALLY', | ||
MONTHLY = 'MONTHLY', | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for address this, can we change those values to lowercase so we can use them directly when looking on plugin variations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, no
wp-calypso/packages/plans-grid/src/plans-interval-toggle/index.tsx
Lines 79 to 108 in 5f4eb76
<SegmentedControl> | |
<SegmentedControl.Item | |
selected={ intervalType === 'MONTHLY' } | |
onClick={ () => onChange( 'MONTHLY' ) } | |
> | |
<span className="plans-interval-toggle__label">{ monthlyLabel }</span> | |
</SegmentedControl.Item> | |
<SegmentedControl.Item | |
selected={ intervalType === 'ANNUALLY' } | |
onClick={ () => onChange( 'ANNUALLY' ) } | |
> | |
<span className="plans-interval-toggle__label">{ annuallyLabel }</span> | |
{ /* | |
* Check covers both cases of maxMonthlyDiscountPercentage | |
* not being undefined and not being 0 | |
*/ } | |
{ intervalType === 'MONTHLY' && maxMonthlyDiscountPercentage && ( | |
<PopupMessages> | |
{ sprintf( | |
// translators: will be like "Save up to 30% by paying annually...". Please keep "%%" for the percent sign | |
__( | |
'Save up to %(maxDiscount)d%% by paying annually and get a free domain for one year', | |
__i18n_text_domain__ | |
), | |
{ maxDiscount: maxMonthlyDiscountPercentage } | |
) } | |
</PopupMessages> | |
) } | |
</SegmentedControl.Item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7043514 Thank you @cpapazoglou for including a screenshot in the description! This is really helpful for our translators. |
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
compact
prop to<Breadcrumb>
, so that we can just display "Back" in smaller breakpointsTesting instructions
Scenario WPCOM sites with paid plugin
/plugins/[domain]
/plugins/woocommerce-subscriptions/
Scenario WPCOM sites with free plugin
/plugins/woocommerce/
Scenario Jetpack Self hosted sites
/plugins/[domain]
Fixes #57102