-
Notifications
You must be signed in to change notification settings - Fork 295
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
Enhance/6261 key metrics settings toggle #6718
Enhance/6261 key metrics settings toggle #6718
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
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 all the refactoring @kuasha420! I've had a look at the non-test files in this PR and added some minor comments. Overall looks great.
return array(); | ||
return array( | ||
'widgetSlugs' => array(), | ||
'isWidgetHidden' => 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 think this value is storing whether the widget is "hidden" or not, once it is setup. So we can default this to false
perhaps? Semantically, if the widget is not set up, then it is technically "NOT" hidden even though it is invisible. It is just not available because there aren't any widgets to be displayed. If there are no key-metrics returned, then the widget area will automatically be invisible even though the isWidgetHidden
flag is set to false
.
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 the PR where @jimmymadon and I decided to refactor a bunch of stuff to make things more streamlined. So leaving some comments to provide some context to potential code reviewers.
{ isUserInputCompleted && ( | ||
<Layout | ||
title={ __( 'Key metrics', 'google-site-kit' ) } | ||
header | ||
rounded | ||
> | ||
<div className="googlesitekit-settings-module googlesitekit-settings-module--active googlesitekit-settings-user-input"> | ||
<Grid> | ||
<Layout | ||
title={ __( 'Key metrics', 'google-site-kit' ) } | ||
header | ||
rounded | ||
> | ||
<div className="googlesitekit-settings-module googlesitekit-settings-module--active googlesitekit-settings-user-input"> | ||
<Grid> | ||
<SettingsKeyMetrics /> | ||
</Grid> | ||
<Grid> | ||
{ isUserInputCompleted && ( | ||
<UserInputPreview | ||
goTo={ goTo } | ||
noHeader | ||
noFooter | ||
settingsView | ||
showIndividualCTAs | ||
/> | ||
</Grid> | ||
</div> | ||
</Layout> | ||
) } | ||
|
||
{ isUserInputCompleted === false && ( | ||
<UserInputSettings isDismissible={ false } rounded /> | ||
) } | ||
) } | ||
{ isUserInputCompleted === false && ( | ||
<div className="googlesitekit-user-input__notification"> | ||
<Cell> | ||
<p> | ||
<span> | ||
{ __( | ||
'Answer 3 quick questions to help us show the most relevant data for your site', | ||
'google-site-kit' | ||
) } | ||
</span> | ||
</p> | ||
<Link href={ userInputURL }> | ||
{ __( | ||
'Personalize your metrics', | ||
'google-site-kit' | ||
) } | ||
</Link> | ||
</Cell> | ||
</div> | ||
) } | ||
</Grid> | ||
</div> | ||
</Layout> |
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 changes are necessary due to the following reason:
- The user should be able disable the Key Metrics Widget as long as the
getKeyMetrics
selector fromCORE_WIDGETS
returns one or more widgets, be it based on User Input Question or Manually Picked. - However, As long as user has not completed the user input questions, they'll continue to get the CTA to answer them. This is regardless of whether user has manually selected key metrics widgets or turned off the Key Metrics using the toggle.
Therefore, as long as userInput
feature flag is enabled, the Key Metrics
section in settings will remain and will be potentially populated with SettingsKeyMetrics
and User Input CTA or Preview.
The UserInputSettings
could no longer be used because it would cause multiple Key Metrics
title/sections. Therefore I used the Link
and p
and styled them accordingly. Moreover, the UserInputSettings
component will be removed once the user input dashboard CTA is created according to design in #6210.
assets/js/modules/analytics-4/components/widgets/EngagedTrafficSourceWidget.js
Show resolved
Hide resolved
assets/js/modules/analytics-4/components/widgets/EngagedTrafficSourceWidget.test.js
Outdated
Show resolved
Hide resolved
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.
@kuasha420 Thanks for these - I've added one comment if you want to move the key-metrics.js
within utlils to the /components
folder. But this is not a big issue and we don't have a definite pattern here - so I will leave this up to you. But everything else looks good to me.
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, @kuasha420. This is a good start, but there are things that we need address before merging this PR. Please, take a look at my comments.
assets/js/modules/analytics-4/components/widgets/EngagedTrafficSourceWidget.js
Show resolved
Hide resolved
Build files for f1a254d have been deleted. |
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, @kuasha420. Almost looks good to me. Left two more comments.
@eugene-manuilov I've added more context on the changes. Also the VRT issue was fixed after merging develop. Please, let me know what you think. Cheers! |
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.
@kuasha420, could you please fix merge conflicts?
@kuasha420 @eugene-manuilov, I think there is confusion regarding #6210. The feature description clearly says:
|
@hussain-t Originally, the |
@eugene-manuilov all sorted. Please have a look. Cheers! |
Thanks for the clarification, @jimmymadon! |
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, @kuasha420. LGTM!
Summary
Addresses issue:
Relevant technical choices
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist