Skip to content

Commit fc913e8

Browse files
juliusmarmingecodex
andcommitted
Merge origin/main into ui/chat-markdown
Resolve the provider status banner conflict by retaining the latest banner design and accessible tooltip behavior. Co-authored-by: codex <[email protected]>
2 parents f478159 + 238715f commit fc913e8

19 files changed

Lines changed: 182 additions & 87 deletions

‎apps/web/index.html‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
background: #ffffff;
4949
color: #262626;
5050
font-family:
51+
"DM Sans Variable",
5152
"DM Sans",
5253
-apple-system,
5354
BlinkMacSystemFont,
@@ -83,12 +84,6 @@
8384
object-fit: contain;
8485
}
8586
</style>
86-
<link rel="preconnect" href="https://fonts.googleapis.com" />
87-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
88-
<link
89-
href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..800;1,9..40,300..800&display=swap"
90-
rel="stylesheet"
91-
/>
9287
<title>T3 Code (Alpha)</title>
9388
</head>
9489
<body>

‎apps/web/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"@dnd-kit/sortable": "^10.0.0",
2222
"@dnd-kit/utilities": "^3.2.2",
2323
"@effect/atom-react": "catalog:",
24+
"@fontsource-variable/dm-sans": "^5.2.8",
25+
"@fontsource/jetbrains-mono": "^5.2.8",
2426
"@formkit/auto-animate": "^0.9.0",
2527
"@legendapp/list": "3.0.0-beta.44",
2628
"@lexical/react": "^0.41.0",

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,11 @@ export default function ChatView(props: ChatViewProps) {
18431843
// `codex_personal`) surfaces its own status/message in the banner rather
18441844
// than the default Codex's. Falls back to first-match-by-kind when no
18451845
// saved instance id is available or the instance no longer exists.
1846+
const selectedProviderInstanceId =
1847+
providerStatuses.find((status) => status.instanceId === selectedProviderByThreadId)
1848+
?.instanceId ?? null;
18461849
const activeProviderInstanceId =
1850+
selectedProviderInstanceId ??
18471851
activeThread?.session?.providerInstanceId ??
18481852
activeThread?.modelSelection.instanceId ??
18491853
activeProject?.defaultModelSelection?.instanceId ??

‎apps/web/src/components/ThreadTerminalDrawer.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ export function TerminalViewport({
329329
lineHeight: 1.2,
330330
fontSize: 12,
331331
scrollback: 5_000,
332-
fontFamily: '"SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace',
332+
fontFamily:
333+
'"SF Mono", "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace',
333334
theme: terminalThemeFromApp(mount),
334335
});
335336
terminal.loadAddon(fitAddon);
Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type ServerProvider } from "@t3tools/contracts";
22
import { memo } from "react";
3-
import { Alert, AlertDescription, AlertTitle } from "../ui/alert";
4-
import { CircleAlertIcon } from "lucide-react";
3+
import { InfoIcon } from "lucide-react";
4+
import { cn } from "~/lib/utils";
55
import { formatProviderDriverKindLabel } from "../../providerModels";
66
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
77

@@ -14,27 +14,42 @@ export const ProviderStatusBanner = memo(function ProviderStatusBanner({
1414
return null;
1515
}
1616

17-
const providerLabel = status.displayName?.trim() || formatProviderDriverKindLabel(status.driver);
18-
const defaultMessage =
19-
status.status === "error"
20-
? `${providerLabel} provider is unavailable.`
21-
: `${providerLabel} provider has limited availability.`;
22-
const title = `${providerLabel} provider status`;
17+
const providerName = status.displayName?.trim() || formatProviderDriverKindLabel(status.driver);
18+
const isUnauthenticated = status.status === "error" && status.auth.status === "unauthenticated";
19+
const title = isUnauthenticated
20+
? `${providerName} is unauthenticated`
21+
: `${providerName} provider status`;
22+
const message = isUnauthenticated
23+
? "Sign in via the CLI to authenticate again."
24+
: (status.message ??
25+
(status.status === "error"
26+
? `${providerName} provider is unavailable.`
27+
: `${providerName} provider has limited availability.`));
2328

2429
return (
25-
<div className="pt-3 mx-auto max-w-3xl">
26-
<Alert variant={status.status === "error" ? "error" : "warning"}>
27-
<CircleAlertIcon />
28-
<AlertTitle>{title}</AlertTitle>
29-
<Tooltip>
30-
<TooltipTrigger render={<AlertDescription className="line-clamp-3" />}>
31-
{status.message ?? defaultMessage}
32-
</TooltipTrigger>
33-
<TooltipPopup side="top" className="max-w-96 whitespace-pre-wrap">
34-
{status.message ?? defaultMessage}
35-
</TooltipPopup>
36-
</Tooltip>
37-
</Alert>
30+
<div className="mx-auto w-fit max-w-[calc(100%-2rem)] pt-3">
31+
<div
32+
className={cn(
33+
"inline-flex items-center gap-3 rounded-xl border px-3.5 py-3 text-card-foreground text-sm",
34+
status.status === "warning"
35+
? "border-warning/32 bg-warning/4 [&_svg]:text-warning"
36+
: "border-destructive/32 bg-destructive/4 text-destructive-foreground [&_svg]:text-destructive",
37+
)}
38+
role="alert"
39+
>
40+
<InfoIcon className="size-4 shrink-0" aria-hidden />
41+
<div className="flex min-w-0 flex-col gap-1">
42+
<div className="font-medium">{title}</div>
43+
<Tooltip>
44+
<TooltipTrigger
45+
render={<div className="line-clamp-3 text-muted-foreground">{message}</div>}
46+
/>
47+
<TooltipPopup side="top" className="max-w-96 whitespace-pre-wrap">
48+
{message}
49+
</TooltipPopup>
50+
</Tooltip>
51+
</div>
52+
</div>
3853
</div>
3954
);
4055
});

