Skip to content

Commit 003f7ad

Browse files
committed
infer terminal selection action ids
1 parent 0bf347c commit 003f7ad

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
XIcon,
1414
} from "lucide-react";
1515
import {
16-
type ContextMenuItem,
1716
type ResolvedKeybindingsConfig,
1817
type ScopedThreadRef,
1918
type ThreadId,
@@ -72,14 +71,6 @@ const MIN_DRAWER_HEIGHT = 180;
7271
const MAX_DRAWER_HEIGHT_RATIO = 0.75;
7372
const MULTI_CLICK_SELECTION_ACTION_DELAY_MS = 260;
7473

75-
type TerminalSelectionActionId = "add-to-chat" | "copy";
76-
77-
export const TERMINAL_SELECTION_ACTION_MENU_ITEMS: readonly ContextMenuItem<TerminalSelectionActionId>[] =
78-
[
79-
{ id: "add-to-chat", label: "Add to chat" },
80-
{ id: "copy", label: "Copy" },
81-
];
82-
8374
function maxDrawerHeight(): number {
8475
if (typeof window === "undefined") return DEFAULT_THREAD_TERMINAL_HEIGHT;
8576
return Math.max(MIN_DRAWER_HEIGHT, Math.floor(window.innerHeight * MAX_DRAWER_HEIGHT_RATIO));
@@ -483,7 +474,13 @@ export function TerminalViewport({
483474
const requestId = ++selectionActionRequestIdRef.current;
484475
selectionActionMenuOpenRef.current = true;
485476
const clicked = await localApi.contextMenu
486-
.show(TERMINAL_SELECTION_ACTION_MENU_ITEMS, nextAction.position)
477+
.show(
478+
[
479+
{ id: "add-to-chat", label: "Add to chat" },
480+
{ id: "copy", label: "Copy" },
481+
],
482+
nextAction.position,
483+
)
487484
.finally(() => {
488485
selectionActionMenuOpenRef.current = false;
489486
});

0 commit comments

Comments
 (0)