-
Notifications
You must be signed in to change notification settings - Fork 286
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 the Selection Panel happy path view (Storybook) #8157
Comments
Hey @hussain-t, just a heads up that I've amended the Feature Description here to make it clear that we do want to include the logic described in available audiences as part of this issue. I've also tweaked that section in the design doc to point out that the implementation can leverage the "partial data" infrastructure, and as a result I've added #8141 to the dependencies for this issue. Cc @ivonac4 |
Hi @hussain-t, just a heads up that I've made a small tweak to the AC to make it clear that we should be leveraging the audience cache here, as opposed to retrieving the audiences directly from the audiences API. |
Hi @hussain-t, I've also added a point to the AC to make it clear we don't need to address the specific details of audience ordering in this issue, this will be handled via #8519. This shouldn't actually have any impact on this issue, just want to give a heads up for clarity. |
@ankitrox, could you set an estimate? |
@hussain-t Added the estimate. |
Hi @ankitrox, thanks for drafting this IB. Here are some points to consider:
|
Thanks @nfmohit, that looks great. Over to QA for testing :) |
QA Update
|
Thank you for sharing your observations, @kelvinballoo !
This is consistent with what we have in the Key Metrics selection panel. If we should change the font here, I believe we should change it in the KM panel as well for consistency. @sigal-teller Could you confirm if the font should be changed here to
I'm opening a follow-up PR for this.
As you mentioned, this uses the re-usable component that both KM and audience selection panels use, so if we want to change it here, we should change it everywhere else for consistency.. @sigal-teller We need your confirmation here as well to see if this change should be applied for all selection panels. Thanks!
As this is a Storybook-only issue, unfortunately, these cannot be tested here, but can be done in #8158. I'll add them in the QAB for #8158.
You should be able to see the user count from the mock report data in Storybook. You'll be able to see actual data in #8158.
The link is correct, however, unfortunately, you'll not be able to see it in Storybook. It should be verifiable in #8158. The link doesn't scroll down to the respective section though. @techanvil mentioned he is going to open an issue for it. Thanks! |
I have opened a follow-up PR #8829 to address some of the concerns above. For this to move forward, we have two questions for @sigal-teller that we need for confirmation:
Thank you! |
@nfmohit The links you added appears broken for me so I can see exactly what you're referring to. In any case, I'm using the styles that we have in the design system, so I'm not sure why the font is changing for you. Maybe there are missing fonts or styles for you and this is why replaces them? Anyway, group names (if that was what you were referring to) are label medium. LMK if you were referring to something else. |
Hi @sigal-teller. I have updated the links for you, thank you for pointing that out. In summary, we have two questions: 1st: 2nd: |
Thank you for confirming, @sigal-teller. I'll make these updates accordingly. |
@kelvinballoo This is now in CR with PR #8829 that addresses your observations: ITEM 1 & ITEM 2. For ITEM 3, I have opened a new issue #8856. The other questions have been addressed in my previous comments. Thanks! |
Audience selection panel style improvements
@kelvinballoo Back to you for another pass, the ITEM 1 and 2 should now be fixed. As noted by @nfmohit above, the 3rd item is a much bigger change, so it will be fixed in a follow up issue. |
QA Update ✅All the issues are resolved or have an action in another ticket. Moving this ticket to 'Approval'. ITEM 1: ✅ ITEM 2: ✅ ITEM 3: ✅ ITEM 4: ✅ |
Feature Description
Create the Selection Panel component, implementing the happy path view, and add it to Storybook.
This should include the CTAs but not the behaviour for saving the selection, this will be handled separately via #8158.
Additionally it should not include the loading state, the Audience Creation Notice or the Selection Panel Info Notice, these will be also handled separately via #8162, #8164 and #8159.
It should include the logic/behaviour described in the selection panel > available audiences section.
See selection panel in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
availableAudiences
setting). Their display names and descriptions should be displayed directly, with the exception of the "All users" default audience which should be shown as "All visitors".Implementation Brief
Please refer POC PR: #8676.
Also, this implementation will be done once #8652 is merged.
AudiencesSelectionPanel
insideassets/js/modules/analytics-4/components/AudienceSegmentation/
constants.js
inside new directory. Add the following constants in it similar to key metrics component.AUDIENCES_SELECTION_PANEL_OPENED_KEY
,AUDIENCES_SELECTION_FORM
,AUDIENCES_SELECTED
,MIN_SELECTED_AUDIENCES_COUNT
andMAX_SELECTED_AUDIENCES_COUNT
.index.js
which will haveAudiencesSelectionPanel
component in it.SelectionPanel
component and pass the relevant props to it.AUDIENCE_SELECTION_PANEL_OPENED_KEY
constant to passisOpen
prop toSelectionPanel
.onOpen
prop should accept a callback function where the callback should add the list of saved audiences toAUDIENCES_SELECTED
. List of saved audiences can be retrieved usinggetConfiguredAudiences
selector.closePanel
prop should be a callback to setAUDIENCES_SELECTION_PANEL_OPENED_KEY
value tofalse
. This callback will also be passed to header component to be triggered on close button's click added in header.SelectionPanel
component. Following components needs to be rendered, which would be passed aschildren
to theSelectionPanel
component.Header
AudienceItems
Footer
Header
component insideAudiencesSelectionPanel
directory.SelectionPanelHeader
and pass following props to it.title
- Heading text for the selection panel.onCloseClick
- Callback to trigger when selection panel is closed. This can be same callback passed toSelectionPanel
.children
This should display the text under the main heading with the settings link. This is a component created withcreateInterpolateElement
. Refer the figma design for the copy.AudienceItems
component insideAudiencesSelectionPanel
directory.SelectionPanelItems
component and pass the necessary props to it.availableSavedItems
andavailableUnsavedItems
should be calculated by fetching available audiences usinggetAvailableAudiences
selector which returns the available audiences in property andgetConfiguredAudiences
which returns the saved audiences in DB.getAvailableAudiences
should be modified to check if "Purchasers" audience has had any data. This can be checked withgetResourceDataAvailabilityDate
from the partial data infra. If there is any data available for the "Purchasers" i.e.getResourceDataAvailabilityDate
does not return 0 orundefined
, we should keep "Purchasers" ingetAvailableAudiences
response.getAvailableAudiences
response as we do not want to show "Purchasers" audience in this case.availableSavedItems
andavailableUnsavedItems
props, they must be mapped to includetitle
,description
,subtitle
anduserCount
properties.title
would bedisplayName
from audiences response.description
belongs todescription
property.subtitle
is the text which appears below description. As seen in the figma designs, it will beCreated by ....
text.subtitle
would be "Created by default by Google Analytics"subtitle
would be "Created by Site Kit".subtitle
should be "Already exists in your Analytics property".userCount
would be the total number of users in audience for the selected period. This should use thegetReport
selector from analytics module where the metric would betotalUsers
and dimension isaudienceResourceName
.isResourcePartialData
selector to check if there "Purchasers" has had any audience.savedItemSlugs
pass the value returned bygetConfiguredAudiences
which is array ofname
in audience response.ItemComponent
should beAudiencesItem
which will be responsible to render individual selection item in the panel.title
,description
,subtitle
anduserCount
props as mentioned above.userCount
assuffix
into (maybe wrapped into some JSX)SelectionPanelItem
component.suffix
prop is described in below point.suffix
to the componentSelectionPanelItem
. This should be a react component which should be rendered after the SelectionBox component.suffix
can be a function which returnsfalse
(suffix = () => false
), so that if nothing is passed, it should not render anything. This is particularly useful in case of KM panel.AudiencesItem
component insideAudiencesSelectionPanel
directory.SelectionPanelItem
component and pass the necessary props to it. All these props should already be passed bySelectionPanelItems
component down to this component.description
as react component which encompasses ofdescription
of the audience andcreated by
subtitle.Footer
component insideAudiencesSelectionPanel
directory.SelectionPanelFooter
component to return the new composed component for audience segmentation selection panel footer.savedItemSlugs
- These are the items returned fromgetConfiguredAudiences
.selectedItemSlugs
- This can be retrieved fromAUDIENCES_SELECTED
insideAUDIENCES_SELECTION_FORM
. Please refer this example here.SelectionPanelFooter
and pass them accordingly. A reference ofMetricsFooter
component can be taken to build other props.assets/sass/components/global/_googlesitekit-selection-panel.scss
, target.googlesitekit-selection-panel-footer__content
and make it display block..googlesitekit-selection-panel-footer__item-count
should be text aligned left and.googlesitekit-selection-panel-footer__actions
should be text aligned right with display block.Test Coverage
Add the
AudiencesSelectionPanel
in storybook with the following scenarios.Default
- Where it should show the flat list of all the audiences.SavedSelection
- Where it should show theCurrent selection
andAdditional groups
.Current selection
will show the saved items.View-only user
- With view only context.Write the test for
AudienceSegmentation/AudienceSelectionPanel
component. Take reference of KM component tests. Not all of the tests in theMetricsSelectionPanel
suite will apply to theAudienceSelectionPanel
, so copy/modify the tests which are applicable and add any additional tests as needed.QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: