Skip to content

Commit 15d3290

Browse files
committed
fix(web): thread undo notice sits above the bottom shelves instead of the header
1 parent d8dddf1 commit 15d3290

6 files changed

Lines changed: 23 additions & 13 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3692,7 +3692,7 @@ export default function LegacySidebar({ routeReveal }: { routeReveal: SidebarRou
36923692
attachProjectListAutoAnimateRef={attachProjectListAutoAnimateRef}
36933693
projectsLength={projectsLength}
36943694
/>
3695-
<SidebarChromeFooter />
3695+
<SidebarChromeFooter showUndoNotice />
36963696
</>
36973697
);
36983698
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,6 +3138,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31383138
className="mt-auto"
31393139
label="Working"
31403140
count={workingThreads.length}
3141+
hostsUndoNotice
31413142
toggle={{
31423143
expanded: workingShelfExpanded,
31433144
onToggle: toggleWorkingShelf,
@@ -3153,6 +3154,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31533154
className={cn(workingThreads.length === 0 && "mt-auto")}
31543155
label="Snoozed"
31553156
count={snoozedThreads.length}
3157+
hostsUndoNotice={workingThreads.length === 0}
31563158
toggle={{
31573159
expanded: snoozedShelfExpanded,
31583160
onToggle: toggleSnoozedShelf,
@@ -3170,6 +3172,9 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
31703172
)}
31713173
label="Settled"
31723174
count={settledCount}
3175+
hostsUndoNotice={
3176+
workingThreads.length + snoozedThreads.length === 0
3177+
}
31733178
dragging={from !== null}
31743179
isDropTarget={dragTargetSection === "settled"}
31753180
toggle={{

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { ReactNode } from "react";
33
import { memo } from "react";
44
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
55

6-
import { useThreadUndoNotice } from "../../hooks/showThreadUndoNotice";
76
import { useEnvironmentIdentificationMode } from "../../hooks/useSettings";
87
import { cn } from "../../lib/utils";
98
import { usePullRequestsSupported } from "../../state/environments";
@@ -38,7 +37,6 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
3837
isElectron: boolean;
3938
}) {
4039
const stageLabel = useEnvironmentStageLabel();
41-
const showingUndoNotice = useThreadUndoNotice((state) => state.notice !== null);
4240
const environmentIdentificationMode = useEnvironmentIdentificationMode();
4341
const backdropVariant = resolveSidebarStageBackdropVariant(
4442
stageLabel,
@@ -65,8 +63,7 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
6563
/>
6664
</div>
6765
<div className="relative z-10 flex h-8 min-w-0 flex-1 flex-wrap content-start items-center gap-x-2 overflow-hidden py-0.5">
68-
<SidebarThreadUndoNotice onBackdrop={backdropVariant !== null} />
69-
{showingUndoNotice ? null : <SidebarBrand onBackdrop={backdropVariant !== null} />}
66+
<SidebarBrand onBackdrop={backdropVariant !== null} />
7067
{pillLabel ? (
7168
<div className="ml-1 flex h-7 items-center">
7269
<Badge data-environment-identification="pill" size="sm" variant="secondary">
@@ -231,9 +228,14 @@ const SidebarUtilityMenu = memo(function SidebarUtilityMenu() {
231228
);
232229
});
233230

234-
export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
231+
export const SidebarChromeFooter = memo(function SidebarChromeFooter({
232+
showUndoNotice = false,
233+
}: {
234+
showUndoNotice?: boolean;
235+
}) {
235236
return (
236237
<SidebarFooter>
238+
{showUndoNotice ? <SidebarThreadUndoNotice /> : null}
237239
<SidebarProviderUpdatePill />
238240
<SidebarUpdateArchitectureWarning />
239241
<SidebarUtilityMenu />

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
type SidebarListMarker,
1111
} from "../Sidebar.logic";
1212
import { SIDEBAR_SORTABLE_DRAG_DISABLED } from "./SidebarThreadRow";
13+
import { SidebarThreadUndoNotice } from "./SidebarThreadUndoNotice";
1314

1415
function SortableSidebarMarker(props: {
1516
marker: SidebarListMarker;
@@ -109,6 +110,8 @@ export function SidebarSectionHeader(props: {
109110
dragging?: boolean;
110111
isDropTarget?: boolean;
111112
toggle: { expanded: boolean; onToggle: () => void };
113+
/** The first shelf at the bottom of the list hosts the undo notice just above itself. */
114+
hostsUndoNotice?: boolean;
112115
}) {
113116
const shelf =
114117
props.marker === "working-header"
@@ -122,8 +125,11 @@ export function SidebarSectionHeader(props: {
122125
<SortableSidebarMarker
123126
marker={props.marker}
124127
data-testid={`sidebar-${props.marker}`}
125-
className={cn("mx-0.5 h-8", props.className)}
128+
className={cn("relative mx-0.5 h-8", props.className)}
126129
>
130+
{props.hostsUndoNotice ? (
131+
<SidebarThreadUndoNotice className="absolute inset-x-0 bottom-full bg-sidebar surface-grain" />
132+
) : null}
127133
<CollapsibleSectionHeader
128134
onClick={props.toggle.onToggle}
129135
expanded={props.toggle.expanded}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const spoken = () =>
1212
describe("SidebarThreadUndoNotice", () => {
1313
it("speaks the notice, and drops it when the notice clears before it is spoken", async () => {
1414
using _notice = { [Symbol.dispose]: () => useThreadUndoNotice.setState({ notice: null }) };
15-
await using _screen = await render(<SidebarThreadUndoNotice onBackdrop={false} />);
15+
await using _screen = await render(<SidebarThreadUndoNotice />);
1616
using _timers = fakeTimers();
1717
const showSettled = () =>
1818
act(async () =>

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { cn } from "../../lib/utils";
88
import { primaryServerKeybindingsAtom } from "../../state/server";
99
import { InlineButton } from "../ui/button";
1010

11-
export function SidebarThreadUndoNotice({ onBackdrop }: { onBackdrop: boolean }) {
11+
export function SidebarThreadUndoNotice({ className }: { className?: string }) {
1212
const notice = useThreadUndoNotice((state) => state.notice);
1313
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
1414

@@ -30,10 +30,7 @@ export function SidebarThreadUndoNotice({ onBackdrop }: { onBackdrop: boolean })
3030
return (
3131
<div
3232
role="group"
33-
className={cn(
34-
"ml-[var(--workspace-titlebar-content-left)] min-w-0 truncate text-2xs leading-7",
35-
onBackdrop ? "text-white/70" : "text-sidebar-muted-foreground",
36-
)}
33+
className={cn("truncate px-2 text-2xs leading-6 text-sidebar-muted-foreground", className)}
3734
>
3835
{summary},{" "}
3936
<InlineButton onClick={undoLatestThreadAction} tone="inherit">

0 commit comments

Comments
 (0)