'use client'; import { useState } from 'react'; import { ShieldAlert } from 'lucide-react'; import { PageHeader } from '@/components/shared/page-header'; import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'; import { Skeleton } from '@/components/ui/skeleton'; import { AlertCard, AlertCardEmpty } from './alert-card'; import { useAlertCount, useAlertList, useAlertRealtime } from './use-alerts'; import type { AlertStatus } from './types'; export function AlertsPageShell() { const [tab, setTab] = useState('open'); const { data: count } = useAlertCount(); const { data, isLoading } = useAlertList(tab); useAlertRealtime(); const total = count?.total ?? 0; const alerts = data?.data ?? []; return (
{total} active } variant="gradient" /> setTab(v as AlertStatus)}> Active{total > 0 ? ` ยท ${total}` : ''} Dismissed Resolved {isLoading ? (
) : alerts.length === 0 ? ( ) : ( alerts.map((a) => ) )}
); }