-
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
Use ProductIcon from @automattic/components instead of internal components #38474
Conversation
Since you anyway use <ProductIcon slug={ getProductIconSlug( plan ) } /> ...would it make sense to have component do it for you and do Something named Not to block this PR — just maybe something to either follow up or change in the component before this PR, if you think it would make sense. |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~106 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~12780 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 (~5934 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. |
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 looking really great, nice work @delawski!
I tend to agree with @simison though - from a component usability perspective, I think it would make more sense to support all those additional product slugs. It would be much easier, than having to port that getProductIconSlug
between codebases when reusing the component here and there.
What do you think?
@simison @tyxla So, the question is: is it a good idea to ship a module like When something is used only inside the Calypso app, anything can depend on anything else without visible consequences. But when extracting standalone packages, we need to think about dependencies more carefully. |
Well, the only thing |
The main job that So you're proposing to use the constants from The structure of the product constants doesn't seem to follow any unified convention. There are values like:
Sometimes there are dashes ( |
Yeah, that's what I'm proposing. I know we're not very consistent with the product slug naming, and I'm not super happy about it, but it's a done deal anyway, and we can't fix it easily 😉 It's not about convention, it's about the fact that these are product slugs, and it makes sense for them to match existing products for a product icon component. In other words, I'd expect to pass any product slug from the WP.com store, and get an icon for it from that component. If we need to have an adapter or facade between the slug and the component, then it's likely a bad component design because it's a bit more difficult and less intuitive to use. I don't have super strong feelings about it, but I just think that having the component handle this is in favor of a more intuitive component design. And as long as we have good documentation for the product slugs, we should be good. After all, those product slugs are used in all of our products and platforms, so we can't run away from them 😉 |
In short, here's a user story of why I think what I'm suggesting makes sense:
rather than:
because if this Also, I realized that what we're introducing is just another layer of product slugs, which aren't really product slugs. What are they really then? Just another layer of confusion if you ask me. Just my $0.02 😉 |
I was torn a bit while implementing the There are 2 valid points raised here, 2 options we can choose from:
Pros for option 1:
Pros for option 2:
So far I was convinced that we should keep the We don't have any real control over the product and plan slugs used throughout the organization, and there's no way to make them "pretty". Since we can't fight the chaos, let's embrace it. While the A8c product slugs don't seem stick to any naming convention and are rather ugly, the good part about them is that they are the same across all codebases. My inclination right now is to use the actual product slugs inside the What do you all think? |
Thanks @delawski I think that's a pretty good summary of where we stand there 👍
As I already suggested above, I lean towards this too. I think that if we make a list of the cons, it will be even easier to make a decision 😉 |
I've updated the |
Marking this as "in progress" and "blocked" by #38536 |
f056782
to
db3d97a
Compare
I'm going to rebase this and do a smoke test on IE11. I'd like to have someone else doing a smoke test on IE11 as well before merging since a potential issue may bring the production down on IE. |
c83832d
to
2bb3b05
Compare
I've rebased and tested the calypso.live site on Win10/IE11 (BrowserStack. Everything seems to be working as expected. Having a second check done by someone else would be perfect. |
In my testing this PR looks good on IE 11. |
It seems the e2e tests fail for a reason. I'll try to have a look into this tomorrow. |
@enejb @tyxla I've udpated the e2e tests affected ( However, another test ( In this case, do you think it's safe to deploy? |
I gave this some testing and it looks/works great! I'm going to rebase, retest, and 🚢 Thanks a lot for it @delawski! |
da43bf8
to
aa1e8ff
Compare
Fixed the desktop and mobile e2e tests with b019798. The Jetpack e2e test failures are unrelated and are currently consistently failing on master and other branches, too. This works well and LGTM 🚢 |
This PR is a follow-up work to recently deployed #38253 (see: pbtFFM-11-p2).
It replaces all usages of Calypso-specific
ProductIcon
andPlanIcon
components with a common@automattic/components
ProductIcon
component.Changes proposed in this Pull Request
getProductIconSlug()
function for getting a mapping between plan or product slug and icon slug (af2b05f)ProductIcon
inMyPlanCard
(af2b05f)PlanIcon
withProductIcon
inPlanFeaturesHeader
(4f328d0)PlanIcon
withProductIcon
inBanner
(69c3711)PlanIcon
withProductIcon
inPurchaseItem
(6901f67)PlanIcon
withProductIcon
inManagePurchase
(51b0abf)PurchaseItem
andManagePurchase
(6901f67 and 51b0abf) since now Jetpack Backup icons are supported by theProductIcon
.PlanIcon
withProductIcon
inPlanThankYouCard
(441fd7c)PlanIcon
withProductIcon
inUpgradeNudgeExpanded
(831a537)PlanIcon
andProductIcon
components (1aa994d and f056782)Testing instructions
Go to each of the following pages and confirm that the plan icons are displayed as expected (no regression):
Fixes n/a