Moves routes inside an _app for the header and builds a print route

This commit is contained in:
2025-06-01 12:34:02 -07:00
parent 9cfdfbaf23
commit bef5e98480
21 changed files with 527 additions and 211 deletions

View File

@@ -0,0 +1,64 @@
// DocumentRow.tsx
// Generic row component for displaying any document type.
import {
isLocation,
isMonster,
isNpc,
isScene,
isSecret,
isSession,
isTreasure,
type Document,
} from "@/lib/types";
import { LocationPrintRow } from "./location/LocationPrintRow";
import { MonsterPrintRow } from "./monsters/MonsterPrintRow";
import { TreasurePrintRow } from "./treasure/TreasurePrintRow";
import { SecretPrintRow } from "./secret/SecretPrintRow";
import { NpcPrintRow } from "./npc/NpcPrintRow";
import { ScenePrintRow } from "./scene/ScenePrintRow";
import { SessionPrintRow } from "./session/SessionPrintRow";
/**
* 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 DocumentPrintRow = ({ document }: { document: Document }) => {
if (isLocation(document)) {
return <LocationPrintRow location={document} />;
}
if (isMonster(document)) {
return <MonsterPrintRow monster={document} />;
}
if (isNpc(document)) {
return <NpcPrintRow npc={document} />;
}
if (isSession(document)) {
return <SessionPrintRow session={document} />;
}
if (isSecret(document)) {
return <SecretPrintRow secret={document} />;
}
if (isScene(document)) {
return <ScenePrintRow scene={document} />;
}
if (isTreasure(document)) {
return <TreasurePrintRow treasure={document} />;
}
// Fallback: show ID and creation time
return (
<div>
<div className="font-semibold text-lg text-slate-300">
Unrecognized Document
</div>
<div className="text-slate-400 text-sm">ID: {document.id}</div>
<div className="text-slate-400 text-sm">Created: {document.created}</div>
</div>
);
};