diff --git a/actions/Schemas/create.ts b/actions/Schemas/create.ts
new file mode 100644
index 0000000..5222488
--- /dev/null
+++ b/actions/Schemas/create.ts
@@ -0,0 +1,23 @@
+"use server";
+
+import { prisma } from "@/prisma/prismaClient";
+import { redirect } from "next/navigation";
+
+export const createSchema = async (form: FormData) => {
+ const name = form.get("name")?.toString();
+ const gsId = form.get("gsId")?.toString();
+
+ if (!name || !gsId) return;
+
+ const { id } = await prisma.schema.create({
+ data: {
+ name,
+ schema: "{}",
+ types: "{}",
+ version: 0,
+ gameSystemId: gsId,
+ },
+ select: { id: true },
+ });
+ redirect(`/game-systems/${gsId}/schema/${id}`);
+};
diff --git a/app/game-systems/[id]/page.tsx b/app/game-systems/[id]/page.tsx
index dbb24d8..c8ca80f 100644
--- a/app/game-systems/[id]/page.tsx
+++ b/app/game-systems/[id]/page.tsx
@@ -1,5 +1,5 @@
-import { Sticky } from "@/lib/sticky";
import { prisma } from "@/prisma/prismaClient";
+import Link from "next/link";
export default async function GameSystem(
{ params: { id } }: { params: { id: string } },
@@ -35,15 +35,25 @@ export default async function GameSystem(
{gameSystem?.name}
-
- {gameSystem?.schemas.map((schema) => (
- - {schema.name}
- ))}
-
+ <>
+
+
+ Create New Schema
+
+
+
+ {gameSystem?.schemas.map((schema) => (
+ - {schema.name}
+ ))}
+ {!gameSystem?.schemas.length && (
+ - No schemas for {gameSystem?.name}
+ )}
+
+ >
-
- HELLO!
-
>
);
}
diff --git a/app/game-systems/[id]/schema/[schemaId]/page.tsx b/app/game-systems/[id]/schema/[schemaId]/page.tsx
new file mode 100644
index 0000000..24524d5
--- /dev/null
+++ b/app/game-systems/[id]/schema/[schemaId]/page.tsx
@@ -0,0 +1,21 @@
+import { Heading } from "@/components/heading";
+import { SchemaBuilder } from "@/components/schema";
+import { prisma } from "@/prisma/prismaClient";
+
+export default async function CreateSchemaForGameSystem(
+ { params }: { params: { id: string } },
+) {
+ const gs = await prisma.gameSystem.findFirst({
+ where: { id: params.id },
+ select: { name: true },
+ });
+
+ return (
+ <>
+
+
+ >
+ );
+}
diff --git a/app/globals.css b/app/globals.css
index ed3088f..b8dac86 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -12,6 +12,9 @@
input {
@apply py-2 px-4 rounded-full dark:bg-mixed-200 bg-mixed-600 placeholder:text-dark-500;
}
+ textarea {
+ @apply dark:bg-mixed-200 bg-primary-600 rounded-md p-1;
+ }
h1,
h2,
h3,
@@ -49,6 +52,9 @@
.btn-secondary {
@apply dark:text-primary-500 text-primary-100 py-4 px-6 font-bold text-lg;
}
+ .btn-small {
+ @apply px-2 py-1;
+ }
.p {
@apply pb-1;
}
diff --git a/app/layout.tsx b/app/layout.tsx
index 7daa2be..d427cc3 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -10,6 +10,7 @@ import {
} from "@heroicons/react/24/solid";
import Link from "next/link";
import { DevToolboxContextProvider } from "@/components/devtools/context";
+import { RecoilRootClient } from "@/components/recoilRoot";
const roboto = Roboto({ subsets: ["latin"], weight: "400" });
@@ -72,13 +73,15 @@ export default function RootLayout({
))}
-
-
- {children}
-
-
+
+
+
+ {children}
+
+
+