import { literals } from "@blitzkit/i18n/src/literals"; import { EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons"; import { useCallback, type ReactNode } from "react"; import { useAbsoluteDisplay } from "../../hooks/useAbsoluteDisplay"; import { useStrings } from "../../hooks/useStrings"; import { Tankopedia } from "../../stores/tankopedia"; import { TankopediaPersistent } from "../../stores/tankopediaPersistent"; import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants"; import type { ThicknessRange } from "../TankStaticArmor"; import { Text } from "../Text"; import styles from "./index.module.css"; interface LayerToggleProps { visible: boolean; label: ReactNode; /** Thickness labels for the top and bottom of the scale */ range?: [ReactNode, ReactNode]; swatch: string; onToggle(): void; } function LayerToggle({ visible, label, range, swatch, onToggle, }: LayerToggleProps) { return ( ); } export interface ThicknessesProps { thicknessRange: ThicknessRange; } export function Thicknesses({ thicknessRange }: ThicknessesProps) { const strings = useStrings(); const isStaticArmorDisplay = useAbsoluteDisplay( TankopediaDisplay.StaticArmor, ); const showControls = Tankopedia.use((state) => state.showControls); const showPrimaryArmor = TankopediaPersistent.use( (state) => state.showPrimaryArmor, ); const showSpacedArmor = TankopediaPersistent.use( (state) => state.showSpacedArmor, ); const showExternalModules = TankopediaPersistent.use( (state) => state.showExternalModules, ); const { element } = strings.tanks.shot_card; const mm = useCallback( (value: number) => literals(strings.common.units.mm, { value: value.toFixed(0) }), [strings], ); const clearHighlight = useCallback(() => { Tankopedia.mutate((draft) => { draft.highlightArmor = undefined; }); }, []); return (
{ TankopediaPersistent.mutate((draft) => { draft.showPrimaryArmor = !draft.showPrimaryArmor; }); clearHighlight(); }} /> { TankopediaPersistent.mutate((draft) => { draft.showSpacedArmor = !draft.showSpacedArmor; }); clearHighlight(); }} /> { TankopediaPersistent.mutate((draft) => { draft.showExternalModules = !draft.showExternalModules; }); clearHighlight(); }} />
); }