feat: icons

This commit is contained in:
tresabhi committed 2025-03-19 19:27:47 -05:00
1 parent a98f0e84d5
commit d64f04b2c8
8 files changed
+40 -4

No files matched your search

+4
View File
@@ -20,6 +20,10 @@ export default defineConfig({
outDir: '../../dist/website',
prefetch: true,
build: {
concurrency: 4,
},
integrations: [react(), sitemap()],
vite: {
resolve: {
@@ -9,7 +9,7 @@ interface SlugsTableProps {
path: string;
}
const MAX_UNEXPANDED = 5;
const MAX_UNEXPANDED = 3;
export function SlugsTable({ slugs, path }: SlugsTableProps) {
if (slugs === undefined) return null;
@@ -18,9 +18,9 @@ const glossary = await fetchGlossary(DEFAULT_LOCALE);
* Returns an in-game avatar image. Use gallery/list.json to get all valid ids.
* Some images may be animated. Not all images share the same dimensions.
*
* @warning Not all ids have images due to poor Wargaming CDN.
* @warning Not all ids have images due to lousy Wargaming CDN.
* @param avatar The avatar id.
* @returns A webp image.
* @returns WEBP.
*/
export const GET: APIRoute<{}, { avatar: string }> = async ({ params }) => {
const image =
Whitespace-only changes.
@@ -0,0 +1,16 @@
import { asset } from '@blitzkit/core';
import type { APIRoute } from 'astro';
export { getStaticPaths } from '../meta.json';
/**
* Returns the big icon for a tank, the image that appears in the tank carousal in the garage. Use tanks/list.json for all valid ids.
*
* @param id The tank id.
* @returns PNG.
*/
export const GET: APIRoute<{}, { id: string }> = async ({ params }) => {
const response = await fetch(asset(`tanks/${params.id}/icons/big.png`));
const blob = await response.blob();
return new Response(blob, { headers: response.headers });
};
@@ -0,0 +1,16 @@
import { asset } from '@blitzkit/core';
import type { APIRoute } from 'astro';
export { getStaticPaths } from '../meta.json';
/**
* Returns the small icon for a tank, the image that appears in the team list in a battle or the loading screen. Use tanks/list.json for all valid ids.
*
* @param id The tank id.
* @returns PNG.
*/
export const GET: APIRoute<{}, { id: string }> = async ({ params }) => {
const response = await fetch(asset(`tanks/${params.id}/icons/small.png`));
const blob = await response.blob();
return new Response(blob, { headers: response.headers });
};
@@ -4,7 +4,7 @@ import type { APIRoute } from 'astro';
/**
* Returns meta data similar to tanks/[id].json but for all tanks as an array. There is no guarantee of order.
*
* @warning This is a large response. Consider using tanks/[id].json for individual tanks.
* @warning This is a large response. Consider using tanks/[id]/meta.json for individual tanks.
* @returns JSON.
*/
export const GET: APIRoute = async () => {