"use client"; import { useRouter } from "next/navigation"; import { WifiOff, ServerCrash, Wrench, AlertCircle, RefreshCw } from "lucide-react"; import { Button } from "@/components/ui"; import { describeError } from "@/lib/use-api"; import { ApiClientError } from "@/lib/api"; import { cn } from "@/lib/utils"; /** Polished error state for connection loss, server outage and maintenance. */ export function ApiErrorState({ error, retry, className, compact }: { error: unknown; retry?: () => void; className?: string; compact?: boolean }) { const d = describeError(error); const Icon = d.kind === "network" ? WifiOff : d.kind === "maintenance" ? Wrench : d.kind === "server" ? ServerCrash : AlertCircle; return (
{d.description}
{retry ? ( ) : null}