/** * SchemaErrorFallback.jsx * ======================= * Error UI shown when the JSON Schema fails to load for a disease. * * Features: * - Clear error message explaining what went wrong * - Retry button * - Suggestion to switch disease * - Clean, non-alarming design */ import { AlertCircle, RefreshCw, Activity } from 'lucide-react'; /** * @param {{ * error: Error | null, * onRetry: () => void, * disease?: string, * }} props */ export default function SchemaErrorFallback({ error, onRetry, disease }) { const isConnectionError = error?.message?.toLowerCase().includes('network') || error?.message?.toLowerCase().includes('fetch') || error?.message?.toLowerCase().includes('abort') || !error; return (
{isConnectionError ? `The diagnostic engine could not be reached. This is normal during cold starts (first scan of the day).` : `Failed to load the form configuration for "${disease || 'this disease'}".`}
{/* Error detail (if available) */} {error?.message && !isConnectionError && ({error.message}
)} {isConnectionError && (The backend may be waking up — this can take 30-60 seconds on the first request.
)} {/* Actions */}