import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { Link } from "react-router"; import { Stat } from "~/application/dtos/stats/Stat"; import { StatChange } from "~/application/dtos/stats/StatChange"; import { Fragment } from "react"; import { TrendingUpIcon, TrendingDownIcon } from "~/components/ui/icons/vendor"; interface Props { items: Stat[]; } export function DashboardStats({ items }: Props) { return (
{items.map((item, idx) => ( {item.path ? ( {/* Subframe StatsCard layout: rounded-md, px-4 py-4, hover shadow */} ) : ( )} ))}
); } function DashboardStat({ item, loading = false, className }: { item: Stat; loading?: boolean; className?: string }) { const { t } = useTranslation(); return (
{/* Subframe StatsCard typo: body-default label, subtitle value, body-small comparison */}
{t(item.name)}
{item.hint &&
({t(item.hint)})
}
{loading ? "..." : item.stat}
{item.previousStat !== undefined && ( {!loading && {t("shared.statComparison", { 0: item.previousStat })}} )}
{item.changeType === StatChange.Increase ? (
{loading ? ( "..." ) : ( <>
{item.change}
)}
) : item.changeType === StatChange.Decrease ? (
{loading ? ( "..." ) : ( <>

{item.change}

)}
) : null}
); }