diff --git a/src/Campaigns/resources/admin/components/CampaignDetailsPage/Components/CampaignStats/index.tsx b/src/Campaigns/resources/admin/components/CampaignDetailsPage/Components/CampaignStats/index.tsx index 1de9b3d5b8..d18e52888a 100644 --- a/src/Campaigns/resources/admin/components/CampaignDetailsPage/Components/CampaignStats/index.tsx +++ b/src/Campaigns/resources/admin/components/CampaignDetailsPage/Components/CampaignStats/index.tsx @@ -3,7 +3,7 @@ import {useEffect, useState} from "react"; import RevenueChart from "../RevenueChart"; import GoalProgressChart from "../GoalProgressChart"; import apiFetch from '@wordpress/api-fetch'; -import { addQueryArgs } from '@wordpress/url'; +import {addQueryArgs} from '@wordpress/url'; import HeaderText from '../HeaderText'; import HeaderSubText from '../HeaderSubText'; import DefaultFormWidget from "../DefaultForm"; @@ -21,11 +21,11 @@ declare const window: { const pluck = (array: any[], property: string) => array.map(element => element[property]) const filterOptions = [ - { label: __('Today', 'give'), value: 1, description: __('from today', 'give') }, - { label: __('Last 7 days', 'give'), value: 7, description: __('from the last 7 days', 'give') }, - { label: __('Last 30 days', 'give'), value: 30, description: __('from the last 30 days', 'give') }, - { label: __('Last 90 days', 'give'), value: 90, description: __('from the last 90 days', 'give') }, - { label: __('All-time', 'give'), value: 0, description: __('total for all-time', 'give') }, + {label: __('Today', 'give'), value: 1, description: __('from today', 'give')}, + {label: __('Last 7 days', 'give'), value: 7, description: __('from the last 7 days', 'give')}, + {label: __('Last 30 days', 'give'), value: 30, description: __('from the last 30 days', 'give')}, + {label: __('Last 90 days', 'give'), value: 90, description: __('from the last 90 days', 'give')}, + {label: __('All-time', 'give'), value: 0, description: __('total for all-time', 'give')}, ] const currency = new Intl.NumberFormat('en-US', { @@ -46,7 +46,7 @@ const CampaignStats = () => { const onDayRangeChange = async (days: number) => { setDayRange(days) - apiFetch({path: addQueryArgs( '/give-api/v2/campaigns/' + campaignId +'/statistics', {rangeInDays: days} ) } ) + apiFetch({path: addQueryArgs('/give-api/v2/campaigns/' + campaignId + '/statistics', {rangeInDays: days})}) .then(setStats); } @@ -56,10 +56,13 @@ const CampaignStats = () => { <>
- - - - + + + +
@@ -93,9 +96,12 @@ const StatWidget = ({label, values, description, formatter = null}) => {
- {formatter?.format(values[0]) ?? values[0]} + {'undefined' !== typeof values[0] + ? formatter?.format(values[0]) ?? values[0] + :   + } - {!! values[1] && ( + {!!values[1] && ( )}