68c94dfa3a
* docs: define product and design direction * style: establish restrained workbench primitives * refactor: declutter board and task topbars * style: align dockview panel chrome * fix: align task topbar vcs control sizing * refactor: surface integrations navigation * fix: repair integrations and task creation workflow * refactor: include linear in integrations navigation * style: restore familiar workbench tones * fix: add dockview tab breathing room * fix: show configured integration shortcuts * fix: hover open integrations menu * fix: stabilize integrations hover menu * fix: align home and dockview topbars * fix: normalize home topbar controls * fix: compact home topbar height * fix: simplify home chrome and split buttons * fix: move integrations to left chrome * fix: restore home stats shortcut * fix: add dockview tab breathing room * fix: border home stats button * fix: streamline dockview topbar actions * fix: align task split button seam * fix: address review feedback * fix: restore topbar e2e affordances * fix: stabilize workflow e2e isolation * fix: add task topbar action overflow * fix: address PR review feedback
114 lines
3.6 KiB
TypeScript
114 lines
3.6 KiB
TypeScript
"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 && (
|
|
<>
|
|
<DropdownMenuItem
|
|
onClick={onNewSession}
|
|
className={MENU_ITEM_CLASS}
|
|
data-testid="new-session-button"
|
|
>
|
|
<IconMessagePlus className={MENU_ICON_CLASS} />
|
|
New Agent
|
|
</DropdownMenuItem>
|
|
<DropdownMenuSeparator />
|
|
<SessionReopenMenuItems taskId={state.taskId} groupId={groupId} />
|
|
</>
|
|
)}
|
|
<DropdownMenuItem onClick={onAddTerminal} className={MENU_ITEM_CLASS}>
|
|
<IconTerminal2 className={MENU_ICON_CLASS} />
|
|
Terminal
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem
|
|
onClick={() => addBrowserPanel(undefined, groupId)}
|
|
className={MENU_ITEM_CLASS}
|
|
>
|
|
<IconDeviceDesktop className={MENU_ICON_CLASS} />
|
|
Browser
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem onClick={() => addVscodePanel()} className={MENU_ITEM_CLASS}>
|
|
<IconBrandVscode className={MENU_ICON_CLASS} />
|
|
VS Code
|
|
</DropdownMenuItem>
|
|
{!state.isPassthrough && (
|
|
<DropdownMenuItem onClick={() => addPlanPanel({ groupId })} className={MENU_ITEM_CLASS}>
|
|
<IconFileText className={MENU_ICON_CLASS} />
|
|
Plan
|
|
</DropdownMenuItem>
|
|
)}
|
|
{!state.hasChanges && (
|
|
<DropdownMenuItem onClick={() => addChangesPanel(groupId)} className={MENU_ITEM_CLASS}>
|
|
<IconGitBranch className={MENU_ICON_CLASS} />
|
|
Changes
|
|
</DropdownMenuItem>
|
|
)}
|
|
{!state.hasFiles && (
|
|
<DropdownMenuItem onClick={() => addFilesPanel(groupId)} className={MENU_ITEM_CLASS}>
|
|
<IconFolder className={MENU_ICON_CLASS} />
|
|
Files
|
|
</DropdownMenuItem>
|
|
)}
|
|
{state.pr && (
|
|
<DropdownMenuItem onClick={() => addPRPanel()} className={MENU_ITEM_CLASS}>
|
|
<IconGitPullRequest className={MENU_ICON_CLASS} />
|
|
{prPanelLabel(state.pr.pr_number)}
|
|
</DropdownMenuItem>
|
|
)}
|
|
<RepositoryScriptsMenuItems onRunScript={onRunScript} onRunDevScript={onRunDevScript} />
|
|
</>
|
|
);
|
|
}
|