From a40860901b5182f74deed7fba57dd6d3d627a3d1 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Fri, 15 May 2026 21:41:40 -0500 Subject: [PATCH] stock/upgrade buttons --- .../src/components/Button/index.module.css | 16 ++++- .../src/components/Button/index.tsx | 5 +- .../components/IconButton/index.module.css | 2 +- .../TankopediaLoadout/index.module.css | 60 +++++++++++-------- .../components/TankopediaLoadout/index.tsx | 55 +++++++++++++++-- .../[...locale]/tanks/[slug]/index.astro | 4 ++ 6 files changed, 111 insertions(+), 31 deletions(-) diff --git a/packages/website-ue/src/components/Button/index.module.css b/packages/website-ue/src/components/Button/index.module.css index ecb519533..cb37faff6 100644 --- a/packages/website-ue/src/components/Button/index.module.css +++ b/packages/website-ue/src/components/Button/index.module.css @@ -14,7 +14,9 @@ color: var(--gray-1); font-weight: var(--weight-medium); - .svg { + cursor: pointer; + + svg { width: 1em; height: 1em; } @@ -32,6 +34,18 @@ background-color: var(--accent-3); } + &[data-variant="inverted"] { + background-color: var(--accent-12); + color: var(--accent-1); + } + + &[data-variant="ghost"] { + background: none; + color: var(--accent-11); + + padding: 0; + } + &[data-variant="surface"] { outline: var(--space-1) solid var(--accent-6); } diff --git a/packages/website-ue/src/components/Button/index.tsx b/packages/website-ue/src/components/Button/index.tsx index 565b7657e..bc5a4736e 100644 --- a/packages/website-ue/src/components/Button/index.tsx +++ b/packages/website-ue/src/components/Button/index.tsx @@ -6,7 +6,8 @@ import styles from "./index.module.css"; export interface ButtonProps extends ComponentProps<"button"> { color?: Color; radius?: `${1 | 2 | 3}` | "max"; - variant?: "solid" | "surface" | "soft"; + variant?: "solid" | "surface" | "soft" | "inverted" | "ghost"; + size?: "regular"; } export const LIGHT_TEXT_COLORS = new Set([ @@ -30,6 +31,7 @@ export function Button({ variant = "solid", style, radius = "max", + size = "regular", ...props }: ButtonProps) { return ( @@ -39,6 +41,7 @@ export function Button({ data-variant={variant} data-light-text={variant === "solid"} data-radius={radius} + data-size={size} {...props} /> ); diff --git a/packages/website-ue/src/components/IconButton/index.module.css b/packages/website-ue/src/components/IconButton/index.module.css index 5f02bf489..8819c175c 100644 --- a/packages/website-ue/src/components/IconButton/index.module.css +++ b/packages/website-ue/src/components/IconButton/index.module.css @@ -3,5 +3,5 @@ aspect-ratio: 1 / 1; - font-size: 2em; + font-size: var(--font-size-regular); } diff --git a/packages/website-ue/src/components/TankopediaLoadout/index.module.css b/packages/website-ue/src/components/TankopediaLoadout/index.module.css index d26528faf..c967309b5 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.module.css +++ b/packages/website-ue/src/components/TankopediaLoadout/index.module.css @@ -1,42 +1,54 @@ -.lines { +.section { display: flex; flex-direction: column; + gap: var(--space-4); - gap: var(--space-3); - - .line { + .header { display: flex; align-items: center; + gap: var(--space-3); + } + + .lines { + display: flex; + flex-direction: column; gap: var(--space-3); - .stage { - position: relative; + .line { + display: flex; + align-items: center; - padding: var(--space-3); + gap: var(--space-3); - font-size: 2em; + .stage { + position: relative; - .icon { - width: 1em; - height: 1em; + padding: var(--space-3); - padding: var(--space-3) 0; + font-size: 2em; - transform: translate(var(--space-1), calc(-1 * var(--space-1))); - } + .icon { + width: 1em; + height: 1em; - .tier { - position: absolute; - left: var(--space-2); - top: var(--space-2); - } + padding: var(--space-3) 0; - .price { - position: absolute; - left: 50%; - bottom: var(--space-2); - transform: translateX(-50%); + transform: translate(var(--space-1), calc(-1 * var(--space-1))); + } + + .tier { + position: absolute; + left: var(--space-2); + top: var(--space-2); + } + + .price { + position: absolute; + left: 50%; + bottom: var(--space-2); + transform: translateX(-50%); + } } } } diff --git a/packages/website-ue/src/components/TankopediaLoadout/index.tsx b/packages/website-ue/src/components/TankopediaLoadout/index.tsx index a3db1c873..b6a5627b7 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.tsx +++ b/packages/website-ue/src/components/TankopediaLoadout/index.tsx @@ -3,6 +3,7 @@ import { Grade } from "@protos/game/proto/legacy/blitz_static_standard_grades_en import type { StandardPrice } from "@protos/game/proto/legacy/blitz_static_standard_price"; import type { UpgradeLine } from "@protos/game/proto/legacy/blitz_static_tank_upgrade_line"; import type { StageParameters } from "@protos/game/proto/legacy/blitz_static_tank_upgrade_single_stage"; +import { DoubleArrowDownIcon, DoubleArrowUpIcon } from "@radix-ui/react-icons"; import { useMemo } from "react"; import { alternativeLines, @@ -15,19 +16,65 @@ import { useUpgradePreset } from "../../hooks/useUpgradePreset"; import { Tankopedia } from "../../stores/tankopedia"; import { Button } from "../Button"; import { Heading } from "../Heading"; +import { IconButton } from "../IconButton"; import { Price } from "../Price"; import { Section } from "../Section"; import { Text } from "../Text"; import styles from "./index.module.css"; export function TankopediaLoadout() { - const strings = useStrings(); + return ( +
+ +
+ ); +} +function Modules() { + const strings = useStrings(); const tank = useProtagonist(); return ( -
- {strings.tanks.loadout.modules} +
+
+ {strings.tanks.loadout.modules} + + { + Tankopedia.mutate((draft) => { + for (const line of tank.tank!.upgrade_lines) { + if (isAlternativeLine(line.name)) continue; + + draft.protagonist.upgrades[line.name] = 0; + draft.protagonist.alternates[line.name] = false; + } + }); + }} + color="tomato" + variant="ghost" + > + + + + { + Tankopedia.mutate((draft) => { + for (const line of tank.tank!.upgrade_lines) { + draft.protagonist.upgrades[line.name] = line.stages.length - 1; + + if (isAlternativeLine(line.name)) { + const original = originalLineName(line.name)!; + draft.protagonist.alternates[original] = true; + } + } + }); + }} + color="jade" + variant="ghost" + > + + +
{tank.tank!.upgrade_lines.map((line) => ( @@ -38,7 +85,7 @@ export function TankopediaLoadout() { /> ))}
-
+ ); } diff --git a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro index bc3db8c20..1000dc533 100644 --- a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro @@ -2,6 +2,7 @@ import "@radix-ui/colors/violet-dark.css"; import { api } from "../../../../api/dynamic"; import { mixStaticPaths } from "../../../../astro/mixStaticPaths"; +import ColorScale from "../../../../components/ColorScale.astro"; import BaseLayout from "../../../../layouts/BaseLayout.astro"; import { getStaticPaths as _getStaticPaths } from "../index.astro"; import { Page } from "./_index"; @@ -19,5 +20,8 @@ const { id, locale } = Astro.props; --- + + +