mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: cu tank icons
This commit is contained in:
1 parent
ba4e6dfd68
commit
c674da29d5
3 files changed
+9
-3
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -1,4 +1,5 @@
|
|||||||
import { api } from "../../core/api/dynamic";
|
import { api } from "../../core/api/dynamic";
|
||||||
|
import { clientUnmounted } from "../../core/game/game";
|
||||||
import { useAwait } from "../../hooks/useAwait";
|
import { useAwait } from "../../hooks/useAwait";
|
||||||
import { useGameStrings } from "../../hooks/useGameStrings";
|
import { useGameStrings } from "../../hooks/useGameStrings";
|
||||||
import { useLocale } from "../../hooks/useLocale";
|
import { useLocale } from "../../hooks/useLocale";
|
||||||
@@ -42,7 +43,9 @@ export function TankCard(props: PropsWithSkeleton<TankCardProps>) {
|
|||||||
<div
|
<div
|
||||||
className={styles.icon}
|
className={styles.icon}
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(/api/tanks/${props.id}.webp)`,
|
backgroundImage: clientUnmounted
|
||||||
|
? `url(/api/unmounted/tank.png)`
|
||||||
|
: `url(/api/tanks/${props.id}.webp)`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Nation } from "@protos/game/proto/legacy/blitz_static_tank_component";
|
import { Nation } from "@protos/game/proto/legacy/blitz_static_tank_component";
|
||||||
import type { APIContext, GetStaticPaths } from "astro";
|
import type { APIContext, GetStaticPaths } from "astro";
|
||||||
import { game } from "../../../../core/game/game";
|
import { clientUnmountedResponse } from "../../../../core/api/responses";
|
||||||
|
import { clientUnmounted, game } from "../../../../core/game/game";
|
||||||
|
|
||||||
export const getStaticPaths = (async () => {
|
export const getStaticPaths = (async () => {
|
||||||
return Object.values(Nation)
|
return Object.values(Nation)
|
||||||
@@ -12,9 +13,11 @@ export const getStaticPaths = (async () => {
|
|||||||
* Even Noah can't save these animals.
|
* Even Noah can't save these animals.
|
||||||
*/
|
*/
|
||||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||||
|
if (clientUnmounted) return clientUnmountedResponse;
|
||||||
|
|
||||||
const enumName = Nation[Number(params.id)];
|
const enumName = Nation[Number(params.id)];
|
||||||
const nationName = enumName.replace("NATION_", "").toLowerCase();
|
const nationName = enumName.replace("NATION_", "").toLowerCase();
|
||||||
const flag = game.flag(nationName);
|
const flag = game!.flag(nationName);
|
||||||
|
|
||||||
return new Response(new Uint8Array(flag));
|
return new Response(new Uint8Array(flag));
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user