Skip to content
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

Stats: Release new date filtering to production #97060

Merged
merged 5 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions client/my-sites/stats/modernized-chart-tabs-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ $custom-stats-tab-mobile-break: $break-medium;
width: 100%;
padding: 24px 0 16px;
border: 0;
// Use border radius of its parent; otherwise it'd break the parent corner.
border-radius: 4px;
box-sizing: border-box;

display: flex;
Expand Down Expand Up @@ -108,6 +110,7 @@ $custom-stats-tab-mobile-break: $break-medium;
grid-template-columns: 2fr 2fr 3fr;
align-items: center;
justify-content: space-between;
border-radius: 0;
}

&:hover {
Expand Down
9 changes: 6 additions & 3 deletions client/my-sites/stats/site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ class StatsSite extends Component {
if ( activeTab !== state.activeTab ) {
return {
activeTab,
activeLegend: activeTab.legendOptions || [],
// TODO: remove this when we support hourly visitors.
activeLegend: props.period !== 'hour' ? activeTab.legendOptions || [] : [],
};
}
return null;
}

getAvailableLegend() {
const { period } = this.props.period;
const activeTab = getActiveTab( this.props.chartTab );
return activeTab.legendOptions || [];
// TODO: remove this when we support hourly visitors.
return period !== 'hour' ? activeTab.legendOptions || [] : [];
}

navigationFromChartBar = ( periodStartDate, period ) => {
Expand Down Expand Up @@ -310,7 +313,7 @@ class StatsSite extends Component {
momentSiteZone,
wpcomShowUpsell,
} = this.props;
const isNewDateFilteringEnabled = config.isEnabled( 'stats/new-date-filtering' ) || isInternal;
const isNewDateFilteringEnabled = config.isEnabled( 'stats/new-date-filtering' );
let defaultPeriod = PAST_SEVEN_DAYS;

const shouldShowUpsells = isOdysseyStats && ! isAtomic;
Expand Down
27 changes: 15 additions & 12 deletions client/my-sites/stats/stats-chart-tabs/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,21 @@ function addTooltipData( chartTab, item, period, customRange = {} ) {
className: 'is-views',
icon: <Icon className="gridicon" icon={ eye } />,
} );
tooltipData.push( {
label: translate( 'Visitors' ),
value: numberFormat( item.data.visitors ),
className: 'is-visitors',
icon: <Icon className="gridicon" icon={ people } />,
} );
tooltipData.push( {
label: translate( 'Views Per Visitor' ),
value: numberFormat( item.data.views / item.data.visitors, { decimals: 2 } ),
className: 'is-views-per-visitor',
icon: <Icon className="gridicon" icon={ chevronRight } />,
} );

if ( Number.isFinite( item.data.visitors ) ) {
tooltipData.push( {
label: translate( 'Visitors' ),
value: numberFormat( item.data.visitors ),
className: 'is-visitors',
icon: <Icon className="gridicon" icon={ people } />,
} );
tooltipData.push( {
label: translate( 'Views Per Visitor' ),
value: numberFormat( item.data.views / item.data.visitors, { decimals: 2 } ),
className: 'is-views-per-visitor',
icon: <Icon className="gridicon" icon={ chevronRight } />,
} );
}

if ( item.data.post_titles && item.data.post_titles.length ) {
// only show two post titles
Expand Down
2 changes: 1 addition & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"ssr/prefetch-timebox": false,
"stats/empty-module-traffic": true,
"stats/empty-module-v2": true,
"stats/new-date-filtering": false,
"stats/new-date-filtering": true,
"stats/paid-wpcom-v2": true,
"stats/paid-wpcom-v3": true,
"stepper-woocommerce-poc": true,
Expand Down
2 changes: 1 addition & 1 deletion config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"ssr/prefetch-timebox": true,
"stats/empty-module-traffic": true,
"stats/empty-module-v2": true,
"stats/new-date-filtering": false,
"stats/new-date-filtering": true,
"stats/paid-wpcom-v2": true,
"stepper-woocommerce-poc": true,
"storage-addon": true,
Expand Down
2 changes: 1 addition & 1 deletion config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"ssr/sample-log-cache-misses": true,
"stats/empty-module-traffic": true,
"stats/empty-module-v2": true,
"stats/new-date-filtering": false,
"stats/new-date-filtering": true,
"stats/paid-wpcom-v2": true,
"stepper-woocommerce-poc": true,
"storage-addon": true,
Expand Down
2 changes: 1 addition & 1 deletion config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"ssr/prefetch-timebox": true,
"stats/empty-module-traffic": true,
"stats/empty-module-v2": true,
"stats/new-date-filtering": false,
"stats/new-date-filtering": true,
"stats/paid-wpcom-v2": true,
"stats/paid-wpcom-v3": true,
"stepper-woocommerce-poc": true,
Expand Down
2 changes: 1 addition & 1 deletion config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"ssr/prefetch-timebox": true,
"stats/empty-module-traffic": true,
"stats/empty-module-v2": true,
"stats/new-date-filtering": false,
"stats/new-date-filtering": true,
"stepper-woocommerce-poc": true,
"storage-addon": true,
"themes/premium": true,
Expand Down
2 changes: 1 addition & 1 deletion config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"ssr/prefetch-timebox": true,
"stats/empty-module-traffic": true,
"stats/empty-module-v2": true,
"stats/new-date-filtering": false,
"stats/new-date-filtering": true,
"stats/paid-wpcom-v2": true,
"stats/paid-wpcom-v3": true,
"stepper-woocommerce-poc": true,
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/specs/stats/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ describe( DataHelper.createSuiteTitle( 'Stats' ), function () {
await statsPage.clickTab( 'Traffic' );
} );

it( 'View 30-day highlights', async function () {
await statsPage.selectHighlightPeriod( '30-day' );
} );

it( 'Select "Months" stats period', async function () {
await statsPage.selectStatsPeriodFromDropdown( 'Months' );
} );
Expand Down
Loading