mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
Bring every stat strip across the admin panel and user cabinet onto the canonical StatCard (icon chip + label-on-top + tone-coloured value), matching the sales/Remnawave style the rest of the app already used. - Convert ~20 hand-rolled stat strips across 21 pages/components - Remove 4 divergent local StatCard components (Dashboard, Users, BanSystem, Payments) and migrate Remnawave's local StatCard (33 cards) - Extend StatCard with optional subValue, loading skeleton, trailing slot, and icon-size normalisation (all backward-compatible) - StatsGrid nav tiles now use StatCard while keeping link/chevron/loading - Preserve all data, i18n keys, conditionals and interactive filters; fix the dead 'info' colour by mapping it to accent
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { useTranslation } from 'react-i18next';
|
|
import { Link } from 'react-router';
|
|
import { useCurrency } from '../../hooks/useCurrency';
|
|
import { StatCard } from '@/components/stats';
|
|
import { CardIcon, ChevronRightIcon, UsersIcon } from '@/components/icons';
|
|
|
|
interface StatsGridProps {
|
|
balanceRubles: number;
|
|
referralCount: number;
|
|
earningsRubles: number;
|
|
refLoading: boolean;
|
|
}
|
|
|
|
export default function StatsGrid({
|
|
balanceRubles,
|
|
referralCount,
|
|
earningsRubles,
|
|
refLoading,
|
|
}: StatsGridProps) {
|
|
const { t } = useTranslation();
|
|
const { formatAmount, currencySymbol } = useCurrency();
|
|
|
|
const chevron = <ChevronRightIcon className="h-4 w-4 shrink-0 text-dark-500" />;
|
|
|
|
return (
|
|
<div className="grid grid-cols-2 gap-2.5">
|
|
<Link to="/balance" className="block" data-onboarding="balance">
|
|
<StatCard
|
|
label={t('dashboard.stats.balance')}
|
|
value={`${formatAmount(balanceRubles)} ${currencySymbol}`}
|
|
icon={<CardIcon className="h-5 w-5" />}
|
|
tone="accent"
|
|
trailing={chevron}
|
|
/>
|
|
</Link>
|
|
<Link to="/referral" className="block">
|
|
<StatCard
|
|
label={t('dashboard.stats.referrals')}
|
|
value={`${referralCount}`}
|
|
subValue={`+${formatAmount(earningsRubles)} ${currencySymbol}`}
|
|
icon={<UsersIcon className="h-5 w-5" />}
|
|
tone="neutral"
|
|
loading={refLoading}
|
|
trailing={chevron}
|
|
/>
|
|
</Link>
|
|
</div>
|
|
);
|
|
}
|