mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-29 04:44:23 +01:00
home page
This commit is contained in:
22 files changed
+190
-66
No files matched your search
@@ -526,6 +526,7 @@
|
||||
"tanks": "Tanks",
|
||||
"players": "Players",
|
||||
"games": "Games",
|
||||
"tools": "Tools",
|
||||
"cosmetics": "Cosmetics",
|
||||
"technical": "Technical"
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ styles += "}";
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--page-width: 64rem;
|
||||
--page-width: 80rem;
|
||||
--page-padding: var(--space-4);
|
||||
|
||||
--max-size: max(100vw, 100vh);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
---
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools } from "../config/tools";
|
||||
import { Heading } from "./Heading";
|
||||
import { Section } from "./Section";
|
||||
import HomeSection from "./HomeSection.astro";
|
||||
import ToolCard from "./ToolCard.astro";
|
||||
import ToolCardLayoutColumn from "./ToolCardLayoutColumn.astro";
|
||||
import ToolCardLayoutRoot from "./ToolCardLayoutRoot.astro";
|
||||
@@ -16,9 +15,7 @@ const { locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<Section>
|
||||
<Heading size="2">{strings.home.cosmetics}</Heading>
|
||||
|
||||
<HomeSection title={strings.home.cosmetics}>
|
||||
<ToolCardLayoutRoot minor>
|
||||
<ToolCardLayoutColumn>
|
||||
<ToolCard {locale} tool={tools.avatars} />
|
||||
@@ -28,4 +25,4 @@ const strings = await api.strings(locale);
|
||||
<ToolCard {locale} tool={tools.backgrounds} />
|
||||
</ToolCardLayoutColumn>
|
||||
</ToolCardLayoutRoot>
|
||||
</Section>
|
||||
</HomeSection>
|
||||
@@ -1,8 +1,7 @@
|
||||
---
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools } from "../config/tools";
|
||||
import { Heading } from "./Heading";
|
||||
import { Section } from "./Section";
|
||||
import HomeSection from "./HomeSection.astro";
|
||||
import ToolCard from "./ToolCard.astro";
|
||||
import ToolCardLayoutColumn from "./ToolCardLayoutColumn.astro";
|
||||
import ToolCardLayoutRoot from "./ToolCardLayoutRoot.astro";
|
||||
@@ -16,9 +15,7 @@ const { locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<Section>
|
||||
<Heading size="2" className="title">{strings.home.games}</Heading>
|
||||
|
||||
<HomeSection title={strings.home.games}>
|
||||
<ToolCardLayoutRoot>
|
||||
<ToolCardLayoutColumn major>
|
||||
<ToolCard {locale} tool={tools.mixer} />
|
||||
@@ -28,4 +25,4 @@ const strings = await api.strings(locale);
|
||||
<ToolCard {locale} tool={tools.guesser} />
|
||||
</ToolCardLayoutColumn>
|
||||
</ToolCardLayoutRoot>
|
||||
</Section>
|
||||
</HomeSection>
|
||||
@@ -62,11 +62,7 @@ const season = SEASONS[Math.floor(((month + 2) % 12) / 3)];
|
||||
justify-content: center;
|
||||
gap: var(--space-4);
|
||||
|
||||
background: linear-gradient(
|
||||
var(--black-a8),
|
||||
var(--black-a4),
|
||||
var(--gray-1)
|
||||
);
|
||||
background: linear-gradient(var(--black-a8), var(--gray-1));
|
||||
|
||||
.search {
|
||||
max-width: 20rem;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
---
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools } from "../config/tools";
|
||||
import { Heading } from "./Heading";
|
||||
import { Section } from "./Section";
|
||||
import HomeSection from "./HomeSection.astro";
|
||||
import ToolCard from "./ToolCard.astro";
|
||||
import ToolCardLayoutColumn from "./ToolCardLayoutColumn.astro";
|
||||
import ToolCardLayoutRoot from "./ToolCardLayoutRoot.astro";
|
||||
@@ -16,18 +15,14 @@ const { locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<Section>
|
||||
<Heading size="2">{strings.home.players}</Heading>
|
||||
|
||||
<HomeSection title={strings.home.players}>
|
||||
<ToolCardLayoutRoot>
|
||||
<ToolCardLayoutColumn>
|
||||
<ToolCard {locale} minor tool={tools.session} />
|
||||
<ToolCard {locale} minor tool={tools.embed} />
|
||||
<ToolCard {locale} tool={tools.session} />
|
||||
</ToolCardLayoutColumn>
|
||||
|
||||
<ToolCardLayoutColumn major>
|
||||
<ToolCard {locale} minor tool={tools.playlist} />
|
||||
<!-- <ToolCard {locale} tool={tools.players} /> -->
|
||||
<ToolCard {locale} tool={tools.players} />
|
||||
</ToolCardLayoutColumn>
|
||||
</ToolCardLayoutRoot>
|
||||
</Section>
|
||||
</HomeSection>
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
import { Heading } from "./Heading";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
|
||||
const { title } = Astro.props;
|
||||
---
|
||||
|
||||
<style>
|
||||
.home-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
</style>
|
||||
|
||||
<section class="home-section">
|
||||
<Heading size="2">{title}</Heading>
|
||||
<slot />
|
||||
</section>
|
||||
@@ -1,8 +1,7 @@
|
||||
---
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools } from "../config/tools";
|
||||
import { Heading } from "./Heading";
|
||||
import { Section } from "./Section";
|
||||
import HomeSection from "./HomeSection.astro";
|
||||
import ToolCard from "./ToolCard.astro";
|
||||
import ToolCardLayoutColumn from "./ToolCardLayoutColumn.astro";
|
||||
import ToolCardLayoutRoot from "./ToolCardLayoutRoot.astro";
|
||||
@@ -15,9 +14,7 @@ const { locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<Section>
|
||||
<Heading size="2">{strings.home.tanks}</Heading>
|
||||
|
||||
<HomeSection title={strings.home.tanks}>
|
||||
<ToolCardLayoutRoot>
|
||||
<ToolCardLayoutColumn major>
|
||||
<ToolCard {locale} tool={tools.tanks} />
|
||||
@@ -28,4 +25,4 @@ const strings = await api.strings(locale);
|
||||
<ToolCard {locale} minor tool={tools.performance} />
|
||||
</ToolCardLayoutColumn>
|
||||
</ToolCardLayoutRoot>
|
||||
</Section>
|
||||
</HomeSection>
|
||||
@@ -1,8 +1,7 @@
|
||||
---
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools } from "../config/tools";
|
||||
import { Heading } from "./Heading";
|
||||
import { Section } from "./Section";
|
||||
import HomeSection from "./HomeSection.astro";
|
||||
import ToolCard from "./ToolCard.astro";
|
||||
import ToolCardLayoutColumn from "./ToolCardLayoutColumn.astro";
|
||||
import ToolCardLayoutRoot from "./ToolCardLayoutRoot.astro";
|
||||
@@ -16,9 +15,7 @@ const { locale } = Astro.props;
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<Section>
|
||||
<Heading size="2">{strings.home.technical}</Heading>
|
||||
|
||||
<HomeSection title={strings.home.technical}>
|
||||
<ToolCardLayoutRoot minor>
|
||||
<ToolCardLayoutColumn>
|
||||
<ToolCard {locale} tool={tools.api} />
|
||||
@@ -28,4 +25,4 @@ const strings = await api.strings(locale);
|
||||
<ToolCard {locale} tool={tools.changelogs} />
|
||||
</ToolCardLayoutColumn>
|
||||
</ToolCardLayoutRoot>
|
||||
</Section>
|
||||
</HomeSection>
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools } from "../config/tools";
|
||||
import HomeSection from "./HomeSection.astro";
|
||||
import ToolCard from "./ToolCard.astro";
|
||||
import ToolCardLayoutColumn from "./ToolCardLayoutColumn.astro";
|
||||
import ToolCardLayoutRoot from "./ToolCardLayoutRoot.astro";
|
||||
|
||||
interface Props {
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const { locale } = Astro.props;
|
||||
|
||||
const strings = await api.strings(locale);
|
||||
---
|
||||
|
||||
<HomeSection title={strings.home.tools}>
|
||||
<ToolCardLayoutRoot>
|
||||
<ToolCardLayoutColumn>
|
||||
<ToolCard {locale} minor tool={tools.playlist} />
|
||||
<ToolCard {locale} minor tool={tools.embed} />
|
||||
</ToolCardLayoutColumn>
|
||||
|
||||
<ToolCardLayoutColumn major>
|
||||
<ToolCard {locale} tool={tools.tier_list} />
|
||||
</ToolCardLayoutColumn>
|
||||
</ToolCardLayoutRoot>
|
||||
</HomeSection>
|
||||
@@ -206,9 +206,18 @@ const groups = toolGroups.map((group) => {
|
||||
const triggers = navbar.querySelectorAll<HTMLElement>(".trigger");
|
||||
const panels = navbar.querySelectorAll<HTMLElement>(".panel");
|
||||
const icons = navbar.querySelectorAll<HTMLElement>(".bar .icon");
|
||||
const bar = navbar.querySelector<HTMLElement>(".bar")!;
|
||||
|
||||
let hoverTimeout: number | undefined;
|
||||
|
||||
// Lets sticky page elements sit below the bar instead of behind it
|
||||
new ResizeObserver(() => {
|
||||
document.documentElement.style.setProperty(
|
||||
"--navbar-fine-height",
|
||||
`${bar.offsetHeight}px`,
|
||||
);
|
||||
}).observe(bar);
|
||||
|
||||
function resize(height: number) {
|
||||
const duration = Math.min(MAX_DURATION, Math.max(MIN_DURATION, height / 2));
|
||||
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
---
|
||||
interface Props {
|
||||
// Centers the sections within the page width, lined up with the navbar
|
||||
centered?: boolean;
|
||||
}
|
||||
|
||||
const { centered } = Astro.props;
|
||||
---
|
||||
|
||||
<style>
|
||||
.sections {
|
||||
flex: 1;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--page-padding);
|
||||
gap: var(--space-6);
|
||||
|
||||
padding: 0 var(--page-padding) var(--page-padding);
|
||||
|
||||
&[data-centered="true"] {
|
||||
padding-inline: max(
|
||||
var(--page-padding),
|
||||
(100% - var(--page-width)) / 2
|
||||
);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="sections">
|
||||
<div class="sections" data-centered={centered}>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
.fullscreen {
|
||||
position: absolute;
|
||||
right: var(--space-4);
|
||||
bottom: var(--space-4);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { EnterFullScreenIcon, ExitFullScreenIcon } from "@radix-ui/react-icons";
|
||||
import { useCallback, useEffect, useState, type RefObject } from "react";
|
||||
import { IconButton } from "../IconButton";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface TankopediaFullscreenProps {
|
||||
target: RefObject<HTMLElement | null>;
|
||||
}
|
||||
|
||||
export function TankopediaFullscreen({ target }: TankopediaFullscreenProps) {
|
||||
const [available, setAvailable] = useState(false);
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
function handleFullscreenChange() {
|
||||
setIsFullscreen(document.fullscreenElement === target.current);
|
||||
}
|
||||
|
||||
setAvailable(document.fullscreenEnabled);
|
||||
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (isFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else {
|
||||
target.current!.requestFullscreen();
|
||||
}
|
||||
}, [isFullscreen]);
|
||||
|
||||
if (!available) return null;
|
||||
|
||||
return (
|
||||
<IconButton
|
||||
className={styles.fullscreen}
|
||||
variant="ghost"
|
||||
highContrast
|
||||
onClick={handleClick}
|
||||
>
|
||||
{isFullscreen ? <ExitFullScreenIcon /> : <EnterFullScreenIcon />}
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
@@ -6,9 +6,9 @@
|
||||
background-color: var(--gray-2);
|
||||
|
||||
position: sticky;
|
||||
top: 0;
|
||||
top: var(--navbar-fine-height, 0);
|
||||
|
||||
max-height: 100dvh;
|
||||
max-height: calc(100dvh - var(--navbar-fine-height, 0px));
|
||||
overflow-y: auto;
|
||||
|
||||
padding: var(--space-5);
|
||||
|
||||
@@ -9,9 +9,5 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: black;
|
||||
|
||||
@media (pointer: fine) {
|
||||
border-radius: var(--space-4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import { SmartCanvas } from "../SmartCanvas";
|
||||
import { TankDynamicArmor } from "../TankDynamicArmor";
|
||||
import { TankModel } from "../TankModel";
|
||||
import { TankopediaAntagonistControl } from "../TankopediaAntagonistControl";
|
||||
import { TankopediaFullscreen } from "../TankopediaFullscreen";
|
||||
import { TankopediaOptions } from "../TankopediaOptions";
|
||||
import { TankopediaQuickInputs } from "../TankopediaQuickInputs";
|
||||
import { TankopediaSkinSwitcher } from "../TankopediaSkinSwitcher";
|
||||
@@ -214,6 +215,7 @@ function Sandbox({ id }: TankopediaSandboxProps) {
|
||||
<Thicknesses thicknessRange={thicknessRange} />
|
||||
<TankopediaAntagonistControl penetration={antagonistPenetration} />
|
||||
<TankopediaOptions />
|
||||
<TankopediaFullscreen target={wrapper} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -90,7 +90,7 @@ const name = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
{locale}
|
||||
className="link"
|
||||
underline="never"
|
||||
href={tool.href ?? `/${tool.id}`}
|
||||
href={tool.href ?? `/${tool.slug ?? tool.id}`}
|
||||
target={tool.href ? "_blank" : undefined}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -107,18 +107,23 @@ export const toolGroups: ToolGroup[] = [
|
||||
{
|
||||
id: "tanks",
|
||||
default: "tanks",
|
||||
tools: ["tanks", "compare", "performance", "tier_list"],
|
||||
tools: ["tanks", "compare", "performance"],
|
||||
},
|
||||
{
|
||||
id: "players",
|
||||
default: "players",
|
||||
tools: ["players", "session", "embed", "playlist"],
|
||||
tools: ["players", "session"],
|
||||
},
|
||||
{
|
||||
id: "games",
|
||||
default: "mixer",
|
||||
tools: ["mixer", "guesser"],
|
||||
},
|
||||
{
|
||||
id: "tools",
|
||||
default: "tier_list",
|
||||
tools: ["tier_list", "playlist", "embed"],
|
||||
},
|
||||
{
|
||||
id: "cosmetics",
|
||||
default: "avatars",
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
|
||||
import HomeCosmetics from "../../../components/HomeCosmetics.astro";
|
||||
import HomeGames from "../../../components/HomeGames.astro";
|
||||
import HomeHero from "../../../components/HomeHero.astro";
|
||||
import HomePlayers from "../../../components/HomePlayers.astro";
|
||||
import HomeTanks from "../../../components/HomeTanks.astro";
|
||||
import HomeTechnical from "../../../components/HomeTechnical.astro";
|
||||
import HomeTools from "../../../components/HomeTools.astro";
|
||||
import Sections from "../../../components/Sections.astro";
|
||||
import { tools, type Tool } from "../../../config/tools";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
@@ -47,12 +53,13 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => {
|
||||
|
||||
<!-- {environment === "preview" && <AesonPlug />} -->
|
||||
|
||||
<Sections>
|
||||
<!-- <HomeTanks {locale} /> -->
|
||||
<!-- <HomePlayers {locale} /> -->
|
||||
<!-- <HomeGames {locale} /> -->
|
||||
<!-- <HomeCosmetics {locale} /> -->
|
||||
<!-- <HomeTechnical {locale} /> -->
|
||||
<Sections centered>
|
||||
<HomeTanks {locale} />
|
||||
<HomePlayers {locale} />
|
||||
<HomeGames {locale} />
|
||||
<HomeTools {locale} />
|
||||
<HomeCosmetics {locale} />
|
||||
<HomeTechnical {locale} />
|
||||
</Sections>
|
||||
</BaseLayout>
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ const { id, locale } = Astro.props;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
|
||||
gap: var(--space-4);
|
||||
|
||||
.sandbox {
|
||||
flex-grow: 1;
|
||||
|
||||
@@ -45,8 +43,12 @@ const { id, locale } = Astro.props;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
|
||||
@media (pointer: fine) {
|
||||
padding-top: var(--space-4);
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
|
||||
padding-inline: var(--page-padding);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,12 +57,15 @@ const { id, locale } = Astro.props;
|
||||
<BaseLayout tool={tools.tanks} {locale} accent="violet">
|
||||
<div class="page">
|
||||
<div class="sandbox">
|
||||
<TankopediaTitle {id} {locale} />
|
||||
<TankopediaSandbox {id} {locale} client:load />
|
||||
<TankopediaCharacteristics {id} {locale} client:load />
|
||||
<TankopediaGameModeAbilities {id} {locale} />
|
||||
<TankopediaVideos {id} {locale} />
|
||||
<TankopediaTabs {id} {locale} client:load />
|
||||
|
||||
<div class="content">
|
||||
<TankopediaTitle {id} {locale} />
|
||||
<TankopediaCharacteristics {id} {locale} client:load />
|
||||
<TankopediaGameModeAbilities {id} {locale} />
|
||||
<TankopediaVideos {id} {locale} />
|
||||
<TankopediaTabs {id} {locale} client:load />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TankopediaLoadout {id} {locale} client:load />
|
||||
|
||||
Reference in new issue
Block a user