diff --git a/app/src/api.js b/app/src/api.js index 8056f70..3d75ab5 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -30,6 +30,7 @@ export const api = { http('POST', `/api/tasks/${taskId}/decide`, { action, reason, merge }), createTask: (pid, body) => http('POST', `/api/projects/${pid}/tasks`, body), patchProject: (pid, body) => http('PATCH', `/api/projects/${pid}`, body), + createProject: (body) => http('POST', '/api/projects', body), }; // WS 单向订阅:连上后服务端推送 events 表记录。断线自动重连(指数退避,封顶 10s)。 diff --git a/app/src/app.jsx b/app/src/app.jsx index ebfac06..16f736e 100644 --- a/app/src/app.jsx +++ b/app/src/app.jsx @@ -11,6 +11,43 @@ const { Toast } = window.MaestroDesignSystem_a6a290; const USER = { name: 'local', handle: '@local', plan: 'Claude Code', initial: 'L', hue: 200 }; +// 新建项目模态(design 无现成 surface,用 DS 组件就地拼装)。标签 zh/en 自含。 +function NewProjectModal({ t, lang, onCreate, onClose }) { + const { Button, Input, Select } = window.MaestroDesignSystem_a6a290; + const L = lang === 'zh' + ? { title: '新建项目', name: '项目名', repo: '仓库路径', branch: '默认分支', mode: '工作模式', namePh: 'my-app', repoPh: '/Users/you/code/my-app', create: '创建' } + : { title: 'New project', name: 'Name', repo: 'Repo path', branch: 'Default branch', mode: 'Mode', namePh: 'my-app', repoPh: '/Users/you/code/my-app', create: 'Create' }; + const [name, setName] = React.useState(''); + const [repoPath, setRepoPath] = React.useState(''); + const [defaultBranch, setDefaultBranch] = React.useState('main'); + const [autonomy, setAutonomy] = React.useState('manual'); + const submit = (e) => { + e.preventDefault(); + if (!name.trim() || !repoPath.trim()) return; + onCreate({ name: name.trim(), repoPath: repoPath.trim(), defaultBranch: defaultBranch.trim() || 'main', autonomy }); + }; + return ( +
+
+
+
▍ {L.title}
+
+ + +
+ + +
- ({ value: tk.id, label: tk.title }))]} /> + - + - - + + +
{t.lastSync}