'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'; /** * `embedded` mode drops the PageHeader and outer spacing so the shell * can render as a section inside the merged Inbox page without * duplicating chrome. Standalone /alerts route still uses the default * (non-embedded) mode via the redirect — actually, /alerts now redirects * to /inbox#alerts, so non-embedded mode is currently unused but kept * for flexibility. */ interface AlertsPageShellProps { embedded?: boolean; } export function AlertsPageShell({ embedded = false }: AlertsPageShellProps = {}) { 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 (
{!embedded ? ( {total} active } variant="gradient" /> ) : null} setTab(v as AlertStatus)}> Active{total > 0 ? ` · ${total}` : ''} Dismissed Resolved {isLoading ? (
) : alerts.length === 0 ? ( ) : ( alerts.map((a) => ) )}
); }