'use client'; import { memo } from 'react'; import { TestCaseStatusBadge } from './TestCaseStatusBadge'; import { getTestCaseActualHours, getTestCaseEstimateHours } from '@/lib/test-case'; import { formatWorkHours } from '@/lib/work-hours'; import { CategoryChip } from '@/components/dev-task/CategoryChip'; import type { TestCase } from '@/lib/test-case'; import type { TaskCategory } from '@/lib/task-category'; interface Props { testCase: TestCase; category?: TaskCategory; bugCount: number; onClick?: () => void; } const PRIORITY_DOT: Record = { P0: 'bg-red-500', P1: 'bg-orange-400', P2: 'bg-blue-400', P3: 'bg-zinc-300', }; function TestCaseRowImpl({ testCase, category, bugCount, onClick }: Props) { const estimateHours = getTestCaseEstimateHours(testCase); const actualHours = getTestCaseActualHours(testCase); return (
{testCase.caseNo}
{testCase.title} {testCase.aiDraft && ( AI 草案 )}
{actualHours > 0 ? `${formatWorkHours(actualHours)} / ${formatWorkHours(estimateHours)}` : `预 ${formatWorkHours(estimateHours)}`} {bugCount > 0 && ( {bugCount} Bug )} {testCase.assigneeId || '-'}
); } export const TestCaseRow = memo(TestCaseRowImpl);