| 1 | import { useState } from "react"; |
| 2 | |
| 3 | interface UnknownCardProps { |
| 4 | at: string | null; |
| 5 | rawType: string; |
| 6 | raw: unknown; |
| 7 | } |
| 8 | |
| 9 | export function UnknownCard({ at, rawType, raw }: UnknownCardProps) { |
| 10 | const [expanded, setExpanded] = useState(false); |
| 11 | return ( |
| 12 | <div className="rounded border border-yellow-900/40 bg-yellow-950/10 px-4 py-2 text-[12px]"> |
| 13 | <button |
| 14 | type="button" |
| 15 | onClick={() => setExpanded((x) => !x)} |
| 16 | className="flex w-full items-center gap-2 text-left" |
| 17 | > |
| 18 | <span className="text-yellow-300">⚠</span> |
| 19 | <span className="text-[10px] uppercase tracking-wide text-fg-3"> |
| 20 | unknown: {rawType} |
| 21 | </span> |
| 22 | {at && <span className="text-[10px] text-fg-3">• {at}</span>} |
| 23 | <span className="ml-auto text-[10px] text-fg-3"> |
| 24 | {expanded ? "hide" : "show"} |
| 25 | </span> |
| 26 | </button> |
| 27 | {expanded && ( |
| 28 | <pre className="mt-2 max-h-64 overflow-auto rounded border border-border bg-bg-2 p-2 font-mono text-[11px] text-fg-2"> |
| 29 | {JSON.stringify(raw, null, 2)} |
| 30 | </pre> |
| 31 | )} |
| 32 | </div> |
| 33 | ); |
| 34 | } |