import { useEffect, useState } from 'react'; import { Check, Sparkles, Undo2, X } from 'lucide-react'; import { CATEGORY_LABEL, SCOPE_LABEL, STATUS_LABEL, SUGGESTION_LABEL, type Entry, type Scope } from '../types'; export function EntryCard({ entry, selected, busy, onToggle, onReview, onSuggest }: { entry: Entry; selected: boolean; busy: boolean; onToggle: () => void; onReview: (action: 'verify' | 'reject' | 'reset', value?: string, scope?: Scope) => void; onSuggest: () => void; }) { const [editing, setEditing] = useState(false); const [value, setValue] = useState(entry.value); const [scope, setScope] = useState(entry.scope); useEffect(() => { setValue(entry.value); setScope(entry.scope); }, [entry.id, entry.value, entry.scope]); const schools = (entry.schools ?? '').split(',').filter(Boolean); const changed = value.trim() !== entry.value.trim(); return (
{entry.key} {CATEGORY_LABEL[entry.category] ?? entry.category} {STATUS_LABEL[entry.status]} {entry.suggestion && ( {SUGGESTION_LABEL[entry.suggestion]} )} {(entry.confirmed > 0 || entry.contradicted > 0) && ( 0 ? 'sug-reject' : 'sug-adopt'}`} title="Agent 在真实页面上验证的结果,比观察次数硬"> 实测 {entry.confirmed} 相符{entry.contradicted > 0 ? ` / ${entry.contradicted} 不符` : ''} )} {entry.school_count} 校 · 观察 {entry.observations} {entry.status !== 'draft' && ` · ${SCOPE_LABEL[entry.scope]}`}
{editing ? (