feat: start of mechanics

This commit is contained in:
TrèsAbhi committed 2025-12-26 20:07:22 -06:00
1 parent 01409985a2
commit da1af66c77
6 files changed
+37 -21

No files matched your search

@@ -0,0 +1,12 @@
import type { APIContext } from "astro";
import { api } from "../../../core/api/dynamic";
export { getStaticPaths } from "./[id].pb";
/**
* Even Noah can't save these animals.
*/
export async function GET({ params }: APIContext<never, { id: string }>) {
const tank = await api.tank(params.id);
return Response.json(tank);
}
@@ -4,7 +4,6 @@ import { Tank } from "../../../protos/tank";
export const getStaticPaths = (async () => {
const { list } = await api.tankList();
return list.map(({ id }) => ({ params: { id } }));
}) satisfies GetStaticPaths;
@@ -27,8 +27,7 @@ function Content({ id }: { id: string }) {
const protagonist = Tankopedia.use((state) => state.protagonist);
const compare = Tankopedia.use((state) => state.compare);
const characteristics = useMemo(
() =>
computeCharacteristics(id, tank.tank!, tank.compensation!, protagonist),
() => computeCharacteristics(id, tank, protagonist),
[protagonist]
);
// const otherCharacteristics = useMemo(
@@ -53,6 +52,12 @@ function Content({ id }: { id: string }) {
<>
<h1>{id}</h1>
<div style={{ display: "flex", flexWrap: "wrap", gap: "1rem" }}>
{tank.tank?.feature_screens?.tags.map((tag) => (
<span>{tag.value}</span>
))}
</div>
<br />
<div style={{ display: "flex", flexWrap: "wrap" }}>