返回 DeepSeek-Reasonix
ProjectTreeSessionArchiveMenu.tsx
根目录 / desktop / frontend / src / components / ProjectTreeSessionArchiveMenu.tsx
1 import { Archive, Pencil, Sparkles } from "lucide-react";
2 import { useT } from "../lib/i18n";
3 import { ContextMenu, type ContextMenuItem, type ContextMenuPoint } from "./ContextMenu";
4
5 type ProjectTreeSessionArchiveMenuProps = {
6 open: boolean;
7 point: ContextMenuPoint | null;
8 sessionPath: string;
9 blocked: boolean;
10 busy: boolean;
11 confirmed: boolean;
12 aiBusy: boolean;
13 onRename: () => void;
14 onAIRename: () => void;
15 onConfirm: () => void;
16 onTrash: () => void;
17 onClose: () => void;
18 };
19
20 export function ProjectTreeSessionArchiveMenu({
21 open, point, sessionPath, blocked, busy, confirmed, aiBusy, onRename, onAIRename, onConfirm, onTrash, onClose,
22 }: ProjectTreeSessionArchiveMenuProps) {
23 const t = useT();
24 const items: ContextMenuItem[] = [
25 {
26 key: "rename-session",
27 icon: <Pencil size={13} />,
28 label: t("projectTree.renameTopic"),
29 disabled: !sessionPath || busy,
30 onSelect: onRename,
31 },
32 {
33 key: "ai-rename-session",
34 icon: <Sparkles size={13} />,
35 label: t(aiBusy ? "projectTree.aiRenamingTopic" : "projectTree.aiRenameTopic"),
36 disabled: !sessionPath || busy || aiBusy,
37 onSelect: onAIRename,
38 },
39 {
40 key: "trash-session",
41 icon: <Archive className={busy ? "project-tree__archive-spinner" : undefined} size={13} />,
42 label: t(confirmed ? "history.confirmMoveToTrash" : "history.moveToTrash"),
43 disabled: !sessionPath || blocked || busy,
44 danger: true,
45 onSelect: confirmed ? onTrash : onConfirm,
46 },
47 ];
48 return <ContextMenu open={open} point={point} items={items} minWidth={178} ariaLabel={t("projectTree.topicActions")} onClose={onClose} />;
49 }
50
50 lines Plain Text