-
Notifications
You must be signed in to change notification settings - Fork 799
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
My Jetpack: Protect card- Reduce the count font-size as the number of digits increases. #38953
My Jetpack: Protect card- Reduce the count font-size as the number of digits increases. #38953
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
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.
Instead of shrinking the font size as the number gets larger, what do you think of re-using the number formatting we have on the VideoPress card?
There, we are using a compact number config like this:
const shortenedNumberConfig: Intl.NumberFormatOptions = {
maximumFractionDigits: 1,
notation: 'compact',
};
And this number format utility: https://github.com/Automattic/jetpack/blob/trunk/projects/packages/my-jetpack/_inc/utils/format-number.ts
To get output like 23K
in place of 23,000
I think that would bring some better consistency for how we handle large numbers on the cards.
Plus one on this, FYI I stole that from the Stats card for the VideoPress implementation. Would make numbers like that consistent on all cards 😄 |
@jboland88 & @CodeyGuyDylan, |
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! I did make a comment on a good code quality improvement to make, but it's non-blocking
@@ -54,9 +55,16 @@ function BlockedStatus( { status }: { status: 'active' | 'inactive' | 'off' } ) | |||
const tooltipContent = useProtectTooltipCopy(); | |||
const { blockedLoginsTooltip } = tooltipContent; | |||
|
|||
const shortenedNumberConfig: Intl.NumberFormatOptions = { |
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 just thought of something 🤔
This config is being used for stats, videopress, and now here. I am assuming the vast majority of the time we use this function, this will be the config. What do you think about moving this to the utils function as the default config? And we can still have the config as an optional prop. Not necessary to do here but it should be pretty easy 🤔
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.
If you don't feel like we should do that in this PR, we can just create a small maintenance task. Just feel like it will be prioritized as "nice to have" 😅
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.
@CodeyGuyDylan, yes good idea, nice improvement, I like it! 😃. Thanks for pointing this out! 👍
Ok, I added the default options to the utils/format-number function in this PR.
Could you re-review? Your previous approval was dismissed with the latest changes...
I'll then whip up a quick follow-up PR to remove the shortenedNumberConfig (the second parameter) where the function is used within the Stats card and the VideoPress card. Sounds good? 🙂
I added this later as a comment in our chat with @elliottprogrammer: "We could try to trim them instead and use metric prefixes (K for thousands, M for millions, etc.)" Glad we all reached to the same conclusion! Thanks for working on this, @elliottprogrammer! Appreciate it. |
Parental leave, also changes made
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! Thanks for the changes 😄
This was a request by @ilonagl on the Design team:
This PR dynamically reduces the font-size of the "Logins blocked" numbers (and slightly reduces letter-spacing) as the number of digits increases.
Fixes https://github.com/Automattic/jetpack-marketing/issues/936
Proposed changes:
numberFormat()
to the number of logins blocked, (Which adds commas to the number (for US locale)).Other information:
Jetpack product discussion
The number of logins blocked in the My Jetpack Protect card was initially added as part of: --> PT: Add value to the Protect product card in My Jetpack: pbNhbs-aP6-p2
Does this pull request change what data or activity we track or use?
No
Testing instructions:
jetpack docker
to the WP CLI command stated in the next step.wp option update jetpack_protect_blocked_attempts 12345