"use client"; import { useEffect, useState } from "react"; import { ArrowUpCircle, X } from "lucide-react"; import Link from "next/link"; type VersionInfo = { current: string; latest: string | null; update_available: boolean; release_url?: string; }; export function UpdateBanner() { const [info, setInfo] = useState(null); const [dismissed, setDismissed] = useState(false); useEffect(() => { let cancelled = false; function load() { fetch("/api/update/check", { cache: "no-store" }) .then((r) => r.json()) .then((d) => { if (!cancelled) setInfo(d); }) .catch(() => {}); } load(); const id = setInterval(load, 60_000); return () => { cancelled = true; clearInterval(id); }; }, []); if (!info?.update_available || dismissed) return null; return (
Update {info.latest} verfügbar (aktuell {info.current}). {info.release_url && ( Release-Notes )}
Jetzt aktualisieren
); }