'use client';
import { useParams, useRouter } from 'next/navigation';
import { cn } from '@/lib/utils';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import type { QueueStatus } from '@/lib/services/system-monitoring.service';
interface QueueOverviewProps {
queues: QueueStatus[];
}
interface StatPillProps {
label: string;
value: number;
highlight?: boolean;
}
function StatPill({ label, value, highlight }: StatPillProps) {
return (
0 ? 'text-destructive' : 'text-foreground',
)}
>
{value}
{label}
);
}
export function QueueOverview({ queues }: QueueOverviewProps) {
const router = useRouter();
const params = useParams<{ portSlug: string }>();
function handleQueueClick(queueName: string) {
router.push(`/${params.portSlug}/admin/monitoring/${queueName}`);
}
return (
{queues.map((queue) => (
handleQueueClick(queue.name)}
role="button"
tabIndex={0}
onKeyDown={(e) => e.key === 'Enter' && handleQueueClick(queue.name)}
>
{queue.name}
{queue.delayed > 0 && (
{queue.delayed} delayed
)}
))}
);
}