import { useTranslation } from 'react-i18next'; import { AlertTriangle, Megaphone } from 'lucide-react'; import type { Announcement } from '../api/client'; import { announcementText } from '../hooks/useAnnouncements'; interface AnnouncementBannerProps { // Unread important/critical announcements, most severe first. items: Announcement[]; // Opens the panel with this message expanded. onOpen: (id: string) => void; markRead: (id: string) => void; } /** * The strip above the page for an unread important or critical announcement. * * One at a time, the most severe; "+N more" opens the panel. "Got it" marks it * read on the server, so it stays gone on every browser this user signs in on. * Info-level messages never get a banner -- only the sidebar dot. */ export function AnnouncementBanner({ items, onOpen, markRead }: AnnouncementBannerProps) { const { t, i18n } = useTranslation(); const first = items[0]; if (!first) return null; const text = announcementText(first, i18n.language); const critical = first.level === 'critical'; const Icon = critical ? AlertTriangle : Megaphone; return (