mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 18:27:25 +03:00
27 lines
944 B
TypeScript
27 lines
944 B
TypeScript
|
import type { FC } from 'react';
|
||
|
import { prettify } from '../../utils/helpers/numbers';
|
||
|
import type { PartialVisitsSummary } from '../../visits/reducers/visitsOverview';
|
||
|
import type { HighlightCardProps } from './HighlightCard';
|
||
|
import { HighlightCard } from './HighlightCard';
|
||
|
|
||
|
type VisitsHighlightCardProps = Omit<HighlightCardProps, 'tooltip'> & {
|
||
|
loading: boolean;
|
||
|
excludeBots: boolean;
|
||
|
visitsSummary: PartialVisitsSummary;
|
||
|
};
|
||
|
|
||
|
export const VisitsHighlightCard: FC<VisitsHighlightCardProps> = ({ loading, excludeBots, visitsSummary, ...rest }) => (
|
||
|
<HighlightCard
|
||
|
tooltip={
|
||
|
visitsSummary.bots !== undefined
|
||
|
? <>{excludeBots ? 'Plus' : 'Including'} <b>{prettify(visitsSummary.bots)}</b> potential bot visits</>
|
||
|
: undefined
|
||
|
}
|
||
|
{...rest}
|
||
|
>
|
||
|
{loading ? 'Loading...' : prettify(
|
||
|
excludeBots && visitsSummary.nonBots ? visitsSummary.nonBots : visitsSummary.total,
|
||
|
)}
|
||
|
</HighlightCard>
|
||
|
);
|