feat: lint fixes

This commit is contained in:
TrèsAbhi committed 2026-01-15 13:58:34 -06:00
1 parent 60a29ef2e7
commit 6ec7a50320
10 files changed
+55 -15

No files matched your search

@@ -66,7 +66,7 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
class="tool-hero" class="tool-hero"
style={{ style={{
backgroundImage: `url(/assets/tools/${tool.id}.webp)`, backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
backgroundPosition: tool.background_position ?? "top", backgroundPosition: tool.banner_background_position ?? "top",
}} }}
> >
<div class="content"> <div class="content">
@@ -3,6 +3,7 @@ import type { Strings } from "@blitzkit/i18n";
import { Avatars } from "../../protos/avatars"; import { Avatars } from "../../protos/avatars";
import { AbstractAPI } from "./abstract"; import { AbstractAPI } from "./abstract";
//@ts-expect-error
export class ClientAPI extends AbstractAPI { export class ClientAPI extends AbstractAPI {
protected _avatars() { protected _avatars() {
return fetchPB("/api/avatars/all.pb", Avatars); return fetchPB("/api/avatars/all.pb", Avatars);
@@ -0,0 +1,32 @@
import type {
GetStaticPathsItem,
GetStaticPathsOptions,
GetStaticPathsResult,
} from "astro";
type Promisable<T> = T | Promise<T>;
export function mixStaticPaths<
TypeA extends GetStaticPathsItem,
TypeB extends GetStaticPathsItem
>(
a: (options: GetStaticPathsOptions) => Promisable<TypeA[]>,
b: (options: GetStaticPathsOptions) => Promisable<TypeB[]>
) {
return async function (options: GetStaticPathsOptions) {
const pathsA = await a(options);
const pathsB = await b(options);
const paths: GetStaticPathsResult = [];
for (const pathA of pathsA) {
for (const pathB of pathsB) {
paths.push({
params: { ...pathA.params, ...pathB.params },
props: { ...pathA.props, ...pathB.props },
});
}
}
return paths as (TypeA & TypeB)[];
};
}
@@ -252,7 +252,7 @@ export const characteristics = {
); );
}, },
gun_depression({ parameters, tank }) { gun_depression({ parameters }) {
return -radToDeg( return -radToDeg(
applyPitchYawLimits( applyPitchYawLimits(
-Math.PI / 2, -Math.PI / 2,
+7 -3
View File
@@ -9,7 +9,7 @@ export interface Tool {
disabled?: boolean; disabled?: boolean;
href?: string; href?: string;
background_position: "top" | "center" | "bottom"; banner_background_position: "top" | "center" | "bottom";
} }
export const tools: Record<string, Tool> = { export const tools: Record<string, Tool> = {
@@ -19,24 +19,28 @@ export const tools: Record<string, Tool> = {
button: "purple", button: "purple",
significant: true, significant: true,
background_position: "top", banner_background_position: "top",
}, },
avatars: { avatars: {
id: "avatars", id: "avatars",
button: "gold", button: "gold",
background_position: "bottom", banner_background_position: "bottom",
}, },
backgrounds: { backgrounds: {
id: "backgrounds", id: "backgrounds",
button: "gold", button: "gold",
banner_background_position: "bottom",
}, },
api: { api: {
id: "api", id: "api",
disabled: true, disabled: true,
button: "lime", button: "lime",
banner_background_position: "bottom",
}, },
}; };
@@ -10,6 +10,7 @@ import BaseLayout from "../../../layouts/BaseLayout.astro";
export { getStaticPaths } from "../index.astro"; export { getStaticPaths } from "../index.astro";
const { locale } = Astro.props;
const root = `/src/pages/api`; const root = `/src/pages/api`;
const globbed = import.meta.glob("/src/pages/api/**/*", { const globbed = import.meta.glob("/src/pages/api/**/*", {
eager: true, eager: true,
@@ -47,7 +48,7 @@ for (const fullPath in globbed) {
paths.sort((a, b) => a.path.localeCompare(b.path)); paths.sort((a, b) => a.path.localeCompare(b.path));
--- ---
<BaseLayout accent="amber"> <BaseLayout {locale} accent="amber">
<h1>api</h1> <h1>api</h1>
{ {
@@ -25,7 +25,7 @@ interface ContentProps {
const indexingPattern = /.+_(\d+)$/; const indexingPattern = /.+_(\d+)$/;
function Content({ skeleton }: ContentProps) { function Content({}: ContentProps) {
const locale = useLocale(); const locale = useLocale();
const { avatars } = useAwait(() => api.avatars(), "avatars"); const { avatars } = useAwait(() => api.avatars(), "avatars");
const profileAvatarEntityStrings = useGameStrings("ProfileAvatarEntity"); const profileAvatarEntityStrings = useGameStrings("ProfileAvatarEntity");
@@ -5,10 +5,11 @@ import BaseLayout from "../../../layouts/BaseLayout.astro";
export { getStaticPaths } from "../index.astro"; export { getStaticPaths } from "../index.astro";
const { locale } = Astro.props;
const { backgrounds } = await api.backgrounds(); const { backgrounds } = await api.backgrounds();
--- ---
<BaseLayout accent="amber"> <BaseLayout {locale} accent="amber">
{ {
backgrounds.map((background) => { backgrounds.map((background) => {
return ( return (
@@ -19,8 +19,8 @@ export function Page({ id }: { id: string }) {
function Content({ id }: { id: string }) { function Content({ id }: { id: string }) {
const tank = useAwait(() => api.tank(id), `tank-${id}`); const tank = useAwait(() => api.tank(id), `tank-${id}`);
const tankList = useAwait(() => api.tankList(), "tank-list"); // const tankList = useAwait(() => api.tankList(), "tank-list");
const otherTanks = useAwait(() => api.tanks(), "tanks"); // const otherTanks = useAwait(() => api.tanks(), "tanks");
Tankopedia.useInitialization(tank.tank!); Tankopedia.useInitialization(tank.tank!);
@@ -1,22 +1,23 @@
--- ---
import "@radix-ui/colors/violet-dark.css"; import "@radix-ui/colors/violet-dark.css";
import type { GetStaticPaths } from "astro";
import { api } from "../../../../core/api/dynamic"; import { api } from "../../../../core/api/dynamic";
import { mixStaticPaths } from "../../../../core/astro/mixStaticPaths";
import BaseLayout from "../../../../layouts/BaseLayout.astro"; import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../index.astro";
import { Page } from "./_index"; import { Page } from "./_index";
export const getStaticPaths = (async () => { export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
const { list } = await api.tankList(); const { list } = await api.tankList();
return list.map((tank) => ({ return list.map((tank) => ({
params: { slug: tank.slug }, params: { slug: tank.slug },
props: { id: tank.id }, props: { id: tank.id },
})); }));
}) satisfies GetStaticPaths; });
const { id } = Astro.props; const { id, locale } = Astro.props;
--- ---
<BaseLayout accent="violet"> <BaseLayout {locale} accent="violet">
<Page {id} client:load /> <Page {id} client:load />
</BaseLayout> </BaseLayout>