"use client"; import { useState } from "react"; import { AlertTriangle, Loader2, RefreshCw } from "lucide-react"; import { useTranslation } from "react-i18next"; import { useSettings } from "./SettingsContext"; // Surface the result of the initial /api/v1/settings + /api/v1/system/status // load so Docker / first-run users know *why* the page is empty when the // backend is unreachable, instead of seeing a blank screen with the failure // only in the dev console. export function SettingsLoadStatusBanner() { const { t } = useTranslation(); const { settingsLoading, settingsError, reloadSettings } = useSettings(); const [retrying, setRetrying] = useState(false); if (settingsLoading) { return (
{t("Loading settings...")}
); } if (!settingsError) return null; const handleRetry = async () => { setRetrying(true); try { await reloadSettings(); } finally { setRetrying(false); } }; return (
{t("Could not load settings from the backend.")}
{settingsError}
{t( "Verify the backend is running and NEXT_PUBLIC_API_BASE points to a reachable host. For Docker, see data/user/settings/system.json.", )}
); }