feat: the thing

This commit is contained in:
tresabhi committed 2025-03-20 12:17:05 -05:00
1 parent e60bbc03d2
commit b856268ee0
9 files changed
+63 -107

No files matched your search

@@ -1,22 +1,26 @@
import { Tank } from '@blitzkit/core';
import { Tank, TankArmor } from '@blitzkit/core';
import { Box } from '@radix-ui/themes';
import { OrbitControls } from '@react-three/drei';
import { Canvas } from '@react-three/fiber';
import { ArmorGroup } from '../../../../components/ArmorGroup';
import { PageWrapper } from '../../../../components/PageWrapper';
interface PageProps {
tank: Tank;
armor: TankArmor;
}
export function Page({ tank }: PageProps) {
export function Page({ tank, armor }: PageProps) {
return (
<Canvas
style={{
width: 640,
height: 640,
}}
>
<OrbitControls />
<ArmorGroup group="hull" tank={tank} />
</Canvas>
<PageWrapper p="0" maxWidth="unset">
<Box height="100%" width="100%" flexGrow="1" position="relative">
<Box position="absolute" top="0" left="0" width="100%" height="100%">
<Canvas>
<OrbitControls />
<ArmorGroup group="hull" tank={tank} armor={armor} />
</Canvas>
</Box>
</Box>
</PageWrapper>
);
}
@@ -1,5 +1,5 @@
---
import { fetchTank } from '@blitzkit/core';
import { fetchTank, fetchTankArmor } from '@blitzkit/core';
import type { GetStaticPaths } from 'astro';
import { awaitableTanksFull } from '../../../../core/awaitables/tanksFull';
import BaseLayout from '../../../../layouts/BaseLayout.astro';
@@ -22,8 +22,9 @@ export const getStaticPaths = (async () => {
const { id } = Astro.props;
const tank = await fetchTank(id);
const armor = await fetchTankArmor(id);
---
<BaseLayout>
<Page {tank} client:load />
<Page {tank} {armor} client:load />
</BaseLayout>
@@ -0,0 +1,16 @@
import { fetchTankArmor } from '@blitzkit/core';
import type { APIRoute } from 'astro';
export { getStaticPaths } from './meta.json';
/**
* Returns the thicknesses and types of all armor plates on a tank chunked into
* groups.
*
* @param id The tank id.
* @returns JSON.
*/
export const GET: APIRoute<{}, { id: string }> = async ({ params }) => {
const tank = await fetchTankArmor(params.id);
return Response.json(tank);
};