'use client'; import Link from 'next/link'; import { ArrowRight } from 'lucide-react'; import { useUIStore } from '@/stores/ui-store'; import { Skeleton } from '@/components/ui/skeleton'; import { AlertCard, AlertCardEmpty } from './alert-card'; import { useAlertList, useAlertRealtime } from './use-alerts'; export function AlertRail() { const portSlug = useUIStore((s) => s.currentPortSlug); const { data, isLoading } = useAlertList('open'); useAlertRealtime(); const alerts = data?.data ?? []; // Show first 5 in the rail; surplus pushes user to the full /alerts page. const visible = alerts.slice(0, 5); const overflow = Math.max(alerts.length - visible.length, 0); return (

Alerts

View all
{isLoading ? (
) : visible.length === 0 ? ( ) : (
{visible.map((a) => ( ))} {overflow > 0 ? ( +{overflow} more — view all ) : null}
)}
); }