"use client"; import { useState } from "react"; import clsx from "clsx"; export function JsonView({ value, collapsed = false, className, maxHeight = "20rem" }: { value: unknown; collapsed?: boolean; className?: string; maxHeight?: string }) { const [open, setOpen] = useState(!collapsed); if (value === null || value === undefined) return —; const text = typeof value === "string" ? value : JSON.stringify(value, null, 2); const short = text.length > 80 ? text.slice(0, 80) + "…" : text; if (!open) return ( ); return (
{text}
{collapsed && (
)}