mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-30 05:14:06 +01:00
banner
This commit is contained in:
14 files changed
+315
-208
No files matched your search
@@ -1,7 +0,0 @@
|
||||
<script is:inline>
|
||||
// Runs before hydration so fullscreen controls never pop in late
|
||||
document.documentElement.style.setProperty(
|
||||
"--fullscreen-display",
|
||||
document.fullscreenEnabled ? "flex" : "none",
|
||||
);
|
||||
</script>
|
||||
@@ -20,10 +20,4 @@
|
||||
max-height: none;
|
||||
overflow-y: visible;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
&[data-tabbed="false"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { api } from "../../api/dynamic";
|
||||
import { withErrorWrapper } from "../../hocs/withErrorWrapper";
|
||||
import { withLocale } from "../../hocs/withLocale";
|
||||
import { useDuelModules } from "../../hooks/useDuelModules";
|
||||
import { Tankopedia, TankopediaTab } from "../../stores/tankopedia";
|
||||
import { Tankopedia } from "../../stores/tankopedia";
|
||||
import { createAugments, toggleAugment } from "../../tankopedia/augments";
|
||||
import { selectModule } from "../../tankopedia/selectModule";
|
||||
import { LoadoutAugments } from "../LoadoutAugments";
|
||||
@@ -32,10 +32,8 @@ export const TankopediaLoadout = withErrorWrapper(
|
||||
function Content({ id }: TankopediaLoadoutProps) {
|
||||
Tankopedia.useInitialization(() => tanks.tanks[id], import.meta.env.SSR);
|
||||
|
||||
const tabbed = Tankopedia.use((state) => state.tab === TankopediaTab.Loadout);
|
||||
|
||||
return (
|
||||
<div className={styles.loadout} data-tabbed={tabbed}>
|
||||
<div className={styles.loadout}>
|
||||
<ScrollerCurtains orientation={ScrollerOrientation.Vertical} />
|
||||
<Modules />
|
||||
<Augments />
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
---
|
||||
import { alias, romanize } from "@blitzkit/core";
|
||||
import { unwrapper } from "@blitzkit/i18n";
|
||||
import { TankPriceType, TankType } from "@blitzkit/protos";
|
||||
import { CaretRightIcon } from "@radix-ui/react-icons";
|
||||
import { api } from "../api/dynamic";
|
||||
import type { ColorWithBW } from "../ui/color";
|
||||
import { Code } from "./Code";
|
||||
import { Heading } from "./Heading";
|
||||
import TankopediaMetaListing from "./TankopediaMetaListing.astro";
|
||||
import { Text } from "./Text";
|
||||
|
||||
interface Props {
|
||||
id: number;
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const TYPE_COLORS: Partial<Record<TankType, ColorWithBW>> = {
|
||||
[TankType.TANK_TYPE_PREMIUM]: "amber",
|
||||
[TankType.TANK_TYPE_COLLECTOR]: "blue",
|
||||
};
|
||||
|
||||
const { id, locale } = Astro.props;
|
||||
|
||||
const [tanks, strings] = await Promise.all([api.tanks(), api.strings(locale)]);
|
||||
const tank = tanks.tanks[id];
|
||||
const unwrap = unwrapper(locale);
|
||||
const nation =
|
||||
strings.common.nations[tank.nation as keyof typeof strings.common.nations];
|
||||
const tier = romanize(tank.tier);
|
||||
const type = strings.common.tank_class_medium[tank.class];
|
||||
const price = tank.price!;
|
||||
const currency =
|
||||
price.type === TankPriceType.TANK_PRICE_TYPE_GOLD ? "gold" : "silver";
|
||||
const currencyIcon = alias("api", `icons/currencies/${currency}.webp`);
|
||||
const researchXp =
|
||||
tank.research_cost?.research_cost_type?.$case === "xp"
|
||||
? tank.research_cost.research_cost_type.value
|
||||
: undefined;
|
||||
const priceLabel =
|
||||
tank.type === TankType.TANK_TYPE_RESEARCHABLE
|
||||
? strings.tanks.meta.purchase
|
||||
: strings.tanks.meta.restoration;
|
||||
const wallpaper = `/media/national-wallpapers/${tank.nation}.jpg`;
|
||||
const flag = alias("api", `nations/${tank.nation}/flags/scratched.webp`);
|
||||
---
|
||||
|
||||
<style>
|
||||
.tankopedia-meta {
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
|
||||
&[data-nation="germany"],
|
||||
&[data-nation="france"],
|
||||
&[data-nation="other"] {
|
||||
background-position: 50% 35%;
|
||||
}
|
||||
|
||||
.flag {
|
||||
background-repeat: no-repeat;
|
||||
background-size: min(53rem, 80vw);
|
||||
background-position: -8rem 50%;
|
||||
|
||||
.gradient {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
padding-block: 6rem;
|
||||
padding-inline: var(--space-5);
|
||||
|
||||
container-type: inline-size;
|
||||
|
||||
background: linear-gradient(
|
||||
var(--black-a12),
|
||||
var(--black-a9),
|
||||
var(--gray-1)
|
||||
);
|
||||
|
||||
.frame {
|
||||
flex-grow: 1;
|
||||
max-width: 75rem;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: var(--space-6);
|
||||
|
||||
@container (width < 40rem) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.identity {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
|
||||
@container (width < 40rem) {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:global(.name) {
|
||||
font-size: clamp(var(--font-size-heading-1), 8vw, 5rem);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.path {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
|
||||
:global(.caret) {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.listings {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
|
||||
.icon {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<section
|
||||
class="tankopedia-meta"
|
||||
data-nation={tank.nation}
|
||||
style={{ backgroundImage: `url(${wallpaper})` }}
|
||||
>
|
||||
<div class="flag" style={{ backgroundImage: `url(${flag})` }}>
|
||||
<div class="gradient">
|
||||
<div class="frame">
|
||||
<div class="identity">
|
||||
<Heading className="name" size="1">
|
||||
{unwrap(tank.name)}
|
||||
</Heading>
|
||||
|
||||
<Text lowContrast>
|
||||
<span class="path">
|
||||
{nation}
|
||||
<CaretRightIcon className="caret" />
|
||||
{tier}
|
||||
<CaretRightIcon className="caret" />
|
||||
{type}
|
||||
</span>
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
<div class="listings">
|
||||
{tank.name_full !== undefined && (
|
||||
<TankopediaMetaListing label={strings.tanks.meta.full_name}>
|
||||
{unwrap(tank.name_full)}
|
||||
</TankopediaMetaListing>
|
||||
)}
|
||||
|
||||
<TankopediaMetaListing
|
||||
label={strings.tanks.meta.type}
|
||||
color={TYPE_COLORS[tank.type]}
|
||||
>
|
||||
{strings.common.tree_type[tank.type]}
|
||||
</TankopediaMetaListing>
|
||||
|
||||
{tank.type === TankType.TANK_TYPE_PREMIUM && (
|
||||
<TankopediaMetaListing label={strings.tanks.meta.purchase}>
|
||||
{(price.value / 400).toLocaleString(locale)}
|
||||
<img
|
||||
class="icon"
|
||||
alt="gold"
|
||||
src={alias("api", "icons/currencies/gold.webp")}
|
||||
/>
|
||||
</TankopediaMetaListing>
|
||||
)}
|
||||
|
||||
<TankopediaMetaListing label={priceLabel}>
|
||||
{price.value.toLocaleString(locale)}
|
||||
<img class="icon" alt={currency} src={currencyIcon} />
|
||||
</TankopediaMetaListing>
|
||||
|
||||
<TankopediaMetaListing label={strings.tanks.meta.sale}>
|
||||
{(price.value / 2).toLocaleString(locale)}
|
||||
<img class="icon" alt={currency} src={currencyIcon} />
|
||||
</TankopediaMetaListing>
|
||||
|
||||
{researchXp !== undefined && (
|
||||
<TankopediaMetaListing label={strings.tanks.meta.research}>
|
||||
{researchXp.toLocaleString(locale)}
|
||||
<img
|
||||
class="icon"
|
||||
alt="xp"
|
||||
src={alias("api", "icons/currencies/xp.webp")}
|
||||
/>
|
||||
</TankopediaMetaListing>
|
||||
)}
|
||||
|
||||
<TankopediaMetaListing label={strings.tanks.meta.dev_id} developer>
|
||||
<Code>{tank.id}</Code>
|
||||
</TankopediaMetaListing>
|
||||
|
||||
<TankopediaMetaListing label={strings.tanks.meta.dev_name} developer>
|
||||
<Code>{tank.dev_name}</Code>
|
||||
</TankopediaMetaListing>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
import type { ColorWithBW } from "../ui/color";
|
||||
import { Text } from "./Text";
|
||||
|
||||
interface Props {
|
||||
label: string;
|
||||
color?: ColorWithBW;
|
||||
developer?: boolean;
|
||||
}
|
||||
|
||||
const { label, color, developer = false } = Astro.props;
|
||||
---
|
||||
|
||||
<style>
|
||||
.tankopedia-meta-listing {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-6);
|
||||
|
||||
&[data-developer="true"] {
|
||||
display: var(--developer-mode-display, none);
|
||||
}
|
||||
|
||||
.value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="tankopedia-meta-listing" data-developer={`${developer}`}>
|
||||
<Text lowContrast>{label}</Text>
|
||||
|
||||
<Text color={color}>
|
||||
<span class="value">
|
||||
<slot />
|
||||
</span>
|
||||
</Text>
|
||||
</div>
|
||||
@@ -1,13 +0,0 @@
|
||||
.tabs {
|
||||
position: absolute;
|
||||
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
display: none;
|
||||
|
||||
@media (pointer: coarse) {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
import { api } from "../../api/dynamic";
|
||||
import { withErrorWrapper } from "../../hocs/withErrorWrapper";
|
||||
import { withLocale } from "../../hocs/withLocale";
|
||||
import { Tankopedia, TankopediaTab } from "../../stores/tankopedia";
|
||||
import { SegmentedControl } from "../SegmentedControl";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
const tanks = await api.tanks();
|
||||
|
||||
interface TankopediaTabsProps {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export const TankopediaTabs = withErrorWrapper(
|
||||
withLocale<TankopediaTabsProps>(Content)
|
||||
);
|
||||
|
||||
function Content({ id }: TankopediaTabsProps) {
|
||||
Tankopedia.useInitialization(() => tanks.tanks[id], import.meta.env.SSR);
|
||||
|
||||
const tab = Tankopedia.use((state) => state.tab);
|
||||
|
||||
return (
|
||||
<SegmentedControl
|
||||
className={styles.tabs}
|
||||
value={tab}
|
||||
options={[
|
||||
{ label: "Sandbox", value: TankopediaTab.Sandbox },
|
||||
{ label: "Loadout", value: TankopediaTab.Loadout },
|
||||
]}
|
||||
onValueChange={(value) => {
|
||||
Tankopedia.mutate((state) => {
|
||||
state.tab = value as TankopediaTab;
|
||||
});
|
||||
}}
|
||||
variant="overline"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
---
|
||||
import { alias, romanize } from "@blitzkit/core";
|
||||
import { unwrapper } from "@blitzkit/i18n";
|
||||
import { ArrowLeftIcon, CaretRightIcon } from "@radix-ui/react-icons";
|
||||
import { stringify } from "urlon";
|
||||
import { api } from "../api/dynamic";
|
||||
import { Heading } from "./Heading";
|
||||
import { LinkI18n } from "./LinkI18n";
|
||||
import { Text } from "./Text";
|
||||
|
||||
interface Props {
|
||||
id: number;
|
||||
locale: string;
|
||||
}
|
||||
|
||||
const { id, locale } = Astro.props;
|
||||
|
||||
const [tanks, strings] = await Promise.all([api.tanks(), api.strings(locale)]);
|
||||
const tank = tanks.tanks[id];
|
||||
const nation =
|
||||
strings.common.nations[tank.nation as keyof typeof strings.common.nations];
|
||||
const tier = romanize(tank.tier);
|
||||
const type = strings.common.tank_class_medium[tank.class];
|
||||
|
||||
const unwrap = unwrapper(locale);
|
||||
const compareState = stringify([id]);
|
||||
---
|
||||
|
||||
<style>
|
||||
.tankopedia-title {
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
background-position: right;
|
||||
|
||||
border-radius: var(--space-3);
|
||||
overflow: hidden;
|
||||
|
||||
.gradient {
|
||||
padding: var(--space-4);
|
||||
padding-right: var(--space-5);
|
||||
|
||||
background: linear-gradient(
|
||||
270deg,
|
||||
var(--black-a5),
|
||||
var(--gray-1) var(--space-7)
|
||||
);
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.identity {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: var(--space-2);
|
||||
|
||||
.path {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
|
||||
svg {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
class="tankopedia-title"
|
||||
style={{
|
||||
backgroundImage: `url(${alias("api", `nations/${tank.nation}/flags/fade.webp`)})`,
|
||||
}}
|
||||
>
|
||||
<div class="gradient">
|
||||
<LinkI18n underline="hover" {locale} href="/tanks">
|
||||
<ArrowLeftIcon />
|
||||
{strings.tanks.title.all_tanks}
|
||||
</LinkI18n>
|
||||
|
||||
<!-- <LinkI18nWrapper {locale} href={`/compare?state=${compareState}`}>
|
||||
<Button variant="outline">
|
||||
<PlusIcon />
|
||||
{strings.tanks.title.compare}
|
||||
</Button>
|
||||
</LinkI18nWrapper> -->
|
||||
|
||||
<div class="identity">
|
||||
<Heading size="2">{unwrap(tank.name)}</Heading>
|
||||
|
||||
<Text className="path" lowContrast>
|
||||
{nation}
|
||||
<CaretRightIcon />
|
||||
{tier}
|
||||
<CaretRightIcon />
|
||||
{type}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
<script>
|
||||
import { App } from "../stores/app";
|
||||
|
||||
// Runs before hydration so conditional content never pops in late
|
||||
const root = document.documentElement.style;
|
||||
|
||||
root.setProperty(
|
||||
"--fullscreen-display",
|
||||
document.fullscreenEnabled ? "flex" : "none",
|
||||
);
|
||||
root.setProperty(
|
||||
"--developer-mode-display",
|
||||
App.state.developerMode ? "flex" : "none",
|
||||
);
|
||||
|
||||
App.on(
|
||||
(state) => state.developerMode,
|
||||
(developerMode) => {
|
||||
root.setProperty(
|
||||
"--developer-mode-display",
|
||||
developerMode ? "flex" : "none",
|
||||
);
|
||||
},
|
||||
);
|
||||
</script>
|
||||
@@ -2,12 +2,12 @@
|
||||
import AutoFocus from "../components/AutoFocus.astro";
|
||||
import BaseMeta from "../components/BaseMeta.astro";
|
||||
import BaseStyles from "../components/BaseStyles.astro";
|
||||
import FullscreenSupport from "../components/FullscreenSupport.astro";
|
||||
import ColorAlias from "../components/ColorAlias.astro";
|
||||
import ColorScale from "../components/ColorScale.astro";
|
||||
import NavbarSmall from "../components/NavbarSmall.astro";
|
||||
import NavbarBig from "../components/NavbarBig.astro";
|
||||
import NavbarSmall from "../components/NavbarSmall.astro";
|
||||
import SystemTheme from "../components/SystemTheme.astro";
|
||||
import VisibilityFlags from "../components/VisibilityFlags.astro";
|
||||
import type { Tool } from "../config/tools";
|
||||
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
||||
import type { Color } from "../ui/color";
|
||||
@@ -36,7 +36,8 @@ const { locale, accent, solidNavbar = false, tool } = Astro.props;
|
||||
<ColorAlias color={accent} alias="accent" />
|
||||
|
||||
<BaseStyles />
|
||||
<FullscreenSupport />
|
||||
|
||||
<VisibilityFlags />
|
||||
|
||||
<style>
|
||||
:root {
|
||||
|
||||
+10
-22
@@ -5,10 +5,9 @@ import ColorRanks from "../../../../../components/ColorRanks.astro";
|
||||
import ColorScale from "../../../../../components/ColorScale.astro";
|
||||
import { TankopediaCharacteristics } from "../../../../../components/TankopediaCharacteristics";
|
||||
import TankopediaGameModeAbilities from "../../../../../components/TankopediaGameModeAbilities.astro";
|
||||
import TankopediaMeta from "../../../../../components/TankopediaMeta.astro";
|
||||
import { TankopediaLoadout } from "../../../../../components/TankopediaLoadout";
|
||||
import { TankopediaSandbox } from "../../../../../components/TankopediaSandbox";
|
||||
import { TankopediaTabs } from "../../../../../components/TankopediaTabs";
|
||||
import TankopediaTitle from "../../../../../components/TankopediaTitle.astro";
|
||||
import TankopediaVideos from "../../../../../components/TankopediaVideos.astro";
|
||||
import { tools } from "../../../../../config/tools";
|
||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||
@@ -29,6 +28,8 @@ const { id, locale } = Astro.props;
|
||||
<ColorScale color="ruby" />
|
||||
<ColorScale color="cyan" />
|
||||
<ColorScale color="green" />
|
||||
<ColorScale color="amber" />
|
||||
<ColorScale color="blue" />
|
||||
<ColorRanks />
|
||||
|
||||
<style>
|
||||
@@ -40,17 +41,15 @@ const { id, locale } = Astro.props;
|
||||
grid-template-rows: auto auto 1fr;
|
||||
grid-template-areas:
|
||||
"sandbox loadout"
|
||||
"title loadout"
|
||||
"meta loadout"
|
||||
"content loadout";
|
||||
row-gap: var(--space-4);
|
||||
|
||||
.sandbox {
|
||||
grid-area: sandbox;
|
||||
}
|
||||
|
||||
.title {
|
||||
grid-area: title;
|
||||
padding-inline: var(--page-padding);
|
||||
.meta {
|
||||
grid-area: meta;
|
||||
}
|
||||
|
||||
.loadout {
|
||||
@@ -70,13 +69,8 @@ const { id, locale } = Astro.props;
|
||||
@media (width < 74rem) {
|
||||
grid-template-areas:
|
||||
"sandbox sandbox"
|
||||
"title loadout"
|
||||
"meta loadout"
|
||||
"content loadout";
|
||||
row-gap: 0;
|
||||
|
||||
.title {
|
||||
padding-block: var(--space-4);
|
||||
}
|
||||
}
|
||||
|
||||
@media (width < 44rem) {
|
||||
@@ -84,14 +78,9 @@ const { id, locale } = Astro.props;
|
||||
grid-template-rows: auto auto auto 1fr;
|
||||
grid-template-areas:
|
||||
"sandbox"
|
||||
"title"
|
||||
"meta"
|
||||
"loadout"
|
||||
"content";
|
||||
row-gap: var(--space-4);
|
||||
|
||||
.title {
|
||||
padding-block: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -102,8 +91,8 @@ const { id, locale } = Astro.props;
|
||||
<TankopediaSandbox {id} {locale} client:load />
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<TankopediaTitle {id} {locale} />
|
||||
<div class="meta">
|
||||
<TankopediaMeta {id} {locale} />
|
||||
</div>
|
||||
|
||||
<div class="loadout">
|
||||
@@ -114,7 +103,6 @@ const { id, locale } = Astro.props;
|
||||
<TankopediaCharacteristics {id} {locale} client:load />
|
||||
<TankopediaGameModeAbilities {id} {locale} />
|
||||
<TankopediaVideos {id} {locale} />
|
||||
<TankopediaTabs {id} {locale} client:load />
|
||||
</div>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
@@ -22,5 +22,5 @@ export const App = new Soapstone<App>(
|
||||
policiesAgreementIndex: -1,
|
||||
logins: {},
|
||||
},
|
||||
"app-2"
|
||||
"app-2",
|
||||
);
|
||||
@@ -102,8 +102,6 @@ interface Tankopedia {
|
||||
showControls: boolean;
|
||||
animate: boolean;
|
||||
|
||||
tab: TankopediaTab;
|
||||
|
||||
protagonist: TankState;
|
||||
antagonist: TankState;
|
||||
environment: TankEnvironment;
|
||||
@@ -127,11 +125,6 @@ interface Tankopedia {
|
||||
// statSearch?: string;
|
||||
}
|
||||
|
||||
export enum TankopediaTab {
|
||||
Sandbox = "sandbox",
|
||||
Loadout = "loadout",
|
||||
}
|
||||
|
||||
const skills = await api.skills();
|
||||
|
||||
export const Tankopedia = new Soapstone<Tankopedia, TankDefinition>((tank) => ({
|
||||
@@ -140,8 +133,6 @@ export const Tankopedia = new Soapstone<Tankopedia, TankDefinition>((tank) => ({
|
||||
showControls: false,
|
||||
animate: true,
|
||||
|
||||
tab: TankopediaTab.Sandbox,
|
||||
|
||||
protagonist: createTankState(tank),
|
||||
antagonist: createTankState(tank),
|
||||
environment: createDefaultEnvironment(skills),
|
||||
|
||||
Reference in new issue
Block a user