/** * ProjectSelectModal * * Shown when the user first enters Coding Mode (or clicks "Switch Project"). * Four tabs: * 1. Default Workspace – use the agent's default workspace_dir * 2. Clone Repository – git clone a public URL with SSE progress * 3. Open Local Path – enter an absolute path * 4. New Project – create an empty dir + git init */ import { useState, useRef, useEffect } from "react"; import { Modal, Tabs, Input, Button, Alert, List } from "antd"; import { ChevronRight, Eye, EyeOff, Folder, FolderOpen, FolderSymlink, GitBranch, HardDrive, Home, PlusCircle, RotateCcw, X, } from "lucide-react"; import { useTranslation } from "react-i18next"; import { projectDirectoryApi, type BrowseDirsResponse, type ProjectListItem, } from "../../api/modules/projectDirectory"; import { useProjectDir } from "../../stores/projectDirectoryStore"; import styles from "./index.module.less"; interface ProjectSelectModalProps { open: boolean; onClose: () => void; onConfirm: (path: string | null) => void; } // --------------------------------------------------------------------------- // Clone progress event // --------------------------------------------------------------------------- interface CloneEvent { type: "log" | "done" | "error"; line?: string; path?: string; name?: string; detail?: string; } // --------------------------------------------------------------------------- // Tab: Workspace // --------------------------------------------------------------------------- function WorkspaceTab({ workspaceDir, onSelect, }: { workspaceDir: string | null; onSelect: (path: null) => void; }) { const { t } = useTranslation(); return (
{workspaceDir}
{t("codingMode.selectProjectDesc")}