"use client"; import { ArrowLeft, ArrowUpRight, Bold, ChevronDown, Copy, FileText, FolderOpen, GitBranchPlus, GitMerge, Hand, Image as ImageIcon, Italic, ListPlus, Link2, StickyNote, Maximize, Minus, MousePointer2, Network, PanelRight, Pencil, Plus, Redo2, Save, Shapes, Tag, Trash2, Type, Underline, Undo2, Upload, Download, X, type LucideIcon, } from "lucide-react"; import { type ReactNode, useState } from "react"; export type FlowBoardToolId = | "selection" | "hand" | "mind" | "text" | "arrow" | "shape" | "image"; export type FlowBoardSheetTab = { id: string; title: string; }; export type FlowBoardLayoutOption = { id: string; label: string; preview: | "both" | "right" | "left" | "down" | "up" | "indent" | "fishbone" | "timeline" | "brace" | "verticalTimeline" | "treeTable" | "treeTableSide" | "spreadsheet"; }; export type FlowBoardThemeOption = { id: string; label: string; colors: [string, string, string]; }; type ToolbarActionProps = { active?: boolean; disabled?: boolean; icon: LucideIcon; label: string; onClick: () => void; }; function ToolbarAction({ active = false, disabled = false, icon: Icon, label, onClick, }: ToolbarActionProps) { return ( ); } function IconAction({ children, disabled = false, label, tooltip, onClick, }: { children: ReactNode; disabled?: boolean; label: string; tooltip?: string; onClick: () => void; }) { return ( ); } function LayoutPreview({ direction, }: { direction: FlowBoardLayoutOption["preview"]; }) { const horizontal = direction === "right" || direction === "left"; const vertical = direction === "down" || direction === "up"; const leaf = (x: number, y: number) => ( ); const root = (x: number, y: number) => ( ); return ( ); } export function XmindEditorTopBar({ activeTool, canEditMind, currentTitle, formatPanelOpen, isSaving, onBack, onImport, onExport, isExporting, onInsertChild, onInsertSibling, onRelationship, onBoundary, relationshipPending, onOpenFiles, onRedo, onSave, onSummary, onTopicDetails, onTitleChange, onTitleCommit, onToggleFormat, onToggleMarkers, onToolChange, onUndo, siteLogo, siteName, }: { activeTool: FlowBoardToolId; canEditMind: boolean; currentTitle: string; formatPanelOpen: boolean; isSaving: boolean; onBack: () => void; onImport: () => void; onExport: () => void; isExporting: boolean; onInsertChild: () => void; onInsertSibling: () => void; onRelationship: () => void; onBoundary: () => void; relationshipPending: boolean; onOpenFiles: () => void; onRedo: () => void; onSave: () => void; onSummary: () => void; onTopicDetails: (section: "notes" | "links" | "labels") => void; onTitleChange: (value: string) => void; onTitleCommit: () => void; onToggleFormat: () => void; onToggleMarkers: () => void; onToolChange: (tool: FlowBoardToolId) => void; onUndo: () => void; siteLogo: string | null; siteName: string; }) { return (
{siteLogo ? ( {siteName} ) : ( siteName.slice(0, 1).toUpperCase() )}
{siteName}
onTitleChange(event.currentTarget.value)} onKeyDown={(event) => { if (event.key === "Enter") { event.currentTarget.blur(); } }} value={currentTitle} />
{isSaving ? "正在保存" : "已保存"}
); } export function XmindFormatPanel({ activeLayoutId, activeThemeId, branchColor, branchShape, branchWidth, canvasBackgroundColor, canvasGridColor, canvasGridEnabled, canvasGridSize, fontSize, isBold, isItalic, isUnderlined, layouts, nodeFill, nodeShape, onBranchColorChange, onBranchShapeChange, onBranchWidthChange, onCanvasBackgroundColorChange, onCanvasGridColorChange, onCanvasGridEnabledChange, onCanvasGridSizeChange, onClose, onFontSizeChange, onLayoutChange, onNodeFillChange, onNodeShapeChange, onTextColorChange, onThemeChange, onToggleTextMark, selectedCount, textColor, themes, }: { activeLayoutId: string; activeThemeId: string; branchColor: string; branchShape: "bight" | "polyline"; branchWidth: number; canvasBackgroundColor: string; canvasGridColor: string; canvasGridEnabled: boolean; canvasGridSize: number; fontSize: string; isBold: boolean; isItalic: boolean; isUnderlined: boolean; layouts: FlowBoardLayoutOption[]; nodeFill: string; nodeShape: "round-rectangle" | "underline"; onBranchColorChange: (value: string) => void; onBranchShapeChange: (value: "bight" | "polyline") => void; onBranchWidthChange: (value: number) => void; onCanvasBackgroundColorChange: (value: string) => void; onCanvasGridColorChange: (value: string) => void; onCanvasGridEnabledChange: (value: boolean) => void; onCanvasGridSizeChange: (value: number) => void; onClose: () => void; onFontSizeChange: (value: string) => void; onLayoutChange: (value: string) => void; onNodeFillChange: (value: string) => void; onNodeShapeChange: (value: "round-rectangle" | "underline") => void; onTextColorChange: (value: string) => void; onThemeChange: (value: string) => void; onToggleTextMark: (mark: "bold" | "italic" | "underlined") => void; selectedCount: number; textColor: string; themes: FlowBoardThemeOption[]; }) { const [activePanel, setActivePanel] = useState<"format" | "canvas">( "format" ); const backgroundPresets = [ "#ffffff", "#f7f8fb", "#f1f5f9", "#fff8e7", "#eef8f1", "#f5f0ff", ]; return ( ); } export function XmindSheetBar({ outlineOpen, onToggleOutline, activeSheetId, formatPanelOpen, onAddSheet, onDeleteSheet, onDuplicateSheet, onFit, onRenameSheet, onSwitchSheet, onZoomIn, onZoomOut, sheets, zoomPercent, }: { outlineOpen: boolean; onToggleOutline: () => void; activeSheetId: string; formatPanelOpen: boolean; onAddSheet: () => void; onDeleteSheet: (id: string) => void; onDuplicateSheet: (id: string) => void; onFit: () => void; onRenameSheet: (id: string, title: string) => void; onSwitchSheet: (id: string) => void; onZoomIn: () => void; onZoomOut: () => void; sheets: FlowBoardSheetTab[]; zoomPercent: number; }) { const [renamingSheetId, setRenamingSheetId] = useState(null); const [renameDraft, setRenameDraft] = useState(""); const activeSheet = sheets.find((sheet) => sheet.id === activeSheetId); const commitRename = () => { if (!renamingSheetId) { return; } const nextTitle = renameDraft.trim(); if (nextTitle) { onRenameSheet(renamingSheetId, nextTitle); } setRenamingSheetId(null); setRenameDraft(""); }; return ( ); }