"use client"; import { IconBrandVscode, IconDeviceDesktop, IconFileText, IconFolder, IconGitBranch, IconGitPullRequest, IconMessagePlus, IconTerminal2, } from "@tabler/icons-react"; import { DropdownMenuItem, DropdownMenuSeparator } from "@kandev/ui/dropdown-menu"; import { prPanelLabel } from "@/components/github/pr-utils"; import { useDockviewStore } from "@/lib/state/dockview-store"; import type { TaskPR } from "@/lib/types/github"; import { RepositoryScriptsMenuItems } from "./repository-scripts-menu"; import { SessionReopenMenuItems } from "./session-reopen-menu"; type AddPanelMenuState = { taskId: string | null; isPassthrough: boolean; hasChanges: boolean; hasFiles: boolean; pr: TaskPR | null; }; type AddPanelMenuItemsProps = { groupId: string; state: AddPanelMenuState; onNewSession: () => void; onAddTerminal: () => void; onRunScript: (scriptId: string) => void; onRunDevScript: () => void; }; export const MENU_ICON_CLASS = "h-3.5 w-3.5 mr-1.5 shrink-0"; export const MENU_ITEM_CLASS = "cursor-pointer text-xs"; export function AddPanelMenuItems({ groupId, state, onNewSession, onAddTerminal, onRunScript, onRunDevScript, }: AddPanelMenuItemsProps) { const addBrowserPanel = useDockviewStore((s) => s.addBrowserPanel); const addVscodePanel = useDockviewStore((s) => s.addVscodePanel); const addPlanPanel = useDockviewStore((s) => s.addPlanPanel); const addFilesPanel = useDockviewStore((s) => s.addFilesPanel); const addChangesPanel = useDockviewStore((s) => s.addChangesPanel); const addPRPanel = useDockviewStore((s) => s.addPRPanel); return ( <> {state.taskId && ( <> New Agent )} Terminal addBrowserPanel(undefined, groupId)} className={MENU_ITEM_CLASS} > Browser addVscodePanel()} className={MENU_ITEM_CLASS}> VS Code {!state.isPassthrough && ( addPlanPanel({ groupId })} className={MENU_ITEM_CLASS}> Plan )} {!state.hasChanges && ( addChangesPanel(groupId)} className={MENU_ITEM_CLASS}> Changes )} {!state.hasFiles && ( addFilesPanel(groupId)} className={MENU_ITEM_CLASS}> Files )} {state.pr && ( addPRPanel()} className={MENU_ITEM_CLASS}> {prPanelLabel(state.pr.pr_number)} )} ); }