Skip to content

Commit

Permalink
Email stats: update icons (#97744)
Browse files Browse the repository at this point in the history
  • Loading branch information
simison authored Dec 23, 2024
1 parent a4ecff1 commit 9aafa2f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions client/my-sites/stats/stats-email-top-row/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Gridicon } from '@automattic/components';
import { eye } from '@automattic/components/src/icons';
import { Icon } from '@wordpress/icons';
import { useHasEnTranslation } from '@automattic/i18n-utils';
import { Icon, send, seen, link } from '@wordpress/icons';
import clsx from 'clsx';
import { useTranslate } from 'i18n-calypso';
import moment from 'moment';
Expand All @@ -16,6 +16,7 @@ import './style.scss';

export default function StatsEmailTopRow( { siteId, postId, statType, className, post } ) {
const translate = useTranslate();
const hasEnTranslation = useHasEnTranslation();

const counts = useSelector( ( state ) =>
getEmailStatsNormalizedData( state, siteId, postId, PERIOD_ALL_TIME, statType, '', 'rate' )
Expand All @@ -36,25 +37,29 @@ export default function StatsEmailTopRow( { siteId, postId, statType, className,
return (
<>
<TopCard
heading={ translate( 'Recipients' ) }
heading={
hasEnTranslation( 'Total emails sent' )
? translate( 'Total emails sent' )
: translate( 'Recipients' )
}
value={ counts?.total_sends ?? 0 }
isLoading={ isRequesting && ! counts?.hasOwnProperty( 'total_sends' ) }
icon={ <Gridicon icon="mail" /> }
icon={ <Icon icon={ send } /> }
emailIsSending={ emailIsSending }
/>
{ counts?.unique_opens ? (
<TopCard
heading={ translate( 'Unique opens' ) }
value={ counts.unique_opens }
isLoading={ isRequesting && ! counts?.hasOwnProperty( 'unique_opens' ) }
icon={ <Icon icon={ eye } /> }
icon={ <Icon icon={ seen } /> }
/>
) : null }
<TopCard
heading={ translate( 'Total opens' ) }
value={ counts?.total_opens ?? 0 }
isLoading={ isRequesting && ! counts?.hasOwnProperty( 'total_opens' ) }
icon={ <Icon icon={ eye } /> }
icon={ <Icon icon={ seen } /> }
/>
<TopCard
heading={ translate( 'Open rate' ) }
Expand All @@ -72,19 +77,19 @@ export default function StatsEmailTopRow( { siteId, postId, statType, className,
heading={ translate( 'Total opens' ) }
value={ counts?.total_opens ?? 0 }
isLoading={ isRequesting && ! counts?.hasOwnProperty( 'total_opens' ) }
icon={ <Gridicon icon="mail" /> }
icon={ <Icon icon={ seen } /> }
/>
<TopCard
heading={ translate( 'Total clicks' ) }
value={ counts?.total_clicks ?? 0 }
isLoading={ isRequesting && ! counts?.hasOwnProperty( 'total_clicks' ) }
icon={ <Icon icon={ eye } /> }
icon={ <Icon icon={ link } /> }
/>
<TopCard
heading={ translate( 'Click rate' ) }
value={ counts?.clicks_rate ? `${ Math.round( counts?.clicks_rate * 100 ) }%` : null }
isLoading={ isRequesting && ! counts?.hasOwnProperty( 'clicks_rate' ) }
icon={ <Gridicon icon="trending" /> }
icon={ <Icon icon={ link } /> }
/>
</>
);
Expand Down

0 comments on commit 9aafa2f

Please sign in to comment.