Reports: Update summary number label based on selected compare interval (https://github.com/woocommerce/woocommerce-admin/pull/506)
This commit is contained in:
parent
f8468ddcf4
commit
3d297a8f5c
|
@ -30,11 +30,12 @@ import { formatCurrency, getCurrencyFormatDecimal } from 'lib/currency';
|
||||||
import { getAdminLink, getNewPath, onQueryChange } from 'lib/nav-utils';
|
import { getAdminLink, getNewPath, onQueryChange } from 'lib/nav-utils';
|
||||||
import { getReportChartData } from 'store/reports/utils';
|
import { getReportChartData } from 'store/reports/utils';
|
||||||
import {
|
import {
|
||||||
getCurrentDates,
|
|
||||||
getPreviousDate,
|
|
||||||
getIntervalForQuery,
|
|
||||||
getAllowedIntervalsForQuery,
|
getAllowedIntervalsForQuery,
|
||||||
|
getCurrentDates,
|
||||||
getDateFormatsForInterval,
|
getDateFormatsForInterval,
|
||||||
|
getDateParamsFromQuery,
|
||||||
|
getIntervalForQuery,
|
||||||
|
getPreviousDate,
|
||||||
} from 'lib/date';
|
} from 'lib/date';
|
||||||
import { MAX_PER_PAGE } from 'store/constants';
|
import { MAX_PER_PAGE } from 'store/constants';
|
||||||
|
|
||||||
|
@ -269,6 +270,7 @@ export class RevenueReport extends Component {
|
||||||
|
|
||||||
const totals = this.state.primaryTotals || {};
|
const totals = this.state.primaryTotals || {};
|
||||||
const secondaryTotals = this.state.secondaryTotals || {};
|
const secondaryTotals = this.state.secondaryTotals || {};
|
||||||
|
const { compare } = getDateParamsFromQuery( this.props.query );
|
||||||
|
|
||||||
const summaryNumbers = map( this.getCharts(), chart => {
|
const summaryNumbers = map( this.getCharts(), chart => {
|
||||||
const { key, label, type } = chart;
|
const { key, label, type } = chart;
|
||||||
|
@ -300,6 +302,11 @@ export class RevenueReport extends Component {
|
||||||
label={ label }
|
label={ label }
|
||||||
selected={ isSelected }
|
selected={ isSelected }
|
||||||
prevValue={ secondaryValue }
|
prevValue={ secondaryValue }
|
||||||
|
prevLabel={
|
||||||
|
'previous_period' === compare
|
||||||
|
? __( 'Previous Period:', 'wc-admin' )
|
||||||
|
: __( 'Previous Year:', 'wc-admin' )
|
||||||
|
}
|
||||||
delta={ delta }
|
delta={ delta }
|
||||||
href={ href }
|
href={ href }
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue