From 2e46ba79cf9a51a8f7363aede16f7229d0f0d4bc Mon Sep 17 00:00:00 2001 From: Mark Greene Date: Sun, 4 Oct 2026 14:33:24 +1300 Subject: [PATCH] Fix: reload times show one decimal from a shared constant The reload visualizer and the Firepower reload rows showed two decimals. Add an exported `RELOAD_PRECISION` (1) in the reload visualizer and use it for the visualizer's times and placeholders and for the Firepower reload rows (per-shell reloads, reload and intra-clip). --- .../Characteristics/components/Firepower.tsx | 8 ++++---- .../components/ReloadVisualizer/index.tsx | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx index c1efdc8b4..6311aa782 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx @@ -17,7 +17,7 @@ import { AssaultRangesVisualizer } from "./AssaultRangesVisualizer"; import { GunFlexibilityVisualizer } from "./GunFlexibilityVisualizer"; import { Info } from "./Info"; import { InfoWithDelta } from "./InfoWithDelta"; -import { ReloadVisualizer } from "./ReloadVisualizer"; +import { RELOAD_PRECISION, ReloadVisualizer } from "./ReloadVisualizer"; import { RicochetVisualizer } from "./RicochetVisualizer"; import { StatsTableWrapper } from "./StatsTableWrapper"; import type { StatsAcceptorProps } from "./TraverseVisualizer"; @@ -163,7 +163,7 @@ export function Firepower({ .shell_index, { index: index + 1 }, )} - decimals={2} + decimals={RELOAD_PRECISION} deltaType="lowerIsBetter" noRanking value={() => reload} @@ -173,7 +173,7 @@ export function Firepower({ ) : ( @@ -183,7 +183,7 @@ export function Firepower({ diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/ReloadVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/ReloadVisualizer/index.tsx index 1ce46ab09..f2f7c8f46 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/ReloadVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/ReloadVisualizer/index.tsx @@ -11,7 +11,7 @@ import { Shell } from './components/Shell'; import { Target } from './components/Target'; import './index.css'; -const PRECISION = 2; +export const RELOAD_PRECISION = 1; export interface ReloadUpdateData { reload: number; @@ -82,9 +82,9 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) { ); } - totalTime.current.innerHTML = shellReload.toFixed(PRECISION); + totalTime.current.innerHTML = shellReload.toFixed(RELOAD_PRECISION); progressTime.current.innerHTML = ((1 - reload) * shellReload).toFixed( - PRECISION, + RELOAD_PRECISION, ); if (state.current >= reloadThreshold) shoot(); @@ -117,9 +117,9 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) { shells = times(stats.shells, (index) => index > state.current - 1); } - totalTime.current.innerHTML = interval.toFixed(PRECISION); + totalTime.current.innerHTML = interval.toFixed(RELOAD_PRECISION); progressTime.current.innerHTML = ((1 - reload) * interval).toFixed( - PRECISION, + RELOAD_PRECISION, ); if (lastState % 1 > state.current % 1) shoot(); @@ -262,7 +262,7 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) { transform: 'translate(50%, -50%)', }} > - 0.00 + {(0).toFixed(RELOAD_PRECISION)} - 0.00 + {(0).toFixed(RELOAD_PRECISION)} {stats.shells > 1 &&