diff --git a/packages/website-ue/src/components/ToolBanner.astro b/packages/website-ue/src/components/ToolBanner.astro index b12f277f8..d60d36d0b 100644 --- a/packages/website-ue/src/components/ToolBanner.astro +++ b/packages/website-ue/src/components/ToolBanner.astro @@ -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", }} >
diff --git a/packages/website-ue/src/core/api/client.ts b/packages/website-ue/src/core/api/client.ts index 93a2b85aa..747b903c4 100644 --- a/packages/website-ue/src/core/api/client.ts +++ b/packages/website-ue/src/core/api/client.ts @@ -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); diff --git a/packages/website-ue/src/core/astro/mixStaticPaths.ts b/packages/website-ue/src/core/astro/mixStaticPaths.ts new file mode 100644 index 000000000..b87430e39 --- /dev/null +++ b/packages/website-ue/src/core/astro/mixStaticPaths.ts @@ -0,0 +1,32 @@ +import type { + GetStaticPathsItem, + GetStaticPathsOptions, + GetStaticPathsResult, +} from "astro"; + +type Promisable = T | Promise; + +export function mixStaticPaths< + TypeA extends GetStaticPathsItem, + TypeB extends GetStaticPathsItem +>( + a: (options: GetStaticPathsOptions) => Promisable, + b: (options: GetStaticPathsOptions) => Promisable +) { + 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)[]; + }; +} diff --git a/packages/website-ue/src/core/tankopedia/characteristics.ts b/packages/website-ue/src/core/tankopedia/characteristics.ts index de7726e89..4138d9108 100644 --- a/packages/website-ue/src/core/tankopedia/characteristics.ts +++ b/packages/website-ue/src/core/tankopedia/characteristics.ts @@ -252,7 +252,7 @@ export const characteristics = { ); }, - gun_depression({ parameters, tank }) { + gun_depression({ parameters }) { return -radToDeg( applyPitchYawLimits( -Math.PI / 2, diff --git a/packages/website-ue/src/core/tools/tools.ts b/packages/website-ue/src/core/tools/tools.ts index 713c5695d..968e5fefe 100644 --- a/packages/website-ue/src/core/tools/tools.ts +++ b/packages/website-ue/src/core/tools/tools.ts @@ -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 = { @@ -19,24 +19,28 @@ export const tools: Record = { 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", }, }; diff --git a/packages/website-ue/src/pages/[...locale]/api/index.astro b/packages/website-ue/src/pages/[...locale]/api/index.astro index c55f02f0f..9ee4af5f2 100644 --- a/packages/website-ue/src/pages/[...locale]/api/index.astro +++ b/packages/website-ue/src/pages/[...locale]/api/index.astro @@ -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)); --- - +

api

{ diff --git a/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx b/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx index fbb09081e..6caec4e6a 100644 --- a/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx +++ b/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx @@ -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"); diff --git a/packages/website-ue/src/pages/[...locale]/backgrounds/index.astro b/packages/website-ue/src/pages/[...locale]/backgrounds/index.astro index 2ac6241e4..6fef03adc 100644 --- a/packages/website-ue/src/pages/[...locale]/backgrounds/index.astro +++ b/packages/website-ue/src/pages/[...locale]/backgrounds/index.astro @@ -5,10 +5,11 @@ import BaseLayout from "../../../layouts/BaseLayout.astro"; export { getStaticPaths } from "../index.astro"; +const { locale } = Astro.props; const { backgrounds } = await api.backgrounds(); --- - + { backgrounds.map((background) => { return ( diff --git a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/_index.tsx b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/_index.tsx index a56bfc4ec..364faf7d3 100644 --- a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/_index.tsx +++ b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/_index.tsx @@ -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!); diff --git a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro index b03a86cd0..79d8db675 100644 --- a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro @@ -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; --- - +