import { useState } from 'react'; import { CheckCircle2, ChevronRight, ExternalLink, ListTree, FileText, } from 'lucide-react'; import { cn } from '@/lib/utils'; import { buildIntranetSourceUrl } from '@/core/config'; import type { AIMaterial, CompletedIntervention } from '../../types/ai-writing'; import { OutlineCard } from './OutlineCard'; import { ReviewCard } from './ReviewCard'; import { CollapseTransition } from './CollapseTransition'; interface Props { record: CompletedIntervention; } export function CompletedInterventionCard({ record }: Props) { const [expanded, setExpanded] = useState(false); if (record.pausePoint === 'material_confirm') { return setExpanded(v => !v)} />; } if (record.pausePoint === 'outline_confirm') { return setExpanded(v => !v)} />; } if (record.pausePoint === 'draft_confirm') { return setExpanded(v => !v)} />; } if (record.pausePoint === 'review_confirm') { return setExpanded(v => !v)} />; } return null; } // ── 素材确认历史卡 ──────────────────────────────────────────────────────────── function MaterialCompleted({ record, expanded, onToggle }: { record: CompletedIntervention; expanded: boolean; onToggle: () => void }) { const count = record.materials?.length ?? 0; return (
0}>
{record.materials?.map((m) => ( ))}
); } function relevanceLabel(score: number): string { if (score >= 0.8) return '高相关'; if (score >= 0.5) return '中相关'; return '低相关'; } function CompletedMaterialItem({ material }: { material: AIMaterial }) { const [open, setOpen] = useState(false); const pct = Math.round(material.relevanceScore * 100); const barColor = material.relevanceScore >= 0.8 ? 'bg-green-500' : material.relevanceScore >= 0.5 ? 'bg-orange-400' : 'bg-red-400'; const hasDetail = !!material.content || !!material.recUuid; return (
{material.content && (

{material.content.slice(0, 300)} {material.content.length > 300 && '…'}

)} {material.recUuid && ( )}
); } // ── 大纲确认历史卡 ──────────────────────────────────────────────────────────── function OutlineCompleted({ record, expanded, onToggle }: { record: CompletedIntervention; expanded: boolean; onToggle: () => void }) { const sectionCount = record.outline?.sections.length ?? 0; return (
{record.outline && }
); } // ── 草稿确认历史卡 ──────────────────────────────────────────────────────────── function DraftCompleted({ record, expanded, onToggle }: { record: CompletedIntervention; expanded: boolean; onToggle: () => void }) { const title = record.draftTitle ? `《${record.draftTitle}》` : '草稿'; const wordCount = record.draftWordCount ?? 0; const hasReview = !!record.reviewResult; const actionLabel = record.action === 'finalize' ? '已确认定稿' : record.action === 'user_revise' ? '已要求修改' : '已提交编辑审核'; const actionColor = record.action === 'finalize' ? 'text-green-600 dark:text-green-400' : record.action === 'user_revise' ? 'text-orange-500 dark:text-orange-400' : 'text-blue-500 dark:text-blue-400'; return (
{record.reviewResult && }
); } // ── 编辑审核确认历史卡 ──────────────────────────────────────────────────────── function ReviewCompleted({ record, expanded, onToggle }: { record: CompletedIntervention; expanded: boolean; onToggle: () => void }) { const isForce = record.action === 'force_finalize'; const hasReview = !!record.reviewResult; const actionLabel = isForce ? '已强制定稿(忽略编辑意见)' : '已采纳编辑意见,重新写作'; const actionColor = isForce ? 'text-orange-500 dark:text-orange-400' : 'text-blue-500 dark:text-blue-400'; return (
{record.reviewResult && }
); }