import { useQuery } from "@tanstack/react-query" import { CircleCheck, CircleX, Loader2 } from "lucide-react" import { getServerUrl } from "@/lib/server-url" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" async function checkHealth(serverUrl: string): Promise { const res = await fetch(`${serverUrl}/health`) if (!res.ok) throw new Error(`HTTP ${res.status}`) const data = (await res.json()) as { status: string } if (data.status !== "ok") throw new Error("Unexpected response") return true } export function GeneralSettingsPanel() { const serverUrl = getServerUrl() const { isLoading, isError, error } = useQuery({ queryKey: ["health", serverUrl], queryFn: () => checkHealth(serverUrl), }) const status = isLoading ? "checking" : isError ? "error" : "ok" const errorMsg = error instanceof Error ? error.message : null return (

General

Backend server information.

Server Connected backend instance.
URL {serverUrl}
Status {status === "checking" && ( Checking… )} {status === "ok" && ( Connected )} {status === "error" && ( {errorMsg ?? "Unreachable"} )}
) }