Skip to content

Commit 38fbaf0

Browse files
Nicholas Wasmillerclaude
andcommitted
fix(web): the undo notice no longer pushes the update button out of the sidebar
At the minimum sidebar width the "Ctrl+Z to undo" label didn't fit beside the utility icons and its min-content width pushed the update button past the sidebar edge. The notice now shrinks, and when the label doesn't fit it swaps to an undo icon. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1da41f9 commit 38fbaf0

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 10 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,7 @@ 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 className="flex min-w-0 flex-1" aria-hidden={!summary} inert={!summary}>
3434
<div
3535
onTransitionEnd={(event) => {
3636
if (!summary && event.target === event.currentTarget) setShownSummary(null);
@@ -43,7 +43,14 @@ export function SidebarThreadUndoNotice() {
4343
!summary && "opacity-0",
4444
)}
4545
>
46-
<InlineButton onClick={undoLatestThreadAction}>{threadUndoLabel(keybindings)}</InlineButton>
46+
<InlineButton className="min-w-0 shrink" onClick={undoLatestThreadAction}>
47+
{/* The icon's negative margin cancels its width, so beside the label it sits in
48+
clipped space; once the label is too wide it wraps away and the icon shows. */}
49+
<span className="flex h-6 min-w-0 flex-wrap justify-end overflow-hidden">
50+
<Undo2Icon className="-ml-4 h-6 w-4" />
51+
<span>{threadUndoLabel(keybindings)}</span>
52+
</span>
53+
</InlineButton>
4754
<span>{text},</span>
4855
</div>
4956
</SidebarMenuItem>

0 commit comments

Comments
 (0)