'use client'; import { useLocale, useTranslations } from 'next-intl'; import { Box, Paper, Typography } from '@mui/material'; import { AppIcon, AppLink } from '@/components'; import { AdminPageHeader } from '@/components/admin'; import { useAdminCapabilities } from '@/hooks'; import { ROUTES } from '@/constants'; /** * Admin overview landing (f15) — the backoffice home. Renders one **console card** per worklist the current * principal may act on, derived from `useAdminCapabilities()` (a UI hint; the server still enforces every * command's role scope). A `support` admin sees verification/tickets/alerts; a `finance` admin sees * payouts/config; only a `super_admin` sees roles. Each card deep-links into its console. */ export default function AdminOverviewPage() { const t = useTranslations('admin'); const tNav = useTranslations('nav'); const locale = useLocale(); const caps = useAdminCapabilities(); // `key` doubles as the `nav` i18n key for the card label. const consoles: { key: string; route: string; icon: string; enabled: boolean }[] = [ { key: 'verification', route: ROUTES.ADMIN_VERIFICATION, icon: 'verification', enabled: caps.canVerify }, { key: 'tickets', route: ROUTES.ADMIN_TICKETS, icon: 'support', enabled: caps.canManageTickets }, { key: 'payouts', route: ROUTES.ADMIN_PAYOUTS, icon: 'earnings', enabled: caps.canPayout }, { key: 'reviews', route: ROUTES.ADMIN_REVIEWS, icon: 'moderation', enabled: caps.canModerate }, { key: 'config', route: ROUTES.ADMIN_CONFIG, icon: 'config', enabled: caps.canConfig }, { key: 'holidays', route: ROUTES.ADMIN_HOLIDAYS, icon: 'calendar', enabled: caps.canConfig }, { key: 'alerts', route: ROUTES.ADMIN_ALERTS, icon: 'alerts', enabled: caps.canManageAlerts }, { key: 'audit', route: ROUTES.ADMIN_AUDIT, icon: 'audit', enabled: caps.canViewAudit }, { key: 'partners', route: ROUTES.ADMIN_PARTNERS, icon: 'partners', enabled: caps.canManagePartners }, { key: 'roles', route: ROUTES.ADMIN_ROLES, icon: 'roles', enabled: caps.canManageRoles }, ].filter((c) => c.enabled); return ( {consoles.map((c) => ( {tNav(c.key)} ))} ); }