auto-sync: 2026-05-17 06:35:53
This commit is contained in:
@@ -6,6 +6,7 @@ import * as api from '../api';
|
||||
|
||||
export function Config() {
|
||||
const { projects, loading, refresh } = useProjects();
|
||||
const [newId, setNewId] = useState('');
|
||||
const [newName, setNewName] = useState('');
|
||||
const [newDesc, setNewDesc] = useState('');
|
||||
const [creating, setCreating] = useState(false);
|
||||
@@ -16,7 +17,8 @@ export function Config() {
|
||||
try {
|
||||
setCreating(true);
|
||||
setError(null);
|
||||
await api.createProject({ name: newName, description: newDesc || null });
|
||||
await api.createProject({ id: newId || undefined, name: newName, description: newDesc || null });
|
||||
setNewId('');
|
||||
setNewName('');
|
||||
setNewDesc('');
|
||||
refresh();
|
||||
@@ -35,6 +37,20 @@ export function Config() {
|
||||
<div className="card" style={{ marginBottom: 20 }}>
|
||||
<div className="card-title">创建项目</div>
|
||||
<div style={{ display: 'flex', gap: 8, marginTop: 8 }}>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="项目ID(可选,自动生成)"
|
||||
value={newId}
|
||||
onChange={e => setNewId(e.target.value)}
|
||||
style={{
|
||||
width: 200,
|
||||
padding: '6px 10px',
|
||||
borderRadius: 'var(--radius)',
|
||||
border: '1px solid var(--line)',
|
||||
background: 'var(--bg)',
|
||||
color: 'var(--fg)',
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="项目名称"
|
||||
@@ -67,6 +83,7 @@ export function Config() {
|
||||
className="btn btn-primary"
|
||||
onClick={handleCreate}
|
||||
disabled={creating || !newName.trim()}
|
||||
style={{ minWidth: 60 }}
|
||||
>
|
||||
{creating ? '创建中...' : '创建'}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user