mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
1 parent
0817ba18bd
commit
0828d50830
5 files changed
+12
-32
No files matched your search
@@ -43,10 +43,6 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
|
||||
:root.light & {
|
||||
filter: brightness(1.25);
|
||||
}
|
||||
|
||||
.gradient {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -62,10 +58,6 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
|
||||
backdrop-filter: blur(var(--space-6));
|
||||
|
||||
:root.light & {
|
||||
backdrop-filter: blur(var(--space-6)) brightness(1.25);
|
||||
}
|
||||
|
||||
.readable {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -2,8 +2,8 @@ import { fetchPB } from "@blitzkit/core";
|
||||
import type { Strings } from "@blitzkit/i18n";
|
||||
import { Avatars } from "@protos/blitzkit/avatars";
|
||||
import { PopularTanks } from "@protos/blitzkit/popular_tanks";
|
||||
import { Tank } from "@protos/blitzkit/tank";
|
||||
import { TankList } from "@protos/blitzkit/tank_list";
|
||||
import { Tanks } from "@protos/blitzkit/tanks";
|
||||
import { AbstractAPI, Cache } from "./abstract";
|
||||
|
||||
const rejected = Promise.reject("Not implemented on client");
|
||||
@@ -15,13 +15,14 @@ export class ClientAPI extends AbstractAPI {
|
||||
}
|
||||
|
||||
@Cache()
|
||||
tank(id: string) {
|
||||
return fetchPB(`/api/tanks/${id}.pb`, Tank);
|
||||
async tank(id: string) {
|
||||
const tanks = await this.tanks();
|
||||
return tanks.tanks[id];
|
||||
}
|
||||
|
||||
@UnimplementedOnClient
|
||||
@Cache()
|
||||
tanks() {
|
||||
return rejected;
|
||||
return fetchPB("/api/tanks/all.pb", Tanks);
|
||||
}
|
||||
|
||||
@Cache()
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { APIContext } from "astro";
|
||||
import type { APIContext, GetStaticPaths } from "astro";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
|
||||
export { getStaticPaths } from "./[id].pb";
|
||||
export const getStaticPaths = (async () => {
|
||||
const { list } = await api.tankList();
|
||||
return list.map(({ id }) => ({ params: { id } }));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
/**
|
||||
* Even Noah can't save these animals.
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Tank } from "@protos/blitzkit/tank";
|
||||
import type { APIContext, GetStaticPaths } from "astro";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const { list } = await api.tankList();
|
||||
return list.map(({ id }) => ({ params: { id } }));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
/**
|
||||
* Even Noah can't save these animals.
|
||||
*/
|
||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||
const tank = await api.tank(params.id);
|
||||
return new Response(Tank.encode(tank).finish());
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import type { APIContext } from "astro";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
import { game } from "../../../core/game/game";
|
||||
|
||||
export { getStaticPaths } from "./[id].pb";
|
||||
export { getStaticPaths } from "./[id].json";
|
||||
|
||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||
const tank = await api.tank(params.id);
|
||||
|
||||
Reference in new issue
Block a user