‎apps/web/src/components/chat/ThreadErrorBanner.tsx‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { memo } from "react";
22
import { Alert, AlertAction, AlertDescription } from "../ui/alert";
3+
import { Button } from "../ui/button";
34
import { CircleAlertIcon, XIcon } from "lucide-react";
45
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
56

@@ -25,14 +26,9 @@ export const ThreadErrorBanner = memo(function ThreadErrorBanner({
2526
</Tooltip>
2627
{onDismiss && (
2728
<AlertAction>
28-
<button
29-
type="button"
30-
aria-label="Dismiss error"
31-
className="inline-flex size-6 items-center justify-center rounded-md text-destructive/60 transition-colors hover:text-destructive"
32-
onClick={onDismiss}
33-
>
34-
<XIcon className="size-3.5" />
35-
</button>
29+
<Button variant="ghost" size="icon-xs" aria-label="Dismiss error" onClick={onDismiss}>
30+
<XIcon className="text-destructive" />
31+
</Button>
3632
</AlertAction>
3733
)}
3834
</Alert>

‎apps/web/src/components/ui/alert-dialog.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ function AlertDialogTrigger(props: AlertDialogPrimitive.Trigger.Props) {
1717
function AlertDialogBackdrop({ className, ...props }: AlertDialogPrimitive.Backdrop.Props) {
1818
return (
1919
<AlertDialogPrimitive.Backdrop
20+
forceRender
2021
className={cn(
21-
"fixed inset-0 z-50 transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
22+
"fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
2223
className,
2324
)}
2425
data-slot="alert-dialog-backdrop"
@@ -31,7 +32,7 @@ function AlertDialogViewport({ className, ...props }: AlertDialogPrimitive.Viewp
3132
return (
3233
<AlertDialogPrimitive.Viewport
3334
className={cn(
34-
"fixed inset-0 z-50 grid grid-rows-[1fr_auto_3fr] justify-items-center bg-white/48 p-4 backdrop-blur-[2px] dark:bg-black/28",
35+
"fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4",
3536
className,
3637
)}
3738
data-slot="alert-dialog-viewport"
Lines changed: 75 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,113 @@
11
import { cva, type VariantProps } from "class-variance-authority";
2+
import { Children, isValidElement } from "react";
23
import type * as React from "react";
34

45
import { cn } from "~/lib/utils";
56

6-
const alertVariants = cva(
7-
"relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-xl border px-3.5 py-3 text-card-foreground text-sm has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-lh [&>svg]:w-4",
8-
{
9-
defaultVariants: {
10-
variant: "default",
11-
},
12-
variants: {
13-
variant: {
14-
default: "bg-transparent dark:bg-input/32 [&>svg]:text-muted-foreground",
15-
error: "border-destructive/32 bg-destructive/4 [&>svg]:text-destructive",
16-
info: "border-info/32 bg-info/4 [&>svg]:text-info",
17-
success: "border-success/32 bg-success/4 [&>svg]:text-success",
18-
warning: "border-warning/32 bg-warning/4 [&>svg]:text-warning",
19-
},
7+
const alertVariants = cva("relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm", {
8+
defaultVariants: {
9+
variant: "default",
10+
},
11+
variants: {
12+
variant: {
13+
default: "bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground",
14+
error:
15+
"border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive",
16+
info: "border-info/32 bg-info/4 [&_svg]:text-info",
17+
success: "border-success/32 bg-success/4 [&_svg]:text-success",
18+
warning: "border-warning/32 bg-warning/4 [&_svg]:text-warning",
2019
},
2120
},
22-
);
21+
});
22+
23+
function alertChildSlot(child: React.ReactElement): string | undefined {
24+
const propsSlot = (child.props as Record<string, string | undefined>)["data-slot"];
25+
if (propsSlot) {
26+
return propsSlot;
27+
}
28+
29+
const type = child.type as { displayName?: string; name?: string };
30+
switch (type.displayName ?? type.name) {
31+
case "AlertAction":
32+
return "alert-action";
33+
case "AlertTitle":
34+
return "alert-title";
35+
case "AlertDescription":
36+
return "alert-description";
37+
default:
38+
return undefined;
39+
}
40+
}
2341

2442
function Alert({
2543
className,
2644
variant,
45+
children,
2746
...props
2847
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
48+
const icon: React.ReactNode[] = [];
49+
const content: React.ReactNode[] = [];
50+
const action: React.ReactNode[] = [];
51+
52+
Children.forEach(children, (child) => {
53+
if (!isValidElement(child)) {
54+
content.push(child);
55+
return;
56+
}
57+
const slot = alertChildSlot(child);
58+
if (slot === "alert-action") {
59+
action.push(child);
60+
} else if (slot === "alert-title" || slot === "alert-description") {
61+
content.push(child);
62+
} else {
63+
icon.push(child);
64+
}
65+
});
66+
2967
return (
3068
<div
3169
className={cn(alertVariants({ variant }), className)}
3270
data-slot="alert"
3371
role="alert"
3472
{...props}
35-
/>
73+
>
74+
<div className="flex items-center gap-2">
75+
{icon.length > 0 && (
76+
<div className="flex size-4 shrink-0 items-center justify-center [&>svg]:size-full">
77+
{icon}
78+
</div>
79+
)}
80+
{content.length > 0 && (
81+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">{content}</div>
82+
)}
83+
{action.length > 0 && (
84+
<div className="flex shrink-0 items-center self-center">{action}</div>
85+
)}
86+
</div>
87+
</div>
3688
);
3789
}
3890

3991
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
40-
return (
41-
<div
42-
className={cn("font-medium [svg~&]:col-start-2", className)}
43-
data-slot="alert-title"
44-
{...props}
45-
/>
46-
);
92+
return <div className={cn("font-medium", className)} data-slot="alert-title" {...props} />;
4793
}
4894

4995
function AlertDescription({ className, ...props }: React.ComponentProps<"div">) {
5096
return (
5197
<div
52-
className={cn("flex flex-col gap-2.5 text-muted-foreground [svg~&]:col-start-2", className)}
98+
className={cn("flex flex-col gap-2.5 text-muted-foreground", className)}
5399
data-slot="alert-description"
54100
{...props}
55101
/>
56102
);
57103
}
58104

59105
function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
60-
return (
61-
<div
62-
className={cn(
63-
"flex gap-1 max-sm:col-start-2 max-sm:mt-2 sm:row-start-1 sm:row-end-3 sm:self-center sm:[[data-slot=alert-description]~&]:col-start-2 sm:[[data-slot=alert-title]~&]:col-start-2 sm:[svg~&]:col-start-2 sm:[svg~[data-slot=alert-description]~&]:col-start-3 sm:[svg~[data-slot=alert-title]~&]:col-start-3",
64-
className,
65-
)}
66-
data-slot="alert-action"
67-
{...props}
68-
/>
69-
);
106+
return <div className={cn("flex gap-1", className)} data-slot="alert-action" {...props} />;
70107
}
71108

109+
AlertTitle.displayName = "AlertTitle";
110+
AlertDescription.displayName = "AlertDescription";
111+
AlertAction.displayName = "AlertAction";
112+
72113
export { Alert, AlertTitle, AlertDescription, AlertAction };

‎apps/web/src/components/ui/autocomplete.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function AutocompleteItem({ className, children, ...props }: AutocompletePrimiti
125125
return (
126126
<AutocompletePrimitive.Item
127127
className={cn(
128-
"flex min-h-8 cursor-default select-none items-center rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-selected:bg-accent/50 data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm",
128+
"flex min-h-8 cursor-default select-none items-center rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-selected:bg-accent/50 data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='text-'])]:text-muted-foreground",
129129
className,
130130
)}
131131
data-slot="autocomplete-item"

‎apps/web/src/components/ui/button.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const buttonVariants = cva(
3737
"destructive-outline":
3838
"border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4",
3939
ghost:
40-
"border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent",
40+
"border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [&_svg:not([class*='text-'])]:text-muted-foreground",
4141
link: "border-transparent underline-offset-4 [:hover,[data-pressed]]:underline",
4242
outline:
43-
"border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
43+
"border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground",
4444
secondary:
4545
"border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90",
4646
},

0 commit comments

Comments
 (0)