// DocumentRow.tsx // Generic row component for displaying any document type. import { SecretToggleRow } from "@/components/documents/secret/SecretToggleRow"; import { isLocation, isMonster, isNpc, isScene, isSecret, isSession, isTreasure, type Document, type Session, } from "@/lib/types"; import { BasicRow } from "./BasicRow"; import { TreasureToggleRow } from "./treasure/TreasureToggleRow"; /** * Renders a row for any document type. Prioritizes Session, then Secret, then falls back to ID and creation time. * If rendering a SecretRow, uses the provided session prop if available. */ export const DocumentRow = ({ document, session, }: { document: Document; session?: Session; }) => { if (isLocation(document)) { return ( ); } if (isMonster(document)) { return ; } if (isNpc(document)) { return ( ); } if (isSession(document)) { return ( ); } if (isSecret(document)) { return ; } if (isScene(document)) { return ; } if (isTreasure(document)) { return ; } // Fallback: show ID and creation time return (
Unrecognized Document
ID: {document.id}
Created: {document.created}
); };