"use client"; import { useEffect, useState } from "react"; type ServerStatus = "checking" | "online" | "offline"; export default function Header() { const [status, setStatus] = useState("checking"); useEffect(() => { const checkHealth = async () => { try { const res = await fetch("/api/health"); const data = await res.json(); setStatus(data.status === "online" ? "online" : "offline"); } catch { setStatus("offline"); } }; checkHealth(); const interval = setInterval(checkHealth, 30000); return () => clearInterval(interval); }, []); const statusConfig = { checking: { color: "bg-yellow-500", label: "Checking...", textColor: "text-yellow-400", pulse: true, }, online: { color: "bg-green-500", label: "Server Online", textColor: "text-green-400", pulse: false, }, offline: { color: "bg-red-500", label: "Server Offline", textColor: "text-red-400", pulse: false, }, }; const cfg = statusConfig[status]; return (
🎙

VibePod

Powered by VibeVoice 0.5B

{cfg.label}
); }