/* * SPDX-FileCopyrightText: 2026 Coffey Labs * * SPDX-License-Identifier: AGPL-3.0-only */ import { Link } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { ArrowUpRight, PartyPopper } from 'lucide-react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import type { WaitingDomain } from '../serverFacts'; const MAX_ROWS = 8; /** * Where outgoing mail is waiting, by the domain it's going to: a bar per * destination, split into waiting its turn, retrying after a refusal, and * given up on. A stuck provider stands out at a glance. A click opens the * queue filtered to that destination. */ export function QueueWaiting({ waiting }: { waiting: WaitingDomain[] }) { const { t } = useTranslation(); const rows = waiting.slice(0, MAX_ROWS); const max = Math.max(1, ...rows.map((r) => r.scheduled + r.retrying + r.failed)); const legend = [ { cls: 'bg-[var(--chart-1)]', label: t('queue.scheduled', 'Waiting its turn') }, { cls: 'bg-amber-500', label: t('queue.retrying', 'Retrying') }, { cls: 'bg-rose-500', label: t('queue.failed', 'Gave up') }, ]; return (
{t('queue.title', 'Where mail is waiting')}

{t('queue.subtitle', 'Outgoing recipients still in the queue, by destination')}

{t('queue.open', 'Open the queue')}
{rows.length === 0 ? (
{t('queue.empty', 'Nothing waiting. Everything has gone out.')}
) : (
{rows.map((r) => { const total = r.scheduled + r.retrying + r.failed; const seg = (n: number) => `${(n / max) * 100}%`; return ( {r.domain} {total} ); })}
{legend.map((l) => ( {l.label} ))} {waiting.length > MAX_ROWS && t('queue.more', '+{{count}} more destinations', { count: waiting.length - MAX_ROWS })}
)}
); }