handle errors better in the ui with an alert component

This commit is contained in:
Viktor Barzin 2025-06-21 17:26:45 +00:00
parent 5bd4562205
commit b1cbe8505a
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
8 changed files with 351 additions and 51 deletions

View file

@ -0,0 +1,26 @@
import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "./ui/alert-dialog";
export default function AlertError(
props: {
message: string | null;
open: boolean;
setIsOpen: (isOpen: boolean) => void;
}
) {
return (
<AlertDialog open={props.open} onOpenChange={props.setIsOpen}>
{/* <AlertDialogTrigger>Open</AlertDialogTrigger> */}
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Error</AlertDialogTitle>
<AlertDialogDescription>
{props.message}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogAction onClick={() => props.setIsOpen(false)}>Close</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}