'use client'; import { RequirementStatus } from '@ftb/shared'; import { RequirementStatusBadge } from './RequirementStatusBadge'; import { PRIORITY_LABEL, REQUIREMENT_STATUS_LABEL } from '@/lib/constants'; interface RequirementItem { id: string; title: string; description: string; status: RequirementStatus; priority: number; creator?: { id: string; name: string }; createdAt: string; } interface Props { requirements: RequirementItem[]; statusFilter: RequirementStatus | null; onFilterChange: (status: RequirementStatus | null) => void; onEdit: (req: RequirementItem) => void; onStatusChange: (id: string, status: RequirementStatus) => void; onDelete: (id: string) => void; onCreate: () => void; } const ALL_STATUSES = Object.values(RequirementStatus); export function RequirementTable({ requirements, statusFilter, onFilterChange, onEdit, onStatusChange, onDelete, onCreate, }: Props) { return (
{ALL_STATUSES.map((s) => ( ))}
{requirements.length === 0 ? (
暂无需求
) : ( {requirements.map((req) => ( ))}
标题 状态 优先级 创建者 操作
{req.title} {PRIORITY_LABEL[req.priority] || '无'} {req.creator?.name || '-'}
)}
); }