ui(missing-precedents): drawer = notes + upload only
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m21s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m21s
The drawer was showing a full metadata form (legal topic, case name,
legal issue, cited-by-party + name, status) — most of it duplicated
fields that get auto-extracted from the file once it's uploaded, or
that are already known from when the row was detected. The visible
placeholder text ('לינדאב בע"מ', 'אנטרים', 'זכות עמידה') looked like
real data and confused readers.
Strip the form down to a single "הערות" textarea — that's the only
field the chair actually needs to edit. Reasons for who cited the
decision and in what context belong there too. Everything else (shape
of the precedent on the case_law side) is the LLM extractor's job.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,10 +19,7 @@ import {
|
||||
useMissingPrecedent,
|
||||
useUpdateMissingPrecedent,
|
||||
useUploadMissingPrecedent,
|
||||
CITED_BY_PARTY_LABELS,
|
||||
STATUS_LABELS,
|
||||
type CitedByParty,
|
||||
type MissingPrecedentStatus,
|
||||
type MissingPrecedentPatch,
|
||||
} from "@/lib/api/missing-precedents";
|
||||
import {
|
||||
@@ -47,14 +44,13 @@ export function MissingPrecedentDetailDrawer({ id, onOpenChange }: Props) {
|
||||
const update = useUpdateMissingPrecedent();
|
||||
const upload = useUploadMissingPrecedent();
|
||||
|
||||
// Edit form for metadata.
|
||||
const [legalTopic, setLegalTopic] = useState("");
|
||||
const [legalIssue, setLegalIssue] = useState("");
|
||||
const [cityParty, setCitedByParty] = useState<CitedByParty>("unknown");
|
||||
const [citedByPartyName, setCitedByPartyName] = useState("");
|
||||
const [caseName, setCaseName] = useState("");
|
||||
// The only chair-editable field on the missing-precedent is `notes` —
|
||||
// free-text. Everything else (citation, who-cited-whom, status) is set
|
||||
// when the row was detected, and updates automatically when the file
|
||||
// is uploaded. The metadata of the *uploaded* precedent (case_name,
|
||||
// chair, district, …) is auto-extracted by the LLM and lives on the
|
||||
// case_law row, not here.
|
||||
const [notes, setNotes] = useState("");
|
||||
const [status, setStatus] = useState<MissingPrecedentStatus>("open");
|
||||
|
||||
// Upload form fields.
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
@@ -72,13 +68,7 @@ export function MissingPrecedentDetailDrawer({ id, onOpenChange }: Props) {
|
||||
const [syncedId, setSyncedId] = useState<string | null>(null);
|
||||
if (mp && mp.id !== syncedId) {
|
||||
setSyncedId(mp.id);
|
||||
setLegalTopic(mp.legal_topic ?? "");
|
||||
setLegalIssue(mp.legal_issue ?? "");
|
||||
setCitedByParty(mp.cited_by_party ?? "unknown");
|
||||
setCitedByPartyName(mp.cited_by_party_name ?? "");
|
||||
setCaseName(mp.case_name ?? "");
|
||||
setNotes(mp.notes ?? "");
|
||||
setStatus(mp.status);
|
||||
}
|
||||
|
||||
// Reset on close. The cascading-render warning is the intended side
|
||||
@@ -93,22 +83,14 @@ export function MissingPrecedentDetailDrawer({ id, onOpenChange }: Props) {
|
||||
setDistrict(""); setCommitteeCaseNumber(""); setSummary("");
|
||||
}, [open]);
|
||||
|
||||
const handleSaveMetadata = async () => {
|
||||
const handleSaveNotes = async () => {
|
||||
if (!mp) return;
|
||||
const patch: MissingPrecedentPatch = {
|
||||
legal_topic: legalTopic,
|
||||
legal_issue: legalIssue,
|
||||
cited_by_party: cityParty,
|
||||
cited_by_party_name: citedByPartyName,
|
||||
case_name: caseName,
|
||||
notes,
|
||||
status,
|
||||
};
|
||||
const patch: MissingPrecedentPatch = { notes };
|
||||
try {
|
||||
await update.mutateAsync({ id: mp.id, patch });
|
||||
toast.success("הרשומה עודכנה");
|
||||
toast.success("הערות נשמרו");
|
||||
} catch (e) {
|
||||
toast.error("העדכון נכשל");
|
||||
toast.error("שמירה נכשלה");
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
@@ -128,7 +110,6 @@ export function MissingPrecedentDetailDrawer({ id, onOpenChange }: Props) {
|
||||
case_number: isCommittee ? committeeCaseNumber || undefined : undefined,
|
||||
chair_name: isCommittee ? chairName || undefined : undefined,
|
||||
district: isCommittee ? district || undefined : undefined,
|
||||
case_name: caseName || undefined,
|
||||
court: court || undefined,
|
||||
decision_date: decisionDate || undefined,
|
||||
practice_area: practiceArea || undefined,
|
||||
@@ -216,110 +197,29 @@ export function MissingPrecedentDetailDrawer({ id, onOpenChange }: Props) {
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
{/* ── Editable metadata ── */}
|
||||
<section className="space-y-3">
|
||||
<h3 className="text-sm font-semibold text-navy">מטא־דאטה</h3>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<Label htmlFor="legal_topic">נושא משפטי</Label>
|
||||
<Input
|
||||
id="legal_topic"
|
||||
value={legalTopic}
|
||||
onChange={(e) => setLegalTopic(e.target.value)}
|
||||
placeholder="זכות עמידה"
|
||||
dir="rtl"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="case_name">שם פסיקה</Label>
|
||||
<Input
|
||||
id="case_name"
|
||||
value={caseName}
|
||||
onChange={(e) => setCaseName(e.target.value)}
|
||||
placeholder="אנטרים"
|
||||
dir="rtl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="legal_issue">שאלה משפטית</Label>
|
||||
<Textarea
|
||||
id="legal_issue"
|
||||
value={legalIssue}
|
||||
onChange={(e) => setLegalIssue(e.target.value)}
|
||||
rows={2}
|
||||
dir="rtl"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<Label htmlFor="cited_by_party">צד מצטט</Label>
|
||||
<Select
|
||||
value={cityParty}
|
||||
onValueChange={(v) => setCitedByParty(v as CitedByParty)}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{(Object.entries(CITED_BY_PARTY_LABELS) as [CitedByParty, string][]).map(
|
||||
([v, label]) => (
|
||||
<SelectItem key={v} value={v}>{label}</SelectItem>
|
||||
),
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="cited_by_party_name">שם צד</Label>
|
||||
<Input
|
||||
id="cited_by_party_name"
|
||||
value={citedByPartyName}
|
||||
onChange={(e) => setCitedByPartyName(e.target.value)}
|
||||
placeholder="לינדאב בע״מ"
|
||||
dir="rtl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="status">סטטוס</Label>
|
||||
<Select
|
||||
value={status}
|
||||
onValueChange={(v) => setStatus(v as MissingPrecedentStatus)}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{(Object.entries(STATUS_LABELS) as [
|
||||
MissingPrecedentStatus,
|
||||
string,
|
||||
][]).map(([v, label]) => (
|
||||
<SelectItem key={v} value={v}>{label}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="notes">הערות</Label>
|
||||
<Textarea
|
||||
id="notes"
|
||||
value={notes}
|
||||
onChange={(e) => setNotes(e.target.value)}
|
||||
rows={2}
|
||||
dir="rtl"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ── Notes (only chair-editable field; everything else is
|
||||
auto-detected or auto-extracted from the file). ── */}
|
||||
<section className="space-y-2">
|
||||
<Label htmlFor="notes" className="text-sm font-semibold text-navy">
|
||||
הערות
|
||||
</Label>
|
||||
<p className="text-[0.72rem] text-ink-muted leading-relaxed">
|
||||
שדה חופשי — לדוגמה: מי מצטט (הוועדה / העורר / המשיב) ובאיזה הקשר.
|
||||
שאר השדות (שם, ערכאה, יו״ר, מחוז, תאריך, תת־סוג, תקציר) יחולצו
|
||||
אוטומטית מהקובץ בעת ההעלאה.
|
||||
</p>
|
||||
<Textarea
|
||||
id="notes"
|
||||
value={notes}
|
||||
onChange={(e) => setNotes(e.target.value)}
|
||||
rows={3}
|
||||
dir="rtl"
|
||||
/>
|
||||
<Button
|
||||
onClick={handleSaveMetadata}
|
||||
onClick={handleSaveNotes}
|
||||
disabled={update.isPending}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="border-rule"
|
||||
>
|
||||
{update.isPending ? (
|
||||
@@ -327,7 +227,7 @@ export function MissingPrecedentDetailDrawer({ id, onOpenChange }: Props) {
|
||||
) : (
|
||||
<Save className="w-4 h-4 me-1" />
|
||||
)}
|
||||
שמור פרטים
|
||||
שמור הערות
|
||||
</Button>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user