mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: lint fixes
This commit is contained in:
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"
|
||||
style={{
|
||||
backgroundImage: `url(/assets/tools/${tool.id}.webp)`,
|
||||
backgroundPosition: tool.background_position ?? "top",
|
||||
backgroundPosition: tool.banner_background_position ?? "top",
|
||||
}}
|
||||
>
|
||||
<div class="content">
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { Strings } from "@blitzkit/i18n";
|
||||
import { Avatars } from "../../protos/avatars";
|
||||
import { AbstractAPI } from "./abstract";
|
||||
|
||||
//@ts-expect-error
|
||||
export class ClientAPI extends AbstractAPI {
|
||||
protected _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(
|
||||
applyPitchYawLimits(
|
||||
-Math.PI / 2,
|
||||
|
||||
@@ -9,7 +9,7 @@ export interface Tool {
|
||||
disabled?: boolean;
|
||||
href?: string;
|
||||
|
||||
background_position: "top" | "center" | "bottom";
|
||||
banner_background_position: "top" | "center" | "bottom";
|
||||
}
|
||||
|
||||
export const tools: Record<string, Tool> = {
|
||||
@@ -19,24 +19,28 @@ export const tools: Record<string, Tool> = {
|
||||
button: "purple",
|
||||
significant: true,
|
||||
|
||||
background_position: "top",
|
||||
banner_background_position: "top",
|
||||
},
|
||||
|
||||
avatars: {
|
||||
id: "avatars",
|
||||
button: "gold",
|
||||
|
||||
background_position: "bottom",
|
||||
banner_background_position: "bottom",
|
||||
},
|
||||
|
||||
backgrounds: {
|
||||
id: "backgrounds",
|
||||
button: "gold",
|
||||
|
||||
banner_background_position: "bottom",
|
||||
},
|
||||
|
||||
api: {
|
||||
id: "api",
|
||||
disabled: true,
|
||||
button: "lime",
|
||||
|
||||
banner_background_position: "bottom",
|
||||
},
|
||||
};
|
||||
@@ -10,6 +10,7 @@ import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
const root = `/src/pages/api`;
|
||||
const globbed = import.meta.glob("/src/pages/api/**/*", {
|
||||
eager: true,
|
||||
@@ -47,7 +48,7 @@ for (const fullPath in globbed) {
|
||||
paths.sort((a, b) => a.path.localeCompare(b.path));
|
||||
---
|
||||
|
||||
<BaseLayout accent="amber">
|
||||
<BaseLayout {locale} accent="amber">
|
||||
<h1>api</h1>
|
||||
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ interface ContentProps {
|
||||
|
||||
const indexingPattern = /.+_(\d+)$/;
|
||||
|
||||
function Content({ skeleton }: ContentProps) {
|
||||
function Content({}: ContentProps) {
|
||||
const locale = useLocale();
|
||||
const { avatars } = useAwait(() => api.avatars(), "avatars");
|
||||
const profileAvatarEntityStrings = useGameStrings("ProfileAvatarEntity");
|
||||
|
||||
@@ -5,10 +5,11 @@ import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
|
||||
export { getStaticPaths } from "../index.astro";
|
||||
|
||||
const { locale } = Astro.props;
|
||||
const { backgrounds } = await api.backgrounds();
|
||||
---
|
||||
|
||||
<BaseLayout accent="amber">
|
||||
<BaseLayout {locale} accent="amber">
|
||||
{
|
||||
backgrounds.map((background) => {
|
||||
return (
|
||||
|
||||
@@ -19,8 +19,8 @@ export function Page({ id }: { id: string }) {
|
||||
|
||||
function Content({ id }: { id: string }) {
|
||||
const tank = useAwait(() => api.tank(id), `tank-${id}`);
|
||||
const tankList = useAwait(() => api.tankList(), "tank-list");
|
||||
const otherTanks = useAwait(() => api.tanks(), "tanks");
|
||||
// const tankList = useAwait(() => api.tankList(), "tank-list");
|
||||
// const otherTanks = useAwait(() => api.tanks(), "tanks");
|
||||
|
||||
Tankopedia.useInitialization(tank.tank!);
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
---
|
||||
import "@radix-ui/colors/violet-dark.css";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import { api } from "../../../../core/api/dynamic";
|
||||
import { mixStaticPaths } from "../../../../core/astro/mixStaticPaths";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||
import { Page } from "./_index";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
const { list } = await api.tankList();
|
||||
|
||||
return list.map((tank) => ({
|
||||
params: { slug: tank.slug },
|
||||
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 />
|
||||
</BaseLayout>
|
||||
Reference in new issue
Block a user