mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
start of hero
This commit is contained in:
5 files changed
+80
-153
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import type { APIContext, GetStaticPathsItem } from "astro";
|
||||
import { readdirSync } from "fs";
|
||||
import { parse } from "path";
|
||||
import sharp from "sharp";
|
||||
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
|
||||
import { getStaticPaths as _getStaticPaths } from "../_index";
|
||||
|
||||
interface HeroProps {
|
||||
path: string;
|
||||
}
|
||||
|
||||
const HEROS = "src/media/heros";
|
||||
const HERO_HEIGHT = 800;
|
||||
|
||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, () =>
|
||||
readdirSync(HEROS).map(
|
||||
(file) =>
|
||||
({
|
||||
params: { season: parse(file).name },
|
||||
props: { path: `${HEROS}/${file}` } satisfies HeroProps,
|
||||
}) satisfies GetStaticPathsItem,
|
||||
),
|
||||
);
|
||||
|
||||
export async function GET({ props }: APIContext<HeroProps>) {
|
||||
const image = await sharp(props.path)
|
||||
.resize({ height: HERO_HEIGHT })
|
||||
.webp()
|
||||
.toBuffer();
|
||||
|
||||
return new Response(new Uint8Array(image));
|
||||
}
|
||||
@@ -2,13 +2,8 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
|
||||
import { AesonPlug } from "../../../components/AesonPlug";
|
||||
import HelpTranslate from "../../../components/HelpTranslate.astro";
|
||||
import HomeCosmetics from "../../../components/HomeCosmetics.astro";
|
||||
import HomeGames from "../../../components/HomeGames.astro";
|
||||
import HomePlayers from "../../../components/HomePlayers.astro";
|
||||
import HomeHero from "../../../components/HomeHero.astro";
|
||||
import HomeTanks from "../../../components/HomeTanks.astro";
|
||||
import HomeTechnical from "../../../components/HomeTechnical.astro";
|
||||
import { tools, type Tool } from "../../../config/tools";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../_index";
|
||||
@@ -46,17 +41,17 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => {
|
||||
---
|
||||
|
||||
<BaseLayout tool={tools.home} accent="blue" {locale}>
|
||||
<!-- <HomeHero {locale} /> -->
|
||||
<HomeHero {locale} />
|
||||
|
||||
<HelpTranslate {locale} />
|
||||
<!-- <HelpTranslate {locale} /> -->
|
||||
|
||||
{environment === "preview" && <AesonPlug />}
|
||||
<!-- {environment === "preview" && <AesonPlug />} -->
|
||||
|
||||
<HomeTanks {locale} />
|
||||
<HomePlayers {locale} />
|
||||
<HomeGames {locale} />
|
||||
<HomeCosmetics {locale} />
|
||||
<HomeTechnical {locale} />
|
||||
<!-- <HomePlayers {locale} /> -->
|
||||
<!-- <HomeGames {locale} /> -->
|
||||
<!-- <HomeCosmetics {locale} /> -->
|
||||
<!-- <HomeTechnical {locale} /> -->
|
||||
</BaseLayout>
|
||||
|
||||
<!-- TODO: read temp/notes.md for user testing fixes -->
|
||||
Reference in new issue
Block a user