Skip to content

Commit abcff3e

Browse files
DerpedyeaNicholas Wasmillerclaude
authored
fix(web): the undo notice no longer pushes the update button out of the sidebar (#27695)
Co-authored-by: Nicholas Wasmiller <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 87cfd08 commit abcff3e

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎apps/web/src/components/sidebar/SidebarThreadUndoNotice.tsx‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useAtomValue } from "@effect/atom-react";
2+
import { Undo2Icon } from "lucide-react";
23
import { useState } from "react";
34

45
import {
@@ -29,8 +30,11 @@ export function SidebarThreadUndoNotice() {
2930
if (!text) return null;
3031

3132
return (
32-
// No min-w-0: the undo button sets this item's minimum, so a shared row squeezes its neighbour.
33-
<SidebarMenuItem className="flex flex-1" aria-hidden={!summary} inert={!summary}>
33+
<SidebarMenuItem
34+
className="@container flex min-w-0 flex-1"
35+
aria-hidden={!summary}
36+
inert={!summary}
37+
>
3438
<div
3539
onTransitionEnd={(event) => {
3640
if (!summary && event.target === event.currentTarget) setShownSummary(null);
@@ -43,7 +47,14 @@ export function SidebarThreadUndoNotice() {
4347
!summary && "opacity-0",
4448
)}
4549
>
46-
<InlineButton onClick={undoLatestThreadAction}>{threadUndoLabel(keybindings)}</InlineButton>
50+
<InlineButton className="min-w-0 shrink" onClick={undoLatestThreadAction}>
51+
{/* The icon's negative margin cancels its width, so beside the label it sits in
52+
clipped space; once the label is too wide it wraps away and the icon shows. */}
53+
<span className="flex h-6 min-w-0 flex-wrap justify-end overflow-hidden">
54+
<Undo2Icon className="-ml-4 h-6 w-4 @max-[1rem]:invisible" />
55+
<span>{threadUndoLabel(keybindings)}</span>
56+
</span>
57+
</InlineButton>
4758
<span>{text},</span>
4859
</div>
4960
</SidebarMenuItem>

‎apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function SidebarUpdateCapsule({
8888
<Popover>
8989
<div
9090
className={cn(
91-
"relative flex h-8 min-w-0 flex-1 items-center rounded-full bg-sidebar-control-surface text-sidebar-foreground",
91+
"relative flex h-8 flex-1 items-center rounded-full bg-sidebar-control-surface text-sidebar-foreground",
9292
view.tone === "slow" && "ring-1 ring-warning/40 ring-inset",
9393
view.tone === "failed" && "ring-1 ring-destructive/40 ring-inset",
9494
)}
@@ -104,7 +104,9 @@ export function SidebarUpdateCapsule({
104104
/>
105105
}
106106
/>
107-
<span className="pointer-events-none relative min-w-0 flex-1 truncate pl-3 text-xs">
107+
{/* w-0 keeps the label out of the capsule's minimum width, so a shared footer row
108+
can squeeze the label but never push the action past the sidebar edge. */}
109+
<span className="pointer-events-none relative w-0 min-w-0 flex-1 truncate pl-3 text-xs">
108110
<span className={cn(view.tone === "failed" && "text-destructive")}>{view.label}</span>
109111
{view.slow ? (
110112
<span className="text-warning tabular-nums"> {view.slow.elapsed}</span>

‎apps/web/src/components/sidebar/SidebarUpdatePill.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ function SidebarUpdateControl() {
422422
? { status: "downloading", percent: state.downloadPercent }
423423
: { status: "waiting" };
424424
return (
425-
<SidebarMenuItem className="ml-auto flex min-w-0 flex-1">
425+
<SidebarMenuItem className="ml-auto flex flex-1">
426426
<SidebarUpdateCapsule
427427
run={run}
428428
local={local}

0 commit comments

Comments
 (0)