'use client'; /* NOTES: show loading when loading summary use with: - src/components/dashboard/overview/summary/ActiveUserCount/index.tsx */ import * as React from 'react'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import Divider from '@mui/material/Divider'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import type { Icon } from '@phosphor-icons/react/dist/lib/types'; import { TrendDown as TrendDownIcon } from '@phosphor-icons/react/dist/ssr/TrendDown'; import { TrendUp as TrendUpIcon } from '@phosphor-icons/react/dist/ssr/TrendUp'; import { useTranslation } from 'react-i18next'; export interface SummaryProps { amount: number; diff: number; icon: Icon; title: string; trend: 'up' | 'down'; } export function Summary({ amount, diff, icon: Icon, title, trend }: SummaryProps): React.JSX.Element { const { t } = useTranslation(); return (
{title} {new Intl.NumberFormat('en-US').format(amount)}
{trend === 'up' ? ( ) : ( )} {new Intl.NumberFormat('en-US', { style: 'percent', maximumFractionDigits: 2 }).format(diff / 100)} {' '} {trend === 'up' ? t('increase') : t('decrease')} {t('vs last month')}
); }