| 1 | "use client"; |
| 2 | |
| 3 | import { AlertCircle } from "lucide-react"; |
| 4 | |
| 5 | import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; |
| 6 | |
| 7 | interface ErrorDisplayProps { |
| 8 | error?: string; |
| 9 | localError?: string | null; |
| 10 | } |
| 11 | |
| 12 | export function ErrorDisplay({ error, localError }: ErrorDisplayProps) { |
| 13 | return ( |
| 14 | <> |
| 15 | {error && ( |
| 16 | <Alert variant="destructive"> |
| 17 | <AlertCircle className="size-4" /> |
| 18 | <AlertTitle>Error</AlertTitle> |
| 19 | <AlertDescription>{error}</AlertDescription> |
| 20 | </Alert> |
| 21 | )} |
| 22 | |
| 23 | {localError && ( |
| 24 | <Alert variant="destructive"> |
| 25 | <AlertCircle className="size-4" /> |
| 26 | <AlertDescription>{localError}</AlertDescription> |
| 27 | </Alert> |
| 28 | )} |
| 29 | </> |
| 30 | ); |
| 31 | } |
| 32 |