-
Notifications
You must be signed in to change notification settings - Fork 21
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
Separate Phone and Address settings #1025
Conversation
to make it easier to add preloaders more subtle than spinners. Copy the code from https://github.com/woocommerce/woocommerce-admin/blob/9f68059c7df466ee7a559c555bcb5a7b9e421e6d/packages/style-build/abstracts/_mixins.scss#L22-L35
into `EditPhoneNumber` and `EditStoreAddress`. Addresses #962 (comment)
to simplify the logic, change "Edit" to internal link.
So we could provide any title when needed.
Open in the same tab.
when the data is missing. So they could show links to separated pages. Adjust `StoreAddressCardPreview` to show profiled warning.
To be shared with `PhoneNumberCard` preview.
as described in #962 (comment).
Show a warning when the address is different than the WC one.
js/src/components/contact-information/contact-information-preview-card.js
Outdated
Show resolved
Hide resolved
isSecondary | ||
iconSize={ 16 } | ||
iconPosition="right" | ||
href={ editHref } |
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 provides better accessibility but makes browser load the next page from the HTML document. Maybe it could take the same way as the "View Reports" button.
google-listings-and-ads/js/src/dashboard/index.js
Lines 40 to 42 in 09f25d8
<Link href={ getNewPath( null, '/google/reports' ) }> | |
<Button isPrimary>View Reports</Button> | |
</Link> |
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.
Thanks for catching this!
It seems to be linked to a more generic problem. Another one in the batch of WC vs WP Links.
I created an issue in WC-admin repo.
To me <Link><Button>
still has a serious A11Y issue, with being seen as "Edit - button" instead of "Edit - visited link".
I'll create an issue in our repo as well, to solve it somehow for all internal button links.
#1027
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.
<Link>Button>
-> <a><button>
is also an invalid HTML, so I'd leave it as is, and try to fix it sooner than later in #1027, by cloning wc-admins wcAdminLinkHandler
to AppButton
.
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.
try to fix it sooner than later in #1027, by cloning wc-admins
wcAdminLinkHandler
toAppButton
.
Thanks! I also think it's feasible.
js/src/components/contact-information/contact-information-preview-card.js
Outdated
Show resolved
Hide resolved
js/src/components/contact-information/contact-information-preview-card.js
Outdated
Show resolved
Hide resolved
js/src/components/contact-information/contact-information-preview-card.js
Outdated
Show resolved
Hide resolved
js/src/components/contact-information/phone-number-card/phone-number-card-preview.js
Outdated
Show resolved
Hide resolved
@@ -10,7 +10,8 @@ export const subpaths = { | |||
editFreeListings: '/free-listings/edit', | |||
editCampaign: '/campaigns/edit', | |||
createCampaign: '/campaigns/create', | |||
editContactInformation: '/edit-contact-information', |
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.
Sorry🙏 , I forgot to list a corresponding URL reference. It needs to change as well.
google-listings-and-ads/src/PluginHelper.php
Lines 147 to 149 in 09f25d8
protected function get_contact_information_setup_url(): string { | |
return admin_url( 'admin.php?page=wc-admin&path=/google/settings&subpath=/edit-contact-information' ); | |
} |
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.
Ah, sorry, I got it on my paper to do list, but forgot about it.
I think, the best we can do now, given, there is no single contact information page, is to point merchants to the overall settings page.
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.
Or do you think we should have two separate notes 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.
I think, the best we can do now, given, there is no single contact information page, is to point merchants to the overall settings page.
I was thinking about it in the same way.
Or do you think we should have two separate notes now?
I think this would be adjusted later. According to Figma, after the phone verification state being available from Google end, there will be a new notification box and dedicated account issue that point to the edit phone number subpage in Settings.
href={ editHref } | ||
text={ __( 'Edit', 'google-listings-and-ads' ) } | ||
eventName={ editEventName } | ||
eventProps={ { path: getPath(), subpath } } |
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.
📝 +❔
<ContactInformationPreviewCard>
is only used in the main settings page after this PR. The subpath
is always undefined
here. And it also depends on whether the relevant #1025 (comment) has further adjustment. Maybe there's no need to have this tracking event prop.
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.
My mental model was that ContactInformationPreviewCard
is a component, which means it should not impose, or be aware apriori, where/at what URL it will be used.
Therefore it should assume it could be used anywhere on a shallow or deep page.
BTW, I was thinking that maybe we should add this path, [subpath]
props on a generic level to all props, as we already have it or context
on the majority of events.
IMHO, it's quite easy to get and gives quite detailed information to a tracks consumer.
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.
My mental model was that
ContactInformationPreviewCard
is a component, which means it should not impose, or be aware apriori, where/at what URL it will be used.Therefore it should assume it could be used anywhere on a shallow or deep page.
Got it.
What I thought before was that it might always be undefined
under the use cases we known and if there are any further adjustments from the #1025 (comment). So it could be a bit strange to just look at the code if the "always be undefined" happened.
Considering that a component shouldn't be imposed where it will be used, I thought there's a common way that merges a react prop eventProps
given from consumer sides.
But we can get the clue of subpath
from the tracking README and have the subsequence adjustments - 54aea65 and 1db2271. I think it should be ok for 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.
Also, if we would have solved routing in a sense that path
could be as well /settings
, /settings/store-address
, /settings/store-address/coordinates
, without the need of separate query param for every level, the problem would be solved without a need of picking those props in all the places.
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 made a proposal/POC/RFC at #1031
Co-authored-by: Eason <[email protected]>
…e/google-listings-and-ads into feature/962-separate-settings
as now there is no single contact information page. Addresses #1025 (comment).
@eason9487 I addressed or commented on all your comments, could you take this PR for another round? |
Add the actual code and tracking readme changes, as the changes made before in 54aea65 changed only JSDoc. Addresses #1025 (comment).
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 locally and works well. LGTM.
Changes proposed in this Pull Request:
Add placeholder mixin, (659d29d)
to make it easier to add preloaders more subtle than spinners.
(Copied the code from woocommerce/woocommerce-admin@9f68059/packages/style-build/abstracts/_mixins.scss#L22-L35)
Add support for custom appearance to
AccountCard
(a7286c2)So we could provide any title when needed.
Split
EditContactInformation
, (568bb3e, e836e5e)into
EditPhoneNumber
andEditStoreAddress
.Separate preview mode of
StoreAddressCard
andPhoneNumberCard
into separate components. (c21c74c, bc3b635, 55f63d0, 8f349e7)Extract shared code into
ContactInformationPreviewCard
.Simplify the logic. Change "Edit" to internal link.
This PR changes "Edit" buttons to be regular links, so they could be
ctrl + click
ed, and navigated with browser built-in features.Addresses #962 (comment)
Screenshots:
Detailed test instructions:
Happy path
/wp-admin/admin.php?page=wc-admin&path=%2Fgoogle%2Fsettings
Missing contact info.
This is quite hard to achieve with newly created accounts. Ideally, you should have an old account w/o a store/phone address.
Different store address
/wp-admin/admin.php?page=wc-settings
/wp-admin/admin.php?page=wc-admin&path=%2Fgoogle%2Fsettings
Mocked missing phone number
/js/src/data/actions.js#L521
to data: { ...data, phone_number: '' },`.npm run dev
/wp-admin/admin.php?page=wc-admin&path=%2Fgoogle%2Fsettings
Changelog entry
Additional notes
<ContactInformationPreviewCard>
setsaria-busy
only on the preloader, I think it should be set on the entire card, but I'm not sure how to achieve it given we don't have the reference to the Card's container DOM element, and React does not expose something like the nativeElementInternals
.To be done later, in separate PRs