-
Notifications
You must be signed in to change notification settings - Fork 22
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
Handle all loading states within the PhoneNumberCard
component
#934
Handle all loading states within the PhoneNumberCard
component
#934
Conversation
@eason9487 , for the settings page: Do we want to show the "horizontal divider" line when the loading is in progress? I think it would look nicer, and it would be consistent with the store address UI below it too. |
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.
Tested, working as expected. Left a few 💅 comments. Approving. 👍
/** | ||
* Renders phone number data in Card UI and is able to edit. | ||
* | ||
* @param {Object} props React props. | ||
* @param {PhoneNumber} props.phoneNumber Phone number data. | ||
* @param {boolean} [props.isPreview=false] Whether to display as preview UI. | ||
* @param {boolean|null} [props.initEditing=null] Specify the inital UI state. This prop would be ignored if `isPreview` is true. | ||
* `true`: initialize with the editing UI. | ||
* `false`: initialize with the viewing UI. | ||
* `null`: determine the initial UI state according to the `data.isValid` after the `phoneNumber` loaded. | ||
* @param {Function} [props.onEditClick] Called when clicking on "Edit" button. | ||
* If this callback is omitted, it will enter edit mode when clicking on "Edit" button. | ||
* @param {onPhoneNumberChange} [props.onPhoneNumberChange] Called when inputs of phone number are changed in edit mode. | ||
*/ |
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.
Thank you for the JSDoc! 😻
useEffect( () => { | ||
if ( loaded && isEditing === null ) { | ||
setEditing( ! data.isValid ); | ||
} | ||
}, [ loaded, data.isValid, isEditing ] ); |
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 took me a while to figure out this relates to your JSDoc comment "determine the initial UI state according to the `data.isValid` after the `phoneNumber` loaded."
. Would be good to have a comment to explain this, or even refactor 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.
Added a comment by 63460f7.
Address #934 (comment) Co-authored-by: Gan Eng Chin <ecgan@users.noreply.github.com>
Address #934 (comment) Co-authored-by: Gan Eng Chin <ecgan@users.noreply.github.com>
537da07
to
968ab62
Compare
Changes proposed in this Pull Request:
It's a follow-up for #917 (comment).
PhoneNumberCard
component to show more card content as soon as possible.❗ This's a refactor PR and didn't affect the functionality of the Contact Information feature. It could be reviewed and (maybe) merged after the Contact Information is released.
Screenshots:
MC setup
Settings
Detailed test instructions:
To enter the MC setup step 4 directly, it could replace this line in js/src/setup-mc/setup-stepper/saved-setup-stepper.js by
To mock the API response of phone number and add more delay to view the loading state, it could add PHP snippet in google-listings-and-ads.php.
PhoneNumberCard
component instead of the parent layer for all casesChangelog entry