mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
refactor(cabinet): unify all statistics onto the shared StatCard
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
This commit is contained in:
@@ -9,7 +9,17 @@ import { adminApi, AdminTicket, AdminTicketDetail } from '../api/admin';
|
||||
import { ticketsApi } from '../api/tickets';
|
||||
import { copyToClipboard as copyText } from '../utils/clipboard';
|
||||
import { usePlatform } from '../platform/hooks/usePlatform';
|
||||
import { BackIcon, SettingsIcon, TicketIcon, XIcon } from '@/components/icons';
|
||||
import {
|
||||
BackIcon,
|
||||
CheckCircleIcon,
|
||||
ClockIcon,
|
||||
InboxIcon,
|
||||
SettingsIcon,
|
||||
TicketIcon,
|
||||
XCircleIcon,
|
||||
XIcon,
|
||||
} from '@/components/icons';
|
||||
import { StatCard } from '@/components/stats';
|
||||
|
||||
interface MediaAttachment {
|
||||
id: string;
|
||||
@@ -278,25 +288,37 @@ export default function AdminTickets() {
|
||||
{/* Stats */}
|
||||
{stats && (
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-5">
|
||||
<div className="card text-center">
|
||||
<div className="stat-value">{stats.total}</div>
|
||||
<div className="stat-label">{t('admin.tickets.total')}</div>
|
||||
</div>
|
||||
<div className="card text-center">
|
||||
<div className="stat-value text-accent-400">{stats.open}</div>
|
||||
<div className="stat-label">{t('admin.tickets.statusOpen')}</div>
|
||||
</div>
|
||||
<div className="card text-center">
|
||||
<div className="stat-value text-warning-400">{stats.pending}</div>
|
||||
<div className="stat-label">{t('admin.tickets.statusPending')}</div>
|
||||
</div>
|
||||
<div className="card text-center">
|
||||
<div className="stat-value text-success-400">{stats.answered}</div>
|
||||
<div className="stat-label">{t('admin.tickets.statusAnswered')}</div>
|
||||
</div>
|
||||
<div className="card col-span-2 text-center sm:col-span-1">
|
||||
<div className="stat-value text-dark-400">{stats.closed}</div>
|
||||
<div className="stat-label">{t('admin.tickets.statusClosed')}</div>
|
||||
<StatCard
|
||||
label={t('admin.tickets.total')}
|
||||
value={stats.total}
|
||||
icon={<TicketIcon className="h-5 w-5" />}
|
||||
tone="neutral"
|
||||
/>
|
||||
<StatCard
|
||||
label={t('admin.tickets.statusOpen')}
|
||||
value={stats.open}
|
||||
icon={<InboxIcon className="h-5 w-5" />}
|
||||
tone="accent"
|
||||
/>
|
||||
<StatCard
|
||||
label={t('admin.tickets.statusPending')}
|
||||
value={stats.pending}
|
||||
icon={<ClockIcon className="h-5 w-5" />}
|
||||
tone="warning"
|
||||
/>
|
||||
<StatCard
|
||||
label={t('admin.tickets.statusAnswered')}
|
||||
value={stats.answered}
|
||||
icon={<CheckCircleIcon className="h-5 w-5" />}
|
||||
tone="success"
|
||||
/>
|
||||
<div className="col-span-2 sm:col-span-1">
|
||||
<StatCard
|
||||
label={t('admin.tickets.statusClosed')}
|
||||
value={stats.closed}
|
||||
icon={<XCircleIcon className="h-5 w-5" />}
|
||||
tone="neutral"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user