Skip to content

Commit 3991628

Browse files
committed
fix(web): split menu action is sidebar-only and no longer precedes find
As './useThreadActionMenu' builds the same items, 'Open to the side' showed up in header menus without any handler — and the pre-find ordering broke the thread menu permission test. It is now opt-in state supplied by the sidebar,nun placed after find.
1 parent aae5bb5 commit 3991628

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
26412641
canShareWithGuestAtom(threadRef.environmentId),
26422642
),
26432643
canTurnIntoProject: canTurnThreadIntoProject(threadRef),
2644+
showOpenToSide: true,
26442645
supports: {
26452646
settlement: configLoaded,
26462647
autoSettleOptOut: supportsAutoSettleOptOut,

‎apps/web/src/components/threadActionMenu.logic.test.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ describe("buildThreadActionMenuItems", () => {
7575
expect(items.find((item) => item.id === "turn-into-project")?.disabled).toBe(true);
7676
});
7777

78-
it("includes open-to-side action item", () => {
79-
const items = buildThreadActionMenuItems(baseState);
80-
const openToSide = items.find((item) => item.id === "open-to-side");
78+
it("offers open-to-side only to the sidebar, after find", () => {
79+
const openToSide = buildThreadActionMenuItems({ ...baseState, showOpenToSide: true }).find(
80+
(item) => item.id === "open-to-side",
81+
);
8182
expect(openToSide).toBeDefined();
8283
expect(openToSide?.label).toBe("Open to the side");
8384
expect(openToSide?.disabled).toBeFalsy();
85+
expect(buildThreadActionMenuItems(baseState).some((item) => item.id === "open-to-side")).toBe(
86+
false,
87+
);
8488
});
8589
});

‎apps/web/src/components/threadActionMenu.logic.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ export interface ThreadActionMenuState {
9696
readonly canShareWithGuest?: boolean;
9797
/** A No project thread with its own folder, on a server that can promote it. */
9898
readonly canTurnIntoProject?: boolean;
99+
/** Sidebar-only: the sidebar is the one place that handles this action, so other menus don't offer it. */
100+
readonly showOpenToSide?: boolean;
99101
}
100102

101103
/** Local navigation, read markers, and copying remain available to read-only clients. */
@@ -119,10 +121,12 @@ export function buildThreadActionMenuItems(
119121
state: ThreadActionMenuState,
120122
): ReadonlyArray<ContextMenuItem<ThreadActionMenuId>> {
121123
const items: ReadonlyArray<ContextMenuItem<ThreadActionMenuId>> = [
122-
{ id: "open-to-side" as const, label: "Open to the side", icon: "columns-2" },
123124
...(state.canFind
124125
? [{ id: "find" as const, label: "Find in thread", icon: "text-search" }]
125126
: []),
127+
...(state.showOpenToSide
128+
? [{ id: "open-to-side" as const, label: "Open to the side", icon: "columns-2" }]
129+
: []),
126130
...(state.branch
127131
? [
128132
{

0 commit comments

Comments
 (0)