Skip to content

Commit 1461465

Browse files
t3dotggclaude
andcommitted
fix(web): live background-work banner no longer hides behind the update notice
The composer banner stack fronted passive system banners (like the 'Server update available' notice) over the background-liveness banner, burying the only Stop affordance for settled turns behind a hover. The collapsed stack cap was also hardcoded to warning yellow, making a neutral hidden banner read as a warning sliver. Now urgent (error/warning) system banners stay in front, background liveness comes next, and calm system banners stack behind it. The cap border derives from the first hidden banner's variant. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 8100062 commit 1461465

3 files changed

Lines changed: 49 additions & 8 deletions

File tree

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4372,8 +4372,12 @@ function ChatViewContent(props: ChatViewProps) {
43724372
};
43734373
}, [acknowledgeActiveThreadWoke, activeThread?.id, activeThreadWokeVisible]);
43744374
// The stack renders items[0] front-most and tucks the rest behind hover, so
4375-
// ordering is priority: system banners, then the branch-mismatch notice,
4376-
// and the informational parked-thread banner last — it must never cover another.
4375+
// ordering is priority: urgent system banners (connection down, update
4376+
// failed), then background liveness — its Stop button is the only stop
4377+
// affordance for settled turns, so a calm "update available" notice must not
4378+
// cover it — then calm system banners, the woke and branch-mismatch
4379+
// notices, and the informational parked-thread banner last — it must never
4380+
// cover another.
43774381
const parkedThreadBannerItem = useMemo<ComposerBannerStackItem | null>(() => {
43784382
if (!activeThreadSnoozed && !activeThreadSettled) {
43794383
return null;
@@ -4423,21 +4427,29 @@ function ChatViewContent(props: ChatViewProps) {
44234427
void handleSwitchCheckoutToThread();
44244428
}, [gitStatusQuery.data?.hasWorkingTreeChanges, handleSwitchCheckoutToThread]);
44254429
const composerBannerItems = useMemo<ComposerBannerStackItem[]>(() => {
4430+
const urgentSystemItems = systemComposerBannerItems.filter(
4431+
(item) => item.variant === "error" || item.variant === "warning",
4432+
);
4433+
const calmSystemItems = systemComposerBannerItems.filter(
4434+
(item) => item.variant !== "error" && item.variant !== "warning",
4435+
);
44264436
const backgroundLivenessItems =
44274437
backgroundLivenessBannerItem === null ? [] : [backgroundLivenessBannerItem];
44284438
const wokeThreadItems = wokeThreadBannerItem === null ? [] : [wokeThreadBannerItem];
44294439
const parkedThreadItems = parkedThreadBannerItem === null ? [] : [parkedThreadBannerItem];
44304440
if (!localCheckoutBranchMismatch || !showBranchMismatchBanner || !activeBranchMismatchKey) {
44314441
return [
4432-
...systemComposerBannerItems,
4442+
...urgentSystemItems,
44334443
...backgroundLivenessItems,
4444+
...calmSystemItems,
44344445
...wokeThreadItems,
44354446
...parkedThreadItems,
44364447
];
44374448
}
44384449
return [
4439-
...systemComposerBannerItems,
4450+
...urgentSystemItems,
44404451
...backgroundLivenessItems,
4452+
...calmSystemItems,
44414453
...wokeThreadItems,
44424454
{
44434455
id: `branch-mismatch:${activeBranchMismatchKey}`,

‎apps/web/src/components/chat/ComposerBannerStack.test.tsx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { describe, expect, it } from "vite-plus/test";
33

44
import { ComposerBannerStack, type ComposerBannerStackItem } from "./ComposerBannerStack";
55

6-
const banner = (id: string): ComposerBannerStackItem => ({
6+
const banner = (
7+
id: string,
8+
variant: ComposerBannerStackItem["variant"] = "warning",
9+
): ComposerBannerStackItem => ({
710
id,
8-
variant: "warning",
11+
variant,
912
icon: <span aria-hidden="true">!</span>,
1013
title: `${id} warning`,
1114
});
@@ -29,6 +32,19 @@ describe("ComposerBannerStack", () => {
2932
expect(markup).toContain("group-focus-within/banner-stack:visible");
3033
});
3134

35+
it("colors the collapsed stack cap by the hidden banner's variant, not a fixed warning", () => {
36+
const neutralBehind = renderToStaticMarkup(
37+
<ComposerBannerStack items={[banner("front", "default"), banner("stacked", "default")]} />,
38+
);
39+
expect(neutralBehind).toContain("border-border");
40+
expect(neutralBehind).not.toContain("border-warning/24");
41+
42+
const warningBehind = renderToStaticMarkup(
43+
<ComposerBannerStack items={[banner("front", "default"), banner("stacked", "warning")]} />,
44+
);
45+
expect(warningBehind).toContain("border-warning/24");
46+
});
47+
3248
it("does not render an expandable region for a single banner", () => {
3349
const markup = renderToStaticMarkup(<ComposerBannerStack items={[banner("front")]} />);
3450

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ const exitTransitionStyle = {
2222
transition: `transform ${DISMISS_TRANSITION_MS}ms ease-in, opacity ${DISMISS_TRANSITION_MS}ms ease-in`,
2323
} satisfies CSSProperties;
2424

25+
// The collapsed cap peeking above the front banner is the only hint that more
26+
// banners are stacked behind it, so its border must match the severity of the
27+
// first hidden banner — a neutral banner must not masquerade as a warning.
28+
const stackCapBorderClass: Record<ComposerBannerStackItem["variant"], string> = {
29+
default: "border-border",
30+
error: "border-destructive/24",
31+
info: "border-info/24",
32+
success: "border-success/24",
33+
warning: "border-warning/24",
34+
};
35+
2536
export interface ComposerBannerStackItem {
2637
readonly id: string;
2738
readonly variant: "default" | "error" | "info" | "success" | "warning";
@@ -67,6 +78,7 @@ export function ComposerBannerStack({ className, items }: ComposerBannerStackPro
6778
const stackedItems = items.slice(1);
6879
const hasStack = stackedItems.length > 0;
6980
const showCollapsedStackCap = hasStack && exitingItemId !== frontItem.id;
81+
const firstStackedItem = stackedItems[0];
7082

7183
const requestDismiss = (item: ComposerBannerStackItem) => {
7284
if (!item.onDismiss || exitingItemId) {
@@ -90,11 +102,12 @@ export function ComposerBannerStack({ className, items }: ComposerBannerStackPro
90102
hasStack ? "group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50" : null,
91103
)}
92104
>
93-
{showCollapsedStackCap ? (
105+
{showCollapsedStackCap && firstStackedItem ? (
94106
<div
95107
className={cn(
96108
"pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-[22px]",
97-
"border border-b-0 border-warning/24 bg-background/96 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",
109+
"border border-b-0 bg-background/96 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",
110+
stackCapBorderClass[firstStackedItem.variant],
98111
"transition-opacity duration-150 ease-out",
99112
"group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0",
100113
)}

0 commit comments

Comments
 (0)