-
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
Bulk Domain Transfer: Improve domain form #79300
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~55 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~52 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 (~52 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. |
return <div className="domains__domain-price-number disabled">$0</div>; | ||
} | ||
|
||
if ( ! saleCost && saleCost !== 0 ) { |
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 ( ! saleCost && saleCost !== 0 ) { | |
if ( saleCost === 0 ) { |
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 thought about this, but what about sales that are not zero but half the price? 🤔
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.
You're right. Bad suggestion.
const { __ } = useI18n(); | ||
|
||
if ( ! rawPrice ) { | ||
return <div className="domains__domain-price-number disabled">$0</div>; |
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.
We should probably call formatCurrency
on the zero.
8fa0f93
to
7672fde
Compare
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.
Amazing work. This has been much harder than it seems. Left some comments.
const totalPrice = Object.values( domainsState ).reduce( ( total, currentDomain ) => { | ||
if ( currentDomain.saleCost ) { | ||
return total + currentDomain.saleCost; | ||
} | ||
|
||
return total + currentDomain.rawPrice; | ||
}, 0 ); |
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 probably should be a function outside the component, takes the state and gives a formatted price with a correct currency. I.e shouldn't be locked to USD.
if ( ! rawPrice ) { | ||
return ( | ||
<div className="domains__domain-price-number disabled"> | ||
{ formatCurrency( 0, currencyCode, { stripZeros: true } ) } |
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 realized that we don't need currency for the zero, 0
is enough, but not $0
.
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! Do you mean just having
<div className="domains__domain-price-number disabled">0</div>
right?
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!
@@ -107,6 +129,9 @@ const Domains: React.FC< Props > = ( { onSubmit } ) => { | |||
domain: '', | |||
auth: '', | |||
valid: false, | |||
rawPrice: 0, | |||
saleCost: undefined, | |||
currencyCode: 'USD', |
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.
Should be undefined
.
@@ -143,6 +168,10 @@ const Domains: React.FC< Props > = ( { onSubmit } ) => { | |||
{ __( 'Add another domain' ) } | |||
</Button> | |||
) } | |||
<div className="bulk-domain-transfer__total-price"> | |||
<div>{ __( 'Total' ) }</div> | |||
<div>{ formatCurrency( totalPrice, 'USD', { stripZeros: true } ) }</div> |
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.
Should be covered by the function I mention above.
Thank you @alshakero, I think I addressed all your feedback! |
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.
Pushed some changes and it looks great now!
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.
Pushed some changes and it looks great now!
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/8549986 Hi @escapemanuele, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include all of the following strings:
Thank you in advance! |
From the checkout screen, the back button used to go to /setup/domain-transfer/domains, and now it goes to /start/domains, which seems wrong. |
Hey @john-legg, thanks for the feedback. I gave the price column some space to accomodate for this: The I'll try to remove some space 😄 |
Hi, @escapemanuele! issue (ux,non-blocking): There is a dollar sign on the price per domain based on Figma. But, right now, it only shows |
Thank you @karenroldan, we'll try to address this! |
Translation for this Pull Request has now been finished. |
Designs
Changes
Testing
setup/domain-transfer/domains