import { Link } from 'react-router';
import { Bell } from 'lucide-react';
import { useUnreadCount } from '../api/queries/alerts';
import { useSelectedEnv } from '../api/queries/alertMeta';
import css from './NotificationBell.module.css';
/**
* Global notification bell shown in the layout header. Links to the alerts
* inbox and renders a badge coloured by the highest unread severity
* (CRITICAL > WARNING > INFO) — matches the sidebar SeverityBadge palette.
*/
export function NotificationBell() {
const env = useSelectedEnv();
const { data } = useUnreadCount();
if (!env) return null;
const total = data?.total ?? 0;
const bySeverity = data?.bySeverity ?? {};
const severityClass =
(bySeverity.CRITICAL ?? 0) > 0 ? css.badgeCritical
: (bySeverity.WARNING ?? 0) > 0 ? css.badgeWarning
: css.badgeInfo;
return (
{total > 0 && (
{total > 99 ? '99+' : total}
)}
);
}