Skip to content
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

Add contact information section and its edit subpage to the settings page #921

Merged
merged 11 commits into from
Aug 4, 2021

Conversation

eason9487
Copy link
Member

@eason9487 eason9487 commented Jul 30, 2021

Changes proposed in this Pull Request:

Partial of #863 and based on #918

  • Add URLs to utils for settings and edit contact info pages
  • Implement the preview section and edit subpage of contact information, and add them to the settings page

💡 Please note that this PR doesn't include the API integration.

Screenshots:

🎥 . When the phone number got from Google MC is empty

Kapture.2021-07-30.at.15.46.09.mp4

🎥 . When the phone number got from Google MC has already exist

Kapture.2021-07-30.at.15.48.10.mp4

Detailed test instructions:

For easier testing, there is a mock phone number that is 50% chance for an empty phone number and 50% for an existed phone number when every time reload the page.

const mockPhoneNumber = Math.random() > 0.5 ? '+12133734253' : '';
export const getGoogleMCPhoneNumber = () => {
// TODO: [lite-contact-info] integrate with API
return {
id: '123456789',
phone_number: mockPhoneNumber,
};
};

  1. Go to the settings page.
  2. The "Contact information" should show up with
    • a warning section that prompts users to add information if the phone data is empty.
    • a folded section that displays phone number and store address if the phone data is not empty.
  3. Click on "Add information" or "Edit" button, and it should bring you to contact info edit page.
  4. In the contact info edit page,

Changelog entry

@eason9487 eason9487 requested a review from a team July 30, 2021 07:51
@eason9487 eason9487 self-assigned this Jul 30, 2021
@j111q
Copy link

j111q commented Jul 30, 2021

One note - we tweaked the wording on the message here:

image

So it should say Google requires the phone number and store address for all stores using Google Merchant Center.

We took out the phrase about "owner of the business" because that could be confusing - it's not necessarily the owner who is setting up the integration or managing it.

eason9487 added a commit that referenced this pull request Jul 30, 2021
@eason9487
Copy link
Member Author

eason9487 commented Jul 30, 2021

@j111q, thanks for notifying me. Updated by e9de8d5.

image

@j111q
Copy link

j111q commented Jul 30, 2021

One more thing - link to documentation / all the "Read more" links should go here: https://docs.woocommerce.com/document/google-listings-and-ads/#contact-information

Thank you @eason9487 !

Comment on lines 45 to 49
<PhoneNumberCard
isPreview
initEditing={ false }
onEditClick={ handleEditClick }
/>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev note: follow the change of #917 (comment) to pass phone as phoneNumber prop before merging this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added by 34e6f62.

Copy link
Member

@ecgan ecgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested as per test instructions, seems to be working good. Left one ❓ comment on external link and track event, and a few ❔ 💅 comments.

Think you would be able to handle the ❓ comment, approving this now as there isn't any real blocking issues.

getHistory().push( getEditContactInformationUrl() );
};

let sectionContent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅 Perhaps we can set a default sectionContent (the one with AppSpinner), then we don't need the else block in Line 61-67.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed by 3dbc1fa.

Comment on lines 63 to 65
<Section.Card>
<AppSpinner />
</Section.Card>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ Would the SpinnerCard component be good here?

Suggested change
<Section.Card>
<AppSpinner />
</Section.Card>
<SpinnerCard />

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The card height will be higher and looks better. Thanks!

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just recalled that the <Section.Card> <AppSpinner /> </Section.Card> was taken for aligning the height of all loading cards on the settings page.

Snapshot 2021-08-04 at 11 22 48

But <SpinnerCard> looks better, to make all loading UIs consistency in the Setting page, I adjusted the spinner in the DisconnectAccounts as well - ffba448

Comment on lines +114 to +115
<SpinnerCard />
<SpinnerCard />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: at first it looks weird to have two SpinnerCards like this, but after digging into the source code, I came to understand they correspond to the PhoneNumberCard and StoreAddressCard in Line 106-110.

/>
<div className="gla-settings">
<ContactInformation
view="settings"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ The value "settings" is not really being used in this PR. I'm guessing it is used in the other PRs? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though the value "settings" is not be used, I thought it still good to indicate the view prop because I think none of "settings" and "setup-mc" should be the default value. And I was planning to add JSDos for ContactInformation like this:

/**
 * @param {Object} props React props.
 * @param {'setup-mc'|'settings'} props.view
 */

Comment on lines 47 to 53
<AppButton
isTertiary
target="_blank"
href={ learnMoreUrl }
>
{ __( 'Learn more', 'google-listings-and-ads' ) }
</AppButton>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I think we should do track event for this "Learn more" button here. Either we use AppButton with eventName and eventProps, or AppDocumentationLink (which I think is better in semantic, but I guess you would need to mingle with CSS layout a little).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reminding. Added by bf236cb.

image

Base automatically changed from feature/863-mc-store-address to feature/contact-info August 4, 2021 07:17
@eason9487 eason9487 merged commit dfc4be1 into feature/contact-info Aug 4, 2021
@eason9487 eason9487 deleted the feature/863-settings-contact-info branch August 4, 2021 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants