mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: nation flags
This commit is contained in:
1 parent
2e208507c3
commit
bc0004574a
4 files changed
+69
-6
No files matched your search
@@ -23,7 +23,7 @@ export function TankCard({ id }: PopularTank) {
|
||||
<div
|
||||
className={styles.flag}
|
||||
style={{
|
||||
backgroundImage: "url(https://i.imgur.com/QGUfXNo.png)",
|
||||
backgroundImage: `url(/api/nations/${tank.tank!.nation}.webp)`,
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Nation } from "@protos/game/proto/legacy/blitz_static_tank_component";
|
||||
import type { APIContext, GetStaticPaths } from "astro";
|
||||
import { game } from "../../../core/game/game";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
return Object.values(Nation)
|
||||
.filter(Number.isInteger)
|
||||
.map((id) => ({ params: { id } }));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
/**
|
||||
* Even Noah can't save these animals.
|
||||
*/
|
||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||
const enumName = Nation[Number(params.id)];
|
||||
const nationName = enumName.replace("NATION_", "").toLowerCase();
|
||||
const flag = game.flag(nationName);
|
||||
|
||||
return new Response(new Uint8Array(flag));
|
||||
}
|
||||
Reference in new issue
Block a user