-
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 Audience Tiles widget (Storybook) #8136
Comments
@asvinb, this one is similar to #8135. We need to re-purpose AC to focus on the widget component creation as it is the main goal here. A new storybook story is just an addition to the new component to be able to see how it works since it won't be connected to the codebase yet. |
Thanks @eugene-manuilov . Let me know if it's clearer now. Thanks! |
Yes, thanks! AC ✔️ |
IB ✔️ |
@techanvil I have an implementation in the attached PR, I've added details into the PR technical description. One thing I noted is that the report structure didn't really match the prop structure defined in the AudienceTile component which leads to a lot of restructuring here in the AudienceTiles component. We will have to do some form of restructuring however I think we could simplify this somewhat by adjusting the prop structure of the AudienceTile.
As the AudienceTile component doesn't itself contain the selectors for the data, when looking into this, I ended up reimplementing AudienceTiles structure inside of the AudieceTile stories which was super messy IMO. Perhaps there is a middle ground or the boilerplate is worth it here to keep the stories setup consistent across stories? |
QA Update ❌Hi @kuasha420 , this is looking good overall. ITEM 1: Figma: The arrows are the same size, which indicates equal distances top and bottom. On the last section, there is an extra space because of the margin of the entire card. ITEM 2: ITEM 3: ITEM 4: ITEM 5: ITEM 6: |
Hi @kelvinballoo, thanks for raising these points. I'm going to answer these as I've got more context on the issue and epic as a whole. I'll then let @kuasha420 create a followup PR to address what does need addressing here.
Good spot - this should indeed be updated to vertically centre the icons as per Figma.
This doesn't need addressing here. For a bit of context - we'll mostly simply be displaying the audiences names as they are set in Analytics - the capitalisation will therefore be up to the user's preferences for the most part. That said, "All Users" is a special case as one of the default audiences. Because we are going to be creating "New visitors" and "Returning visitors" with this capitalisation we do actually want to change the way we display the "All Users" audience for consistency, so your point is still valid. However, we are going to be addressing this in a separate issue where we map "All Users" to "All visitors" - see #8487.
The "partial data" badges will be implemented via a separate issue, see #8142. Good shout about ensuring we capture the ellipses in Storybook though, this is worth an update here.
No, this will be addressed via #8138.
Adding a two-tile story is a good shout and can be addressed here. However please note that the placeholder tiles will be covered in a separate issue, see #8146.
This doesn't really need addressing as it's just sample data; that said it could be worth showing different data to help illustrate the fact that they are indeed using separate reports. If it's not too much effort I'd say it's worth addressing this here too. Ok, over to you @kuasha420, please send it back to me for the followup CR :) |
Thank you @kelvinballoo & @techanvil ! Based on your feedback, I've filed a follow up PR that fixes ITEM 1 and 5. Item 3 will be fixed via #8626 and ITEM 6 will be fixed by #8627 Thank you. |
That's great, thanks @kuasha420. Back to you for another pass, @kelvinballoo! |
QA Update
|
Thanks @kelvinballoo. The ellipses will be covered in the followup issue #8626. |
QA Update ✅Sounds good @techanvil . |
Feature Description
Create the Audience Tiles widget component and add it to Storybook, showing the happy path audience tiles.
Note that this widget is displayed in a tabbed view for the mobile viewport while the desktop view is displayed as a list of tiles, and as a scrollable list at narrower desktop viewports when there are three tiles.
See audiences tiles in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
Add assets/js/modules/analytics-4/components/widgets/AudienceSegmentation/AudienceTiles.js
Widget
propactiveTile, setActiveTile
. This will be used to mobile view to determine the visible tile.getConfiguredAudiences()
selector to retrieve configured audiences and save it in a variable, sayconfiguredAudiences
, which is implemented together with selector above in 8176getReport
action onMODULES_ANALYTICS_4
datastore. You can see an example in any of the key metrics widgets on how to formatreportOptions
and handlegetReport
. ThereportOptions
object should:audienceResourceName
in dimensionsdimensionFilters
foraudienceResourceName
dimension, withinListFilter
type, and pass theconfiguredAudiences
array which will hold the audiences name fields, which translate toaudienceResourceName
dimension. For an example on how to use this filter you can refer to this codesite-kit-wp/assets/js/modules/analytics-4/components/widgets/TopRecentTrendingPagesWidget.js
Lines 121 to 130 in ab9d76b
Metric definitions
in the design docPageviews
should be acquired in separate report request withoutaudienceResourceName
dimension included. And although not mentioned in design doc, potentiallyTop content by pageviews
might need separate handling due to thepagePaths
dimension which will needgetPageTitles
action to match the titles with paths, and also usage of custom dimensions. Refer to thePopularContentWidget
component for usage example on titles.Widget
component, and add a classgooglesitekit-widget__audience-tiles
to it.useBreakpoint
hook to extract the current device sizeBREAKPOINT_SMALL
, usegetAudiences()
selector to retrieve audiences, filtered to match only the ones inconfiguredAudiences
.name
property ofgetAudiences
for filtering.displayName
from results to collect the tiles titles and rendered them in separatediv
wrapper above the tiles.activeTile
to switch between tiles and conditionally render equivalent tile.configuredAudiences
:audienceResourceName
dimension, and prepare the values to match the required/expected props inAudienceTile
implemented in 8135AudienceTile
componentassets/sass/components/analytics-4/audience-segmentation/audience-tiles.scss
and apply the styles to match the figma designs linked in AC for desktop and mobile.Responsive behavior
section of the design docTest Coverage
AudienceTiles
componentQA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: