|
1 | 1 | import { type ProviderInstanceId, type ServerProvider } from "@t3tools/contracts"; |
2 | 2 | import { memo } from "react"; |
3 | 3 | import { InfoIcon, XIcon } from "lucide-react"; |
4 | | -import { cn } from "~/lib/utils"; |
5 | | -import { Button } from "../ui/button"; |
| 4 | +import { Alert, AlertAction, AlertDescription, AlertTitle } from "../ui/alert"; |
| 5 | +import { Button, InlineButton } from "../ui/button"; |
6 | 6 | import { formatProviderDriverKindLabel } from "../../providerModels"; |
7 | 7 | import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; |
8 | 8 |
|
@@ -83,48 +83,37 @@ export const ProviderStatusBanner = memo(function ProviderStatusBanner({ |
83 | 83 |
|
84 | 84 | return ( |
85 | 85 | <div className="pointer-events-auto mx-auto w-fit max-w-[calc(100%-2rem)] pt-3"> |
86 | | - <div |
87 | | - className={cn( |
88 | | - "alert-glass relative inline-flex items-center gap-3 rounded-xl border py-3 ps-3.5 pe-10 text-card-foreground text-sm", |
89 | | - status.status === "warning" |
90 | | - ? "border-warning/32 [&_svg]:text-warning" |
91 | | - : "border-destructive/32 text-destructive-foreground [&_svg]:text-destructive", |
92 | | - )} |
93 | | - data-variant={status.status === "warning" ? "warning" : "error"} |
94 | | - role="alert" |
| 86 | + <Alert |
| 87 | + variant={status.status === "warning" ? "warning" : "error"} |
| 88 | + surface="glass" |
| 89 | + controlAlignment="first-line" |
95 | 90 | > |
96 | | - <InfoIcon className="size-4 shrink-0" aria-hidden /> |
97 | | - <div className="flex min-w-0 flex-col gap-1"> |
98 | | - <div className="font-medium">{title}</div> |
| 91 | + <InfoIcon /> |
| 92 | + <AlertTitle>{title}</AlertTitle> |
| 93 | + <AlertDescription> |
99 | 94 | <Tooltip> |
100 | | - <TooltipTrigger |
101 | | - render={<div className="line-clamp-3 text-muted-foreground">{message}</div>} |
102 | | - /> |
| 95 | + <TooltipTrigger render={<div className="line-clamp-3" />}>{message}</TooltipTrigger> |
103 | 96 | <TooltipPopup side="top" className="whitespace-pre-wrap"> |
104 | 97 | {message} |
105 | 98 | </TooltipPopup> |
106 | 99 | </Tooltip> |
107 | 100 | {onOpenProviderSetup && hasProviderSetup(status) ? ( |
108 | | - <Button |
109 | | - className="self-start px-0 text-foreground" |
110 | | - onClick={() => onOpenProviderSetup(status.instanceId)} |
111 | | - size="xs" |
112 | | - variant="link" |
113 | | - > |
| 101 | + <InlineButton onClick={() => onOpenProviderSetup(status.instanceId)}> |
114 | 102 | Open provider setup |
115 | | - </Button> |
| 103 | + </InlineButton> |
116 | 104 | ) : null} |
117 | | - </div> |
118 | | - <Button |
119 | | - aria-label={`Dismiss ${providerName} provider ${status.status}`} |
120 | | - className="absolute top-2 right-2 size-6" |
121 | | - onClick={onDismiss} |
122 | | - size="icon-xs" |
123 | | - variant="ghost-muted" |
124 | | - > |
125 | | - <XIcon aria-hidden className="size-3.5" /> |
126 | | - </Button> |
127 | | - </div> |
| 105 | + </AlertDescription> |
| 106 | + <AlertAction> |
| 107 | + <Button |
| 108 | + aria-label={`Dismiss ${providerName} provider ${status.status}`} |
| 109 | + onClick={onDismiss} |
| 110 | + size="icon-xs" |
| 111 | + variant="ghost-muted" |
| 112 | + > |
| 113 | + <XIcon /> |
| 114 | + </Button> |
| 115 | + </AlertAction> |
| 116 | + </Alert> |
128 | 117 | </div> |
129 | 118 | ); |
130 | 119 | }); |
0 commit comments