"use client"; import { useEffect } from "react"; import { useShallow } from "zustand/react/shallow"; import { AlertTriangle, X } from "lucide-react"; import { useUpdateStore, selectBanner } from "@/stores/update-store"; import { cn } from "@/lib/utils"; // Single-line, low-key update notice. Lives next to the version badge on the // login screen — deliberately understated so it doesn't distract from the // auth flow. Red variants (security / deprecated) still use red text but // stay the same compact shape. export function UpdateNotice({ className }: { className?: string }) { const banner = useUpdateStore(useShallow(selectBanner)); const dismiss = useUpdateStore((s) => s.dismiss); const startPolling = useUpdateStore((s) => s.startPolling); useEffect(() => { startPolling(); }, [startPolling]); if (!banner) return null; const isRed = banner.variant === "red"; const text = banner.severity === "security" ? `Security update${banner.latest ? `: ${banner.latest}` : ""}` : banner.severity === "deprecated" ? "Version no longer supported" : `Update available: ${banner.latest ?? ""}`; return (
); }