ErrorDialog.tsx (1306B)
1 import { 2 AlertDialog, 3 AlertDialogContent, 4 AlertDialogDescription, 5 AlertDialogFooter, 6 AlertDialogHeader, 7 AlertDialogTitle, 8 } from "@/components/ui/AlertDialog"; 9 import { Button } from "@/components/ui/Button"; 10 import Link from "next/link"; 11 12 export function ErrorDialog({ error, setError, children }: { error: string | null, setError: (error: string | null) => void, children?: React.ReactNode }) { 13 return ( 14 <AlertDialog open={error != null} onOpenChange={(open) => { if (!open) setError(null) }}> 15 <AlertDialogContent> 16 <AlertDialogHeader> 17 <AlertDialogTitle><div className="text-red-700">Error</div></AlertDialogTitle> 18 <AlertDialogDescription> 19 <div className="text-left"> 20 {error} 21 </div> 22 <div className="text-black/40 text-xs text-left mt-4 mb-6"> 23 You can contact support by sending an email to <Link href="mailto:support@damus.io" className="text-damuspink-600 underline">support@damus.io</Link> 24 </div> 25 {children} 26 </AlertDialogDescription> 27 </AlertDialogHeader> 28 <AlertDialogFooter> 29 <Button variant="default" onClick={() => setError(null)}>OK</Button> 30 </AlertDialogFooter> 31 </AlertDialogContent> 32 </AlertDialog> 33 ); 34 }