"use client"; import { use, useState } from "react"; import Link from "next/link"; import { Pencil } from "lucide-react"; import { AppShell } from "@/components/app-shell"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; import { usePrecedent } from "@/lib/api/precedent-library"; import { PrecedentEditSheet } from "@/components/precedents/precedent-edit-sheet"; import { ExtractedHalachotSection } from "@/components/precedents/extracted-halachot"; import { RelatedCasesSection } from "@/components/precedents/link-related-dialog"; const PRACTICE_AREA_LABELS: Record = { rishuy_uvniya: "רישוי ובנייה", betterment_levy: "היטל השבחה", compensation_197: "פיצויים (197)", }; const SOURCE_TYPE_LABELS: Record = { court_ruling: "פסק דין", appeals_committee: "ועדת ערר", }; /* Next 16 breaking change: route params are now a Promise. * The `use()` hook unwraps them inside a client component. */ export default function PrecedentDetailPage({ params, }: { params: Promise<{ id: string }>; }) { const { id } = use(params); const [editing, setEditing] = useState(false); const { data, isPending, error } = usePrecedent(id); return (
{error ? (

שגיאה בטעינת הפסיקה

{error.message}

) : isPending || !data ? (
{[...Array(5)].map((_, i) => )}
) : ( <>

{data.case_name || "—"}

{data.case_number}
{data.practice_area ? ( {PRACTICE_AREA_LABELS[data.practice_area] ?? data.practice_area} ) : null} {data.source_type ? ( {SOURCE_TYPE_LABELS[data.source_type] ?? data.source_type} ) : null} {data.precedent_level ? ( {data.precedent_level} ) : null} {data.is_binding ? ( הלכה מחייבת ) : null} {data.court ? ( {data.court} ) : null} {data.date ? ( {data.date.slice(0, 10)} ) : null}
{data.headnote ? (

Headnote

{data.headnote}

) : null} {data.summary ? (

תקציר

{data.summary}

) : null} {(data as { key_quote?: string }).key_quote ? (

ציטוט מרכזי

{(data as { key_quote?: string }).key_quote}
) : null} {data.subject_tags?.length ? (
{data.subject_tags.map((t) => ( {t} ))}
) : null}
)} setEditing(open)} />
); }