Open History to see the last commit
1import { memo } from "react";
2import { Alert, AlertAction, AlertDescription } from "../ui/alert";
3import { Button } from "../ui/button";
4import { CircleAlertIcon, XIcon } from "lucide-react";
5import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
6
7export const ThreadErrorBanner = memo(function ThreadErrorBanner({
8 error,
9 onDismiss,
10}: {
11 error: string | null;
12 onDismiss?: () => void;
13}) {
14 if (!error) return null;
15 return (
16 <div className="pt-3 mx-auto max-w-3xl">
17 <Alert variant="error">
18 <CircleAlertIcon />
19 <Tooltip>
20 <TooltipTrigger render={<AlertDescription className="line-clamp-3" />}>
21 {error}
22 </TooltipTrigger>
23 <TooltipPopup side="top" className="max-w-96 whitespace-pre-wrap">
24 {error}
25 </TooltipPopup>
26 </Tooltip>
27 {onDismiss && (
28 <AlertAction>
29 <Button variant="ghost" size="icon-xs" aria-label="Dismiss error" onClick={onDismiss}>
30 <XIcon className="text-destructive" />
31 </Button>
32 </AlertAction>
33 )}
34 </Alert>
35 </div>
36 );
37});