basic shape

This commit is contained in:
2025-08-06 23:29:55 -04:00
parent 3891e8b85b
commit 839d596b55
46 changed files with 220 additions and 5507 deletions

View File

@@ -0,0 +1,30 @@
import { A, useParams } from "@solidjs/router";
import { createEffect, createResource, Show, Suspense } from "solid-js";
import Game from "../../components/Game";
import { getGameState } from "../../db/Instances";
export default () => {
const params = useParams<{ game: string; instance: string }>();
return (
<>
<Game instanceId={Number.parseInt(params.instance)} />
<A
href={`/${params.game}`}
style={{
position: "absolute",
padding: "10px",
top: "0",
left: "0",
margin: "20px",
"background-color": "white",
"border-radius": "8px",
border: "2px solid black",
}}
>
Back
</A>
</>
);
};

View File

@@ -0,0 +1,39 @@
import { A, useParams } from "@solidjs/router";
import { createEffect, createResource, For, Suspense } from "solid-js";
import * as Instance from "../../db/Instances";
export default () => {
const params = useParams<{ game: string }>();
const [instances, { refetch }] = createResource(
() => params.game,
() => Instance.queryInstances(params.game)
);
return (
<Suspense>
<div style={{ padding: "20px" }}>
<h1 style={{ margin: 0 }}>{params.game}</h1>
<button
onClick={() =>
Instance.createInstance(params.game).then(refetch)
}
>
New Game
</button>
<ul>
<For each={instances() ?? []}>
{(instance) => (
<li>
<A href={`/${params.game}/${instance.id}`}>
{instance.id}
</A>
</li>
)}
</For>
</ul>
</div>
</Suspense>
);
};

View File

@@ -0,0 +1,14 @@
import { A } from "@solidjs/router";
import { createResource, For } from "solid-js";
import * as Games from "../db/Games";
export default () => {
const [games] = createResource(() => Games.queryAll());
return (
<div style={{ padding: "20px" }}>
<For each={games()}>
{(game) => <A href={`/${game.name}`}>{game.name}</A>}
</For>
</div>
);
};