From d66d25a2610dd6b66e68c77aa1578069a074b2cb Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Tue, 19 May 2026 13:20:54 -0500 Subject: [PATCH] module wrapping --- .../src/components/Link/index.module.css | 1 + .../src/components/Price/index.module.css | 3 + .../website-ue/src/components/Price/index.tsx | 10 +++- .../TankopediaLoadout/index.module.css | 59 ++++++++++++------- .../components/TankopediaLoadout/index.tsx | 52 +++++++++++----- packages/website-ue/src/config/modules.ts | 2 + .../[...locale]/tanks/[slug]/index.astro | 3 - 7 files changed, 87 insertions(+), 43 deletions(-) diff --git a/packages/website-ue/src/components/Link/index.module.css b/packages/website-ue/src/components/Link/index.module.css index 7124ed8a1..1923d98f1 100644 --- a/packages/website-ue/src/components/Link/index.module.css +++ b/packages/website-ue/src/components/Link/index.module.css @@ -1,5 +1,6 @@ .link { text-decoration-color: currentColor; + cursor: pointer; display: inline; align-items: center; diff --git a/packages/website-ue/src/components/Price/index.module.css b/packages/website-ue/src/components/Price/index.module.css index 3bfc7cd39..e8617ca7d 100644 --- a/packages/website-ue/src/components/Price/index.module.css +++ b/packages/website-ue/src/components/Price/index.module.css @@ -1,11 +1,14 @@ .price { + font-size: var(--font-size-minor); display: flex; gap: var(--space-3); + height: 1em; .entry { display: block; line-height: 1; + font-size: inherit; .wrapper { display: flex; diff --git a/packages/website-ue/src/components/Price/index.tsx b/packages/website-ue/src/components/Price/index.tsx index 3c2051f39..128051e31 100644 --- a/packages/website-ue/src/components/Price/index.tsx +++ b/packages/website-ue/src/components/Price/index.tsx @@ -17,6 +17,12 @@ export function Price({ price, className, ...props }: PriceProps) { {price.price_list.map((entry, index) => ( ))} + + {price.price_list.length === 0 && ( + + Free + + )} ); } @@ -27,8 +33,6 @@ interface PriceEntryProps { function PriceEntry({ entry }: PriceEntryProps) { if (entry.premium_time_price !== undefined) { - console.log(entry); - throw new Error("Unsupported price type"); } @@ -60,7 +64,7 @@ function PriceInternal({ icon, value }: PriceInternalProps) { const locale = useLocale(); return ( - +
{formatCompact(locale, value)} diff --git a/packages/website-ue/src/components/TankopediaLoadout/index.module.css b/packages/website-ue/src/components/TankopediaLoadout/index.module.css index 74e4b61a8..9276c3158 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.module.css +++ b/packages/website-ue/src/components/TankopediaLoadout/index.module.css @@ -60,40 +60,57 @@ .line { display: flex; + flex-direction: column; gap: var(--space-3); - .wrapper { + .line-wrap { display: flex; - flex-direction: column; align-items: center; - gap: var(--space-2); - .stage { - position: relative; + gap: var(--space-3); - padding: var(--space-3); + .wrap-marker { + padding-bottom: var(--font-size-minor); - font-size: 2em; - - .icon { + svg { width: 1em; height: 1em; - - transform: translate(var(--space-1), var(--space-1)); } + } - .tier { - position: absolute; - left: var(--space-2); - top: var(--space-2); - } + .wrapper { + display: flex; + flex-direction: column; + align-items: center; + gap: var(--space-2); - .price { - position: absolute; - left: 50%; - bottom: var(--space-2); - transform: translateX(-50%); + .stage { + position: relative; + + padding: var(--space-3); + + font-size: 2em; + + .icon { + width: 1em; + height: 1em; + + transform: translate(var(--space-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 55083e4d3..adfbe6543 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.tsx +++ b/packages/website-ue/src/components/TankopediaLoadout/index.tsx @@ -1,10 +1,14 @@ import { romanize } from "@blitzkit/core"; import type { BlitzStaticEquipmentPresetComponent_EquipmentSlot } from "@protos/blitz_static_equipment_preset_component"; import { Grade } from "@protos/blitz_static_standard_grades_enum"; -import type { StandardPrice } from "@protos/blitz_static_standard_price"; +import { StandardPrice } from "@protos/blitz_static_standard_price"; import type { UpgradeLine } from "@protos/blitz_static_tank_upgrade_line"; import type { StageParameters } from "@protos/blitz_static_tank_upgrade_single_stage"; -import { DoubleArrowDownIcon, DoubleArrowUpIcon } from "@radix-ui/react-icons"; +import { + CornerBottomLeftIcon, + DoubleArrowLeftIcon, + DoubleArrowRightIcon, +} from "@radix-ui/react-icons"; import { chunk } from "lodash-es"; import { useMemo } from "react"; import { equipmentColumns } from "../../config/equipment"; @@ -12,6 +16,7 @@ import { catImages } from "../../config/images"; import { alternativeLines, isAlternativeLine, + maxModulesPerRow, originalLineName, } from "../../config/modules"; import { useEquipment } from "../../hooks/useEquipment"; @@ -21,7 +26,7 @@ import { useUpgradePreset } from "../../hooks/useUpgradePreset"; import { Tankopedia } from "../../stores/tankopedia"; import { Button } from "../Button"; import { Heading } from "../Heading"; -import { IconButton } from "../IconButton"; +import { Link } from "../Link"; import { Price } from "../Price"; import { Section } from "../Section"; import { Text } from "../Text"; @@ -167,7 +172,7 @@ function Modules() {
{strings.tanks.loadout.modules} - { Tankopedia.mutate((draft) => { for (const line of tank.tank!.upgrade_lines) { @@ -178,13 +183,12 @@ function Modules() { } }); }} - color="tomato" - variant="ghost" + color="gray" > - - + + - { Tankopedia.mutate((draft) => { for (const line of tank.tank!.upgrade_lines) { @@ -197,11 +201,10 @@ function Modules() { } }); }} - color="jade" - variant="ghost" + color="gray" > - - + +
@@ -254,8 +257,23 @@ function Line({ name, lines }: LineProps) { function LineInner({ name, lines }: LineProps) { const line = lines.find((line) => line.name === name)!; - return line.stages.map((stage, index) => ( - + return chunk(line.stages, maxModulesPerRow).map((chunk, wrapIndex) => ( +
+ {wrapIndex > 0 && ( + + + + )} + + {chunk.map((stage, elementIndex) => ( + + ))} +
)); } @@ -297,6 +315,8 @@ function LineElement({ index, lineName, stage }: LineElementProps) { price = override.price; } + price ??= StandardPrice.create(); + let isSelected: boolean; if (isAlternativeLine(lineName)) { @@ -395,7 +415,7 @@ function LineElement({ index, lineName, stage }: LineElementProps) { - {price && } + {}
); } diff --git a/packages/website-ue/src/config/modules.ts b/packages/website-ue/src/config/modules.ts index 000542f10..a79219a97 100644 --- a/packages/website-ue/src/config/modules.ts +++ b/packages/website-ue/src/config/modules.ts @@ -1,3 +1,5 @@ +export const maxModulesPerRow = 5; + export const alternativeLines: Record = { guns: "alternative_guns", }; 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 1000dc533..0b4cb5a94 100644 --- a/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website-ue/src/pages/[...locale]/tanks/[slug]/index.astro @@ -2,7 +2,6 @@ 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"; @@ -20,8 +19,6 @@ const { id, locale } = Astro.props; --- - -