From 8fa30e986e9c58c5eef5bb3407eb92ef7031a04a Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Sun, 29 Nov 2026 17:02:53 -0600 Subject: [PATCH] banner --- packages/i18n/strings/en.json | 14 ++ .../src/components/FullscreenSupport.astro | 7 - .../TankopediaLoadout/index.module.css | 6 - .../components/TankopediaLoadout/index.tsx | 6 +- .../src/components/TankopediaMeta.astro | 217 ++++++++++++++++++ .../components/TankopediaMetaListing.astro | 42 ++++ .../TankopediaTabs/index.module.css | 13 -- .../src/components/TankopediaTabs/index.tsx | 39 ---- .../src/components/TankopediaTitle.astro | 104 --------- .../src/components/VisibilityFlags.astro | 25 ++ packages/website/src/layouts/BaseLayout.astro | 7 +- .../[...locale]/tanks/[slug]/index.astro | 32 +-- packages/website/src/stores/app/index.ts | 2 +- packages/website/src/stores/tankopedia.ts | 9 - 14 files changed, 315 insertions(+), 208 deletions(-) delete mode 100644 packages/website/src/components/FullscreenSupport.astro create mode 100644 packages/website/src/components/TankopediaMeta.astro create mode 100644 packages/website/src/components/TankopediaMetaListing.astro delete mode 100644 packages/website/src/components/TankopediaTabs/index.module.css delete mode 100644 packages/website/src/components/TankopediaTabs/index.tsx delete mode 100644 packages/website/src/components/TankopediaTitle.astro create mode 100644 packages/website/src/components/VisibilityFlags.astro diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index c88064b56..6619bc1a4 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -198,6 +198,20 @@ "compare": "Compare" }, + "meta": { + "full_name": "Full name", + "nation": "Nation", + "class": "Class", + "tier": "Tier", + "type": "Type", + "dev_id": "DEV: ID", + "dev_name": "DEV: NAME", + "purchase": "Purchase price", + "restoration": "Restoration price", + "sale": "Sale price", + "research": "Research XP" + }, + "antagonist_control": { "calibrated_shells": "Calibrated shells", "enhanced_armor": "Enhanced armor", diff --git a/packages/website/src/components/FullscreenSupport.astro b/packages/website/src/components/FullscreenSupport.astro deleted file mode 100644 index 1d6985c69..000000000 --- a/packages/website/src/components/FullscreenSupport.astro +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/packages/website/src/components/TankopediaLoadout/index.module.css b/packages/website/src/components/TankopediaLoadout/index.module.css index 8898b479d..7c1bf05ec 100644 --- a/packages/website/src/components/TankopediaLoadout/index.module.css +++ b/packages/website/src/components/TankopediaLoadout/index.module.css @@ -20,10 +20,4 @@ max-height: none; overflow-y: visible; } - - @media (pointer: coarse) { - &[data-tabbed="false"] { - display: none; - } - } } diff --git a/packages/website/src/components/TankopediaLoadout/index.tsx b/packages/website/src/components/TankopediaLoadout/index.tsx index 799b5a6c7..d2952ba36 100644 --- a/packages/website/src/components/TankopediaLoadout/index.tsx +++ b/packages/website/src/components/TankopediaLoadout/index.tsx @@ -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 ( -
+
diff --git a/packages/website/src/components/TankopediaMeta.astro b/packages/website/src/components/TankopediaMeta.astro new file mode 100644 index 000000000..61e8d4938 --- /dev/null +++ b/packages/website/src/components/TankopediaMeta.astro @@ -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> = { + [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`); +--- + + + +
+
+
+
+
+ + {unwrap(tank.name)} + + + + + {nation} + + {tier} + + {type} + + +
+ +
+ {tank.name_full !== undefined && ( + + {unwrap(tank.name_full)} + + )} + + + {strings.common.tree_type[tank.type]} + + + {tank.type === TankType.TANK_TYPE_PREMIUM && ( + + {(price.value / 400).toLocaleString(locale)} + gold + + )} + + + {price.value.toLocaleString(locale)} + {currency} + + + + {(price.value / 2).toLocaleString(locale)} + {currency} + + + {researchXp !== undefined && ( + + {researchXp.toLocaleString(locale)} + xp + + )} + + + {tank.id} + + + + {tank.dev_name} + +
+
+
+
+
diff --git a/packages/website/src/components/TankopediaMetaListing.astro b/packages/website/src/components/TankopediaMetaListing.astro new file mode 100644 index 000000000..ce9873c31 --- /dev/null +++ b/packages/website/src/components/TankopediaMetaListing.astro @@ -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; +--- + + + +
+ {label} + + + + + + +
diff --git a/packages/website/src/components/TankopediaTabs/index.module.css b/packages/website/src/components/TankopediaTabs/index.module.css deleted file mode 100644 index 299496e3d..000000000 --- a/packages/website/src/components/TankopediaTabs/index.module.css +++ /dev/null @@ -1,13 +0,0 @@ -.tabs { - position: absolute; - - top: 0; - left: 50%; - transform: translateX(-50%); - - display: none; - - @media (pointer: coarse) { - display: flex; - } -} diff --git a/packages/website/src/components/TankopediaTabs/index.tsx b/packages/website/src/components/TankopediaTabs/index.tsx deleted file mode 100644 index 56f8fc610..000000000 --- a/packages/website/src/components/TankopediaTabs/index.tsx +++ /dev/null @@ -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(Content) -); - -function Content({ id }: TankopediaTabsProps) { - Tankopedia.useInitialization(() => tanks.tanks[id], import.meta.env.SSR); - - const tab = Tankopedia.use((state) => state.tab); - - return ( - { - Tankopedia.mutate((state) => { - state.tab = value as TankopediaTab; - }); - }} - variant="overline" - /> - ); -} diff --git a/packages/website/src/components/TankopediaTitle.astro b/packages/website/src/components/TankopediaTitle.astro deleted file mode 100644 index 548a37423..000000000 --- a/packages/website/src/components/TankopediaTitle.astro +++ /dev/null @@ -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]); ---- - - - -
-
- - - {strings.tanks.title.all_tanks} - - - - -
- {unwrap(tank.name)} - - - {nation} - - {tier} - - {type} - -
-
-
diff --git a/packages/website/src/components/VisibilityFlags.astro b/packages/website/src/components/VisibilityFlags.astro new file mode 100644 index 000000000..35cb5bc01 --- /dev/null +++ b/packages/website/src/components/VisibilityFlags.astro @@ -0,0 +1,25 @@ + diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro index 84bc58f78..0e51d832c 100644 --- a/packages/website/src/layouts/BaseLayout.astro +++ b/packages/website/src/layouts/BaseLayout.astro @@ -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; - + + @@ -102,8 +91,8 @@ const { id, locale } = Astro.props;
-
- +
+
@@ -114,7 +103,6 @@ const { id, locale } = Astro.props; -
diff --git a/packages/website/src/stores/app/index.ts b/packages/website/src/stores/app/index.ts index 8dceff200..d400453d9 100644 --- a/packages/website/src/stores/app/index.ts +++ b/packages/website/src/stores/app/index.ts @@ -22,5 +22,5 @@ export const App = new Soapstone( policiesAgreementIndex: -1, logins: {}, }, - "app-2" + "app-2", ); diff --git a/packages/website/src/stores/tankopedia.ts b/packages/website/src/stores/tankopedia.ts index c88894311..c9bfb34b8 100644 --- a/packages/website/src/stores/tankopedia.ts +++ b/packages/website/src/stores/tankopedia.ts @@ -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((tank) => ({ @@ -140,8 +133,6 @@ export const Tankopedia = new Soapstone((tank) => ({ showControls: false, animate: true, - tab: TankopediaTab.Sandbox, - protagonist: createTankState(tank), antagonist: createTankState(tank), environment: createDefaultEnvironment(skills),