feat: 实现产品/项目/版本三大模块完整功能
- 产品列表:拖拽排序持久化、编辑弹窗、删除校验(活跃版本需迁移) - 项目列表:新建项目表单(产品选择+重名校验)、产品筛选、版本归属修复 - 版本列表:新建版本表单(迭代类型自动生成版本号)、状态/项目筛选、倒序排列 - 项目详情页:概览统计、人员墙(参与次数)、版本时间线(阶段流水线+进度条) - 全局优化:筛选栏统一为header下方固定行、按钮颜色改为主题蓝、API探测300ms、store缓存 - 数据持久化到localStorage,支持离线开发 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,18 +4,24 @@ import { useState } from 'react';
|
||||
|
||||
interface Props {
|
||||
initialData?: { name: string; description: string };
|
||||
onSubmit: (data: { name: string; description: string }) => void;
|
||||
onSubmit: (data: { name: string; description: string }) => void | Promise<void>;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
export function ProductForm({ initialData, onSubmit, onCancel }: Props) {
|
||||
const [name, setName] = useState(initialData?.name || '');
|
||||
const [description, setDescription] = useState(initialData?.description || '');
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim()) return;
|
||||
onSubmit({ name: name.trim(), description: description.trim() });
|
||||
if (!name.trim() || submitting) return;
|
||||
setSubmitting(true);
|
||||
try {
|
||||
await onSubmit({ name: name.trim(), description: description.trim() });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -48,15 +54,17 @@ export function ProductForm({ initialData, onSubmit, onCancel }: Props) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={onCancel}
|
||||
className="h-8 rounded-lg border border-[var(--line)] bg-[var(--bg-card)] px-3 text-[13px] text-[var(--ink-soft)] hover:bg-[var(--bg-subtle)] hover:text-[var(--ink)]"
|
||||
disabled={submitting}
|
||||
className="h-8 rounded-lg border border-[var(--line)] bg-[var(--bg-card)] px-3 text-[13px] text-[var(--ink-soft)] hover:bg-[var(--bg-subtle)] hover:text-[var(--ink)] disabled:opacity-50"
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="h-8 rounded-lg bg-[var(--accent)] px-4 text-[13px] font-medium text-white shadow-[var(--shadow-sm)] hover:bg-[var(--accent-hover)]"
|
||||
disabled={submitting || !name.trim()}
|
||||
className="h-8 rounded-lg bg-[var(--accent)] px-4 text-[13px] font-medium text-white shadow-[var(--shadow-sm)] hover:bg-[var(--accent-hover)] disabled:opacity-50"
|
||||
>
|
||||
{initialData ? '保存' : '创建'}
|
||||
{submitting ? '提交中…' : initialData ? '保存' : '创建'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -52,7 +52,7 @@ export function RequirementForm({ initialData, onSubmit, onCancel }: Props) {
|
||||
onClick={() => setPriority(v)}
|
||||
className={`h-7 rounded-md px-2.5 text-[12.5px] transition-colors ${
|
||||
active
|
||||
? 'bg-[var(--ink)] text-white'
|
||||
? 'bg-[var(--accent)] text-white'
|
||||
: 'border border-[var(--line)] bg-[var(--bg-card)] text-[var(--ink-soft)] hover:border-[var(--ink-muted)] hover:text-[var(--ink)]'
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -126,7 +126,7 @@ function FilterChip({
|
||||
onClick={onClick}
|
||||
className={`h-7 rounded-md px-2.5 text-[12.5px] transition-colors ${
|
||||
active
|
||||
? 'bg-[var(--ink)] text-white'
|
||||
? 'bg-[var(--accent)] text-white'
|
||||
: 'border border-[var(--line)] bg-[var(--bg-card)] text-[var(--ink-soft)] hover:border-[var(--ink-muted)] hover:text-[var(--ink)]'
|
||||
}`}
|
||||
>
|
||||
|
||||
17
apps/web/components/version/VersionChip.tsx
Normal file
17
apps/web/components/version/VersionChip.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
'use client';
|
||||
|
||||
import { VersionStatus, VERSION_STATUS_BG, VERSION_STATUS_DOT } from '@/lib/version-status';
|
||||
|
||||
interface Props {
|
||||
name: string;
|
||||
status: VersionStatus;
|
||||
}
|
||||
|
||||
export function VersionChip({ name, status }: Props) {
|
||||
return (
|
||||
<span className={`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${VERSION_STATUS_BG[status]}`}>
|
||||
<span className={`h-1.5 w-1.5 rounded-full ${VERSION_STATUS_DOT[status]}`} />
|
||||
{name}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user