import React from 'react'; import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { AlertTriangle, RefreshCw, XCircle, AlertCircle } from 'lucide-react'; interface ErrorDisplayProps { error: Error | string | null; title?: string; onRetry?: () => void; variant?: 'alert' | 'card' | 'inline'; className?: string; } /** * Reusable error display component with retry action */ export const ErrorDisplay: React.FC = ({ error, title = 'Error', onRetry, variant = 'alert', className = '', }) => { if (!error) return null; const errorMessage = typeof error === 'string' ? error : error.message; const ErrorContent = () => ( <>
{title}

{errorMessage}

{onRetry && ( )}
); if (variant === 'card') { return ( ); } if (variant === 'inline') { return (

{title}

{errorMessage}

{onRetry && ( )}
); } return ( ); }; interface FormErrorDisplayProps { errors: Record; className?: string; } /** * Display form validation errors */ export const FormErrorDisplay: React.FC = ({ errors, className = '', }) => { const errorEntries = Object.entries(errors); if (errorEntries.length === 0) return null; return (

Please fix the following errors:

    {errorEntries.map(([field, message]) => (
  • {message}
  • ))}
); }; interface EmptyStateProps { icon?: React.ReactNode; title: string; description?: string; action?: { label: string; onClick: () => void; }; className?: string; } /** * Empty state display component */ export const EmptyState: React.FC = ({ icon, title, description, action, className = '', }) => { return (
{icon &&
{icon}
}

{title}

{description &&

{description}

} {action && ( )}
); }; export default ErrorDisplay;