/** * Error state: warning icon, message, and optional Retry button. * Ported from webapp/js/ui.js showError and states.css .error. */ "use client"; import { useTranslation } from "@/i18n/use-translation"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { triggerHapticLight } from "@/lib/telegram-haptic"; export interface ErrorStateProps { /** Error message to display. If not provided, uses generic i18n message. */ message?: string | null; /** Optional retry callback; when provided, a Retry button is shown. */ onRetry?: (() => void) | null; /** Optional class for the container. */ className?: string; } /** Warning triangle icon 24×24 for error state. */ function ErrorIcon({ className }: { className?: string }) { return ( ); } /** * Displays an error message with optional Retry button. */ export function ErrorState({ message, onRetry, className }: ErrorStateProps) { const { t } = useTranslation(); const displayMessage = message && String(message).trim() ? message : t("error_generic"); return (

{displayMessage}

{typeof onRetry === "function" && ( )}
); }