diff --git a/src/components/documents/NewRelatedDocumentForm.tsx b/src/components/documents/NewRelatedDocumentForm.tsx index 86e952d..ff74595 100644 --- a/src/components/documents/NewRelatedDocumentForm.tsx +++ b/src/components/documents/NewRelatedDocumentForm.tsx @@ -1,10 +1,10 @@ import { RelationshipType, type CampaignId, type Document } from "@/lib/types"; -import { LocationForm } from "./location/LocationForm"; -import { MonsterForm } from "./monsters/MonsterForm"; -import { NpcForm } from "./npc/NpcForm"; -import { SceneForm } from "./scene/SceneForm"; -import { SecretForm } from "./secret/SecretForm"; -import { TreasureForm } from "./treasure/TreasureForm"; +import { NewLocationForm } from "./location/NewLocationForm"; +import { NewMonsterForm } from "./monsters/NewMonsterForm"; +import { NewNpcForm } from "./npc/NewNpcForm"; +import { NewSceneForm } from "./scene/NewSceneForm"; +import { NewSecretForm } from "./secret/NewSecretForm"; +import { NewTreasureForm } from "./treasure/NewTreasureForm"; function assertUnreachable(_x: never): never { throw new Error("DocumentForm switch is not exhaustive"); @@ -24,19 +24,19 @@ export const NewRelatedDocumentForm = ({ }) => { switch (relationshipType) { case RelationshipType.Locations: - return ; + return ; case RelationshipType.Monsters: - return ; + return ; case RelationshipType.Npcs: - return ; + return ; case RelationshipType.Secrets: - return ; + return ; + case RelationshipType.Treasures: + return ; + case RelationshipType.Scenes: + return ; case RelationshipType.DiscoveredIn: return "Form not supported here"; - case RelationshipType.Treasures: - return ; - case RelationshipType.Scenes: - return ; } return assertUnreachable(relationshipType); diff --git a/src/components/documents/location/LocationForm.tsx b/src/components/documents/location/NewLocationForm.tsx similarity index 98% rename from src/components/documents/location/LocationForm.tsx rename to src/components/documents/location/NewLocationForm.tsx index 7eed94b..641ec37 100644 --- a/src/components/documents/location/LocationForm.tsx +++ b/src/components/documents/location/NewLocationForm.tsx @@ -5,7 +5,7 @@ import { pb } from "@/lib/pocketbase"; /** * Renders a form to add a new location. Calls onCreate with the new location document. */ -export const LocationForm = ({ +export const NewLocationForm = ({ campaign, onCreate, }: { diff --git a/src/components/documents/monsters/MonsterForm.tsx b/src/components/documents/monsters/NewMonsterForm.tsx similarity index 98% rename from src/components/documents/monsters/MonsterForm.tsx rename to src/components/documents/monsters/NewMonsterForm.tsx index 93fc14d..66e83d1 100644 --- a/src/components/documents/monsters/MonsterForm.tsx +++ b/src/components/documents/monsters/NewMonsterForm.tsx @@ -5,7 +5,7 @@ import { pb } from "@/lib/pocketbase"; /** * Renders a form to add a new monster. Calls onCreate with the new monster document. */ -export const MonsterForm = ({ +export const NewMonsterForm = ({ campaign, onCreate, }: { diff --git a/src/components/documents/npc/NpcForm.tsx b/src/components/documents/npc/NewNpcForm.tsx similarity index 98% rename from src/components/documents/npc/NpcForm.tsx rename to src/components/documents/npc/NewNpcForm.tsx index 2f4454d..f70b59c 100644 --- a/src/components/documents/npc/NpcForm.tsx +++ b/src/components/documents/npc/NewNpcForm.tsx @@ -5,7 +5,7 @@ import { pb } from "@/lib/pocketbase"; /** * Renders a form to add a new npc. Calls onCreate with the new npc document. */ -export const NpcForm = ({ +export const NewNpcForm = ({ campaign, onCreate, }: { diff --git a/src/components/documents/scene/SceneForm.tsx b/src/components/documents/scene/NewSceneForm.tsx similarity index 98% rename from src/components/documents/scene/SceneForm.tsx rename to src/components/documents/scene/NewSceneForm.tsx index 711a85c..b3c4aa6 100644 --- a/src/components/documents/scene/SceneForm.tsx +++ b/src/components/documents/scene/NewSceneForm.tsx @@ -7,7 +7,7 @@ import { pb } from "@/lib/pocketbase"; /** * Renders a form to add a new scene. Calls onCreate with the new scene document. */ -export const SceneForm = ({ +export const NewSceneForm = ({ campaign, onCreate, }: { diff --git a/src/components/documents/secret/SecretForm.tsx b/src/components/documents/secret/NewSecretForm.tsx similarity index 98% rename from src/components/documents/secret/SecretForm.tsx rename to src/components/documents/secret/NewSecretForm.tsx index 474cb95..f0c9865 100644 --- a/src/components/documents/secret/SecretForm.tsx +++ b/src/components/documents/secret/NewSecretForm.tsx @@ -7,7 +7,7 @@ import { pb } from "@/lib/pocketbase"; /** * Renders a form to add a new secret. Calls onCreate with the new secret document. */ -export const SecretForm = ({ +export const NewSecretForm = ({ campaign, onCreate, }: { diff --git a/src/components/documents/session/SessionForm.tsx b/src/components/documents/session/EditSessionForm.tsx similarity index 94% rename from src/components/documents/session/SessionForm.tsx rename to src/components/documents/session/EditSessionForm.tsx index 2b82956..adcf127 100644 --- a/src/components/documents/session/SessionForm.tsx +++ b/src/components/documents/session/EditSessionForm.tsx @@ -1,7 +1,7 @@ import { AutoSaveTextarea } from "@/components/AutoSaveTextarea"; import type { Session } from "@/lib/types"; -export const SessionForm = ({ +export const EditSessionForm = ({ session, onSubmit, }: { diff --git a/src/components/documents/treasure/TreasureForm.tsx b/src/components/documents/treasure/NewTreasureForm.tsx similarity index 98% rename from src/components/documents/treasure/TreasureForm.tsx rename to src/components/documents/treasure/NewTreasureForm.tsx index 0e24dc4..bec6fb9 100644 --- a/src/components/documents/treasure/TreasureForm.tsx +++ b/src/components/documents/treasure/NewTreasureForm.tsx @@ -7,7 +7,7 @@ import { pb } from "@/lib/pocketbase"; /** * Renders a form to add a new treasure. Calls onCreate with the new treasure document. */ -export const TreasureForm = ({ +export const NewTreasureForm = ({ campaign, onCreate, }: { diff --git a/src/routes/_app/_authenticated/document.$documentId.tsx b/src/routes/_app/_authenticated/document.$documentId.tsx index 4cd7dc4..a4e6c3b 100644 --- a/src/routes/_app/_authenticated/document.$documentId.tsx +++ b/src/routes/_app/_authenticated/document.$documentId.tsx @@ -8,7 +8,7 @@ import { type Document, } from "@/lib/types"; import { RelationshipList } from "@/components/RelationshipList"; -import { SessionForm } from "@/components/documents/session/SessionForm"; +import { EditSessionForm } from "@/components/documents/session/EditSessionForm"; export const Route = createFileRoute( "/_app/_authenticated/document/$documentId", @@ -56,7 +56,10 @@ function RouteComponent() { > Print - + {[ RelationshipType.Scenes, RelationshipType.Secrets,