auto-sync: 2026-05-21 00:15:19
This commit is contained in:
@@ -645,23 +645,25 @@ function NewProjectDialog({ onSubmit, onClose }: {
|
||||
onSubmit: (id: string, name: string) => void;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const [id, setId] = useState('');
|
||||
const [name, setName] = useState('');
|
||||
const handleSubmit = () => {
|
||||
if (!name.trim()) return;
|
||||
// ID 自动生成:project-{yyyyMMddHHmmss}
|
||||
const now = new Date();
|
||||
const id = `project-${now.getFullYear()}${String(now.getMonth()+1).padStart(2,'0')}${String(now.getDate()).padStart(2,'0')}${String(now.getHours()).padStart(2,'0')}${String(now.getMinutes()).padStart(2,'0')}${String(now.getSeconds()).padStart(2,'0')}`;
|
||||
onSubmit(id, name.trim());
|
||||
};
|
||||
return (
|
||||
<div style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.5)', display: 'flex', alignItems: 'center', justifyContent: 'center', zIndex: 1000 }} onClick={onClose}>
|
||||
<div style={{ background: '#1a2236', border: '1px solid var(--line)', borderRadius: 12, padding: 24, minWidth: 360 }} onClick={e => e.stopPropagation()}>
|
||||
<div style={{ fontSize: 14, fontWeight: 600, marginBottom: 16 }}>➕ 新建项目</div>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<label style={{ fontSize: 11, color: 'var(--muted)', display: 'block', marginBottom: 4 }}>项目 ID(英文,不可修改)</label>
|
||||
<input value={id} onChange={e => setId(e.target.value.replace(/[^a-zA-Z0-9_-]/g, ''))} placeholder="my-project" style={{ width: '100%', padding: '6px 10px', borderRadius: 6, border: '1px solid var(--line)', background: 'var(--panel)', color: 'var(--fg)', fontSize: 12, boxSizing: 'border-box' }} />
|
||||
</div>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<label style={{ fontSize: 11, color: 'var(--muted)', display: 'block', marginBottom: 4 }}>项目名称</label>
|
||||
<input value={name} onChange={e => setName(e.target.value)} placeholder="我的项目" style={{ width: '100%', padding: '6px 10px', borderRadius: 6, border: '1px solid var(--line)', background: 'var(--panel)', color: 'var(--fg)', fontSize: 12, boxSizing: 'border-box' }} />
|
||||
<input value={name} onChange={e => setName(e.target.value)} placeholder="输入项目名称" style={{ width: '100%', padding: '6px 10px', borderRadius: 6, border: '1px solid var(--line)', background: 'var(--panel)', color: 'var(--fg)', fontSize: 12, boxSizing: 'border-box' }} />
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end' }}>
|
||||
<button onClick={onClose} style={{ padding: '6px 16px', borderRadius: 6, fontSize: 12, border: '1px solid var(--line)', background: 'var(--panel)', color: 'var(--fg)', cursor: 'pointer' }}>取消</button>
|
||||
<button disabled={!id || !name} onClick={() => onSubmit(id, name)} style={{ padding: '6px 16px', borderRadius: 6, fontSize: 12, border: 'none', background: 'var(--acc)', color: '#fff', cursor: id && name ? 'pointer' : 'not-allowed', opacity: id && name ? 1 : 0.5 }}>创建</button>
|
||||
<button disabled={!name.trim()} onClick={handleSubmit} style={{ padding: '6px 16px', borderRadius: 6, fontSize: 12, border: 'none', background: 'var(--acc)', color: '#fff', cursor: name.trim() ? 'pointer' : 'not-allowed', opacity: name.trim() ? 1 : 0.5 }}>创建</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -197,7 +197,7 @@ function SubtaskPanel({ taskId, stagesJson }: { taskId: string; stagesJson?: str
|
||||
return () => { mounted = false; };
|
||||
}, [taskId]);
|
||||
|
||||
if (subtasks.length === 0 && !progress) return null;
|
||||
if (subtasks.length === 0 && !progress?.total_subtasks) return null;
|
||||
|
||||
const stages = progress?.stages || [];
|
||||
const total = progress?.total_subtasks || subtasks.length;
|
||||
|
||||
Reference in New Issue
Block a user