-
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
Scaffold new Unified Dashboard widget contexts and widget areas #4031
Comments
@tofumatt It may be good to clarify in the last bullet point of the ACs how these renders should be organized? Basically in the order above, 4 on the main dashboard, 4 on the entity dashboard, each one below each other. |
You referenced I like the approach of conditional extending the object you're exporting here, but maybe it makes sense to leave the exports as-is rather than creating the export default {
CONTEXT_DASHBOARD,
CONTEXT_PAGE_DASHBOARD,
CONTEXT_MODULE_SEARCH_CONSOLE,
CONTEXT_MODULE_ANALYTICS,
CONTEXT_MODULE_ADSENSE,
( isFeatureEnabled( 'unifiedDashboard' ) ? { /* OTHER, NEW CONSTANTS */ } : {} ),
}; I think on a call I suggested the variable approach but I suppose it's not needed. |
Thanks @tofumatt, I've edited the IB. Back to you for another pass 👍 |
IB ✅ |
@tofumatt I just noticed that when I did the IB I missed out registering the entity widget areas. Looking at the designs, the titles for the widgets are going to need to interpolate things like the post title and URL? Possibly very straightforward but I'd be keen to get your thoughts when you have a chance. |
After a conversation with @tofumatt, we decided that the entity dashboard widget areas can be identical for now (same widths, titles etc). IB updated. |
@tofumatt Thinking about this more carefully, I'm not sure this is the right approach:
If we optionally export these constants then of course all the consumers will have to optionally import them, for example when registering widgets: widgets.registerWidget(
'adsenseTopEarningPages',
{
Component: DashboardTopEarningPagesWidget,
width: [ widgets.WIDGET_WIDTHS.HALF, widgets.WIDGET_WIDTHS.FULL ],
priority: 2,
wrapWidget: false,
},
[
AREA_DASHBOARD_EARNINGS,
...( isFeatureEnabled ? [ AREA_MAIN_DASHBOARD_MONETIZATION_PRIMARY ] : [] )
]
); It seems a lot of logic all over the place for the sake of some strings... what do you think? |
I don't think that's correct, because what's exported is an object with a bunch of attributes. In this case the attributes won't be present on the object, but that seems fine—if anything you could check to see if said attribute was Because we can import the default export (an object) and use something like |
Just a note that we discussed the above on a call and it was decided that conditionally exporting the widget constants was unnecessary. I'll strike-through the relevant steps in the IB. |
QA: ✅
|
Feature Description
Each new section on the main dashboard and entity dashboard should get its own widget context. We should create a new widget context for both the Main Dashboard and the Entity Dashboard. Using new contexts/variables will make it easier to sort out old/new usage, registrations, etc.
Each context should have a single Widget area that all initial widgets will use. A Primary suffix for each area, based on the context name, should be sufficient for now (eg. MainDashboardTrafficPrimary). This gives us the ability to add more widget areas later—but for now we’ll use a single area.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
DashboardMainApp
should have the following new widget contexts, rendered one after the other, in this order:mainDashboardTraffic
mainDashboardContent
mainDashboardSpeed
mainDashboardMonetization
DashboardEntityApp
should have the following new widget contexts, rendered one after the other, in this order:entityDashboardTraffic
entityDashboardContent
entityDashboardSpeed
entityDashboardMonetization
Primary
suffix. So there should be the following widget areas:mainDashboardTrafficPrimary
mainDashboardContentPrimary
mainDashboardSpeedPrimary
mainDashboardMonetizationPrimary
entityDashboardTrafficPrimary
entityDashboardContentPrimary
entityDashboardSpeedPrimary
entityDashboardMonetizationPrimary
WidgetContextRenderer
for each Widget Context listed on the respectiveDashboardMainApp
andDashboardEntityApp
components.Implementation Brief
Define the view contexts
Inside
assets/js/googlesitekit/widgets/default-contexts.js
, add the following constants:CONTEXT_MAIN_DASHBOARD_TRAFFIC = 'mainDashboardTraffic';
CONTEXT_MAIN_DASHBOARD_CONTENT = 'mainDashboardContent';
CONTEXT_MAIN_DASHBOARD_SPEED = 'mainDashboardSpeed';
CONTEXT_MAIN_DASHBOARD_MONETIZATION = 'mainDashboardMonetization';
CONTEXT_ENTITY_DASHBOARD_TRAFFIC = 'entityDashboardTraffic';
CONTEXT_ENTITY_DASHBOARD_CONTENT = 'entityDashboardContent';
CONTEXT_ENTITY_DASHBOARD_SPEED = 'entityDashboardSpeed';
CONTEXT_ENTITY_DASHBOARD_MONETIZATION = 'entityDashboardMonetization';
You will need to optionally export them along with the existing contexts based on whether theunifiedDashboard
feature flag is enabled. For example, something like:Define the widget areas
Inside
assets/js/googlesitekit/widgets/default-areas.js
, add the following constants:DashboardMainApp
:AREA_MAIN_DASHBOARD_TRAFFIC_PRIMARY = 'mainDashboardTrafficPrimary';
AREA_MAIN_DASHBOARD_CONTENT_PRIMARY = 'mainDashboardContentPrimary';
AREA_MAIN_DASHBOARD_SPEED_PRIMARY = 'mainDashboardSpeedPrimary';
AREA_MAIN_DASHBOARD_MONETIZATION_PRIMARY = 'mainDashboardMonetizationPrimary';
DashboardEntityApp
:AREA_ENTITY_DASHBOARD_TRAFFIC_PRIMARY = 'entityDashboardTrafficPrimary';
AREA_ENTITY_DASHBOARD_CONTENT_PRIMARY = 'entityDashboardContentPrimary';
AREA_ENTITY_DASHBOARD_SPEED_PRIMARY = 'entityDashboardSpeedPrimary';
AREA_ENTITY_DASHBOARD_MONETIZATION_PRIMARY = 'entityDashboardMonetizationPrimary';
Similarly to the view contexts above, you will need to optionally export these depending on whether theunifiedDashboard
feature is enabled.Register the widget areas
Inside
assets/js/googlesitekit/widgets/register-defaults.js
unifiedDashboard
feature flag is enabled usingisFeatureEnabled
.AREA_MAIN_DASHBOARD_TRAFFIC_PRIMARY
WIDGET_AREA_STYLES.BOXES
CONTEXT_MAIN_DASHBOARD_TRAFFIC
AREA_MAIN_DASHBOARD_CONTENT_PRIMARY
WIDGET_AREA_STYLES.COMPOSITE
CONTEXT_MAIN_DASHBOARD_CONTENT
AREA_MAIN_DASHBOARD_SPEED_PRIMARY
WIDGET_AREA_STYLES.BOXES
CONTEXT_MAIN_DASHBOARD_SPEED
AREA_MAIN_DASHBOARD_MONETIZATION_PRIMARY
WIDGET_AREA_STYLES.BOXES
CONTEXT_MAIN_DASHBOARD_MONETIZATION
AREA_ENTITY_DASHBOARD_TRAFFIC_PRIMARY
WIDGET_AREA_STYLES.BOXES
CONTEXT_ENTITY_DASHBOARD_TRAFFIC
Render the view contexts
Inside
assets/js/components/DashboardMainApp
:CONTEXT_MAIN_*
contexts we just created fromassets/js/googlesitekit/widgets/default-contexts.js
.WidgetContextRenderer
slug
prop will be the contextHeader
prop will be theHeader
component (assets/js/components/Header.js
) for nowCONTEXT_MAIN_DASHBOARD_TRAFFIC
CONTEXT_MAIN_DASHBOARD_CONTENT
CONTEXT_MAIN_DASHBOARD_SPEED
CONTEXT_MAIN_DASHBOARD_MONETIZATION
Inside
assets/js/components/DashboardEntityApp
, repeat the process using theCONTEXT_ENTITY_*
contexts.CONTEXT_ENTITY_DASHBOARD_TRAFFIC
CONTEXT_ENTITY_DASHBOARD_CONTENT
CONTEXT_ENTITY_DASHBOARD_SPEED
CONTEXT_ENTITY_DASHBOARD_MONETIZATION
Test Coverage
Visual Regression Changes
QA Brief
DashboardMainApp
andDashboardEntityApp
in the correct order.Changelog entry
The text was updated successfully, but these errors were encountered: