-
Notifications
You must be signed in to change notification settings - Fork 2k
Dashboard v2: lazy load current plan (expiry + manage link) #103601
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
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~8 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. 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. |
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.
Lazy load the current plan
Perhaps one would consider this essential information and required to be in the loader, if so we can discuss it here. I'm on the fence myself, it was much clearer for the other cases.
I think it's fine for it to load async in the overview page, given its location at the bottom of the page, where my eyes would take time themselves to reach to that location.
Maybe a better way in the future, is to somehow preload/prefetch all required data for the site overview page, when we hover on the site from the grid, so by the time we click and land on the overview, they are all ready.
/* translators: %s: date of plan's expiration date. Eg. August 20, 2025 */ | ||
const expiresString = __( 'Expires on <time>%s</time>.' ); | ||
|
||
// Show a blurred time while we wait for the current plan. |
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 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.
What is the value in that case?
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.
It's null
in such cases.
I believe it's already reflected in the type:
wp-calypso/client/dashboard/data/types.ts
Line 58 in 05935db
expiry?: string; |
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.
That would be undefined
, no?
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.
I fixed it in ad4fcee
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.
Ok, I blurred the entire line instead.
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.
I think it's semantically wrong, because the expiration / subscription actually exists but is managed by A4A 🥲
Wait, so doesn't the "manage subscription" link then also not make sense? I'm curious what info there is in the site.plan
when it's an A4A site.
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 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.
How do you check if it's managed? Is that in the plan? I don't have a site that is a4a atm, not sure how to test
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.
Something like this 🙈
wp-calypso/client/lib/purchases/index.ts
Lines 890 to 892 in 474d76d
if ( isAgencyPartnerType( purchase.partnerType ) ) { | |
return i18n.translate( 'Agency Managed Plan' ); | |
} |
Looking at the new design explorations, this may change though.
Interesting, so you're basically suggesting two types of resources:
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
/* translators: %s: date of plan's expiration date. Eg. August 20, 2025 */ | ||
const expiresString = __( 'Expires on <time>%s</time>.' ); | ||
|
||
// Show a blurred time while we wait for the current plan. |
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.
But it means there will still be layout shift for such sites.
Maybe that's OK for now; in general I believe A4A sites should be handled / shown differently in the overview page.
/* translators: %s: date of plan's expiration date. Eg. August 20, 2025 */ | ||
const expiresString = __( 'Expires on <time>%s</time>.' ); | ||
|
||
// Show a blurred time while we wait for the current plan. |
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.
That would be undefined, no?
I always forgot the difference between ?
and null
🤦
// Some plans don't have an expiry date, and we don't want to show it at | ||
// all. | ||
if ( ! currentPlan.expiry ) { | ||
return __( 'No expiration date.' ); |
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.
Let's return nothing here as per the comment above?
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, but then there will be a layout shift. I'll look into properly handling it when it's a4a managed.
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.
OK, I was just going to suggest to do it separately, not sure if it's worth handling it now since it's very likely that the design will change for A4A sites.
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.
Ok, sure, let's do that. I think the new design has it in card as well, so in that case it would be fixed height and now something that could cause a shift.
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.
Re-tested 👍
client/dashboard/app/style.scss
Outdated
@@ -40,3 +40,10 @@ h1 { | |||
font-family: var( --dashboard-h1__font-family ); | |||
font-weight: var( --dashboard-h1__font-weight ) !important; | |||
} | |||
|
|||
.is-blurred { |
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.
This is way more versatile, can be used with any element.
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.
I'm not 100% confident with this; this seems to be the first "free-style" CSS in the dashboard root code. Wanted to get input from @youknowriad .
After contemplating, it seems that the "canonical" way is to implement this on <Text>
, something like <Text variant="blurred">
. But of course that's not going to happen 😄
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.
I prefer a component over reusing a CSS indeed.
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.
I think we should avoid utility CSS as it quickly becomes non easily manageable (disconnect between usage and declaration causing dead code over time...)
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.
After contemplating, it seems that the "canonical" way is to implement this on
<Text>
No, because we want this on more than just text.
If not a class, then it should be a hook. I don't care either way, but I don't see anything wrong with classes tbh.
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.
(please don't make this a blocker though, I'm fine either way)
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.
@youknowriad The button has to be disabled/inert too, which is directly caused by the blurring/placeholder state, so imo these should go together
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.
Maybe @youknowriad meant that we keep the split, but in the loading case, we render a disabled <Button>
which has a <TextBlur>
inside it?
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.
That's what I understood yes, but imo blur and inert/hidden should always go together with blur. I don't mind either way I guess. I'll change it later
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.
Because I will have to add inert
/aria-hidden
(same) to TextBlur, and then the implementor has to add it once more to the button. Tbh, I don't get at all what's wrong with having props instead of a component :)
28fcad3
to
016436b
Compare
abdcc7a
to
f46c71b
Compare
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/17515948 Some locales (Hebrew) have been temporarily machine-translated due to translator availability. All other translations are usually ready within a few days. Untranslated and machine-translated strings will be sent for translation next Monday and are expected to be completed by the following Friday. Thank you @ellatrix for including a screenshot in the description! This is really helpful for our translators. |
Proposed Changes
<time>
tag for the date when it's loaded.Why are these changes being made?
Testing Instructions
Pre-merge Checklist