home page

This commit is contained in:
tresabhi committed 2026-11-28 16:05:47 -06:00
1 parent b9482e3164
commit a0660fc2ac
22 files changed
+190 -66

No files matched your search

@@ -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));
+18 -2
View File
@@ -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