feat: remove units and make ranks softer

This commit is contained in:
tresabhi committed 2025-04-24 20:35:58 -05:00
1 parent 37ca981d33
commit 507b503560
6 files changed
+23 -75

No files matched your search

@@ -68,7 +68,6 @@ export function Crew({ stats }: StatsAcceptorProps) {
? ` ${literals(strings.common.units.x, [`${member.count}`])}` ? ` ${literals(strings.common.units.x, [`${member.count}`])}`
: '' : ''
}`} }`}
unit="%"
decimals={0} decimals={0}
noRanking noRanking
value={() => value={() =>
@@ -83,7 +82,6 @@ export function Crew({ stats }: StatsAcceptorProps) {
stats={stats} stats={stats}
key={`${member.type}-substitute`} key={`${member.type}-substitute`}
decimals={0} decimals={0}
unit="%"
indent indent
name={ name={
<> <>
@@ -106,15 +106,9 @@ export function Firepower({ stats }: StatsAcceptorProps) {
> >
{strings.common.gun_types[gun.gun_type!.$case]} {strings.common.gun_types[gun.gun_type!.$case]}
</Info> </Info>
<InfoWithDelta stats={stats} decimals={0} unit="hp / min" value="dpm" /> <InfoWithDelta stats={stats} decimals={0} value="dpm" />
{gun.gun_type!.$case === 'auto_reloader' && ( {gun.gun_type!.$case === 'auto_reloader' && (
<InfoWithDelta <InfoWithDelta stats={stats} decimals={0} indent value="dpmEffective" />
stats={stats}
decimals={0}
indent
unit="hp / min"
value="dpmEffective"
/>
)} )}
{gun.gun_type!.$case !== 'regular' && ( {gun.gun_type!.$case !== 'regular' && (
<InfoWithDelta stats={stats} value="shells" /> <InfoWithDelta stats={stats} value="shells" />
@@ -135,7 +129,6 @@ export function Firepower({ stats }: StatsAcceptorProps) {
strings.website.tools.tankopedia.characteristics.values strings.website.tools.tankopedia.characteristics.values
.shellReloads .shellReloads
} }
unit="s"
/> />
{stats.shellReloads!.map((reload, index) => ( {stats.shellReloads!.map((reload, index) => (
<InfoWithDelta <InfoWithDelta
@@ -158,7 +151,6 @@ export function Firepower({ stats }: StatsAcceptorProps) {
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={2} decimals={2}
unit="s"
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="shellReload" value="shellReload"
/> />
@@ -169,12 +161,11 @@ export function Firepower({ stats }: StatsAcceptorProps) {
stats={stats} stats={stats}
indent indent
decimals={2} decimals={2}
unit="s"
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="intraClip" value="intraClip"
/> />
)} )}
<InfoWithDelta stats={stats} decimals={0} unit="mm" value="penetration" /> <InfoWithDelta stats={stats} decimals={0} value="penetration" />
{typeof shell.penetration !== 'number' && ( {typeof shell.penetration !== 'number' && (
<> <>
<InfoWithDelta <InfoWithDelta
@@ -242,33 +233,26 @@ export function Firepower({ stats }: StatsAcceptorProps) {
</Flex> </Flex>
</> </>
)} )}
<InfoWithDelta stats={stats} unit="hp" decimals={0} value="damage" /> <InfoWithDelta stats={stats} decimals={0} value="damage" />
{gun.gun_type!.$case !== 'regular' && ( {gun.gun_type!.$case !== 'regular' && (
<InfoWithDelta stats={stats} indent decimals={0} value="clipDamage" /> <InfoWithDelta stats={stats} indent decimals={0} value="clipDamage" />
)} )}
<InfoWithDelta <InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
stats={stats}
unit="hp"
decimals={0}
value="moduleDamage"
/>
{isExplosive(shell.type) && ( {isExplosive(shell.type) && (
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
unit="m"
noRanking noRanking
decimals={0} decimals={0}
value="explosionRadius" value="explosionRadius"
/> />
)} )}
<InfoWithDelta stats={stats} decimals={0} unit="mm" value="caliber" /> <InfoWithDelta stats={stats} decimals={0} value="caliber" />
{!isExplosive(shell.type) && ( {!isExplosive(shell.type) && (
<> <>
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={0} decimals={0}
unit="°"
noRanking noRanking
value="shellNormalization" value="shellNormalization"
/> />
@@ -277,24 +261,17 @@ export function Firepower({ stats }: StatsAcceptorProps) {
noRanking noRanking
decimals={0} decimals={0}
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
unit="°"
value="shellRicochet" value="shellRicochet"
/> />
<RicochetVisualizer stats={stats} /> <RicochetVisualizer stats={stats} />
</> </>
)} )}
<InfoWithDelta <InfoWithDelta stats={stats} decimals={0} value="shellVelocity" />
stats={stats} <InfoWithDelta stats={stats} decimals={0} value="shellRange" />
unit="m/s"
decimals={0}
value="shellVelocity"
/>
<InfoWithDelta stats={stats} unit="m" decimals={0} value="shellRange" />
<InfoWithDelta stats={stats} decimals={0} value="shellCapacity" /> <InfoWithDelta stats={stats} decimals={0} value="shellCapacity" />
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={2} decimals={2}
unit="s"
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="aimTime" value="aimTime"
/> />
@@ -309,7 +286,6 @@ export function Firepower({ stats }: StatsAcceptorProps) {
stats={stats} stats={stats}
decimals={3} decimals={3}
indent indent
unit="m"
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="dispersion" value="dispersion"
/> />
@@ -358,7 +334,6 @@ export function Firepower({ stats }: StatsAcceptorProps) {
strings.website.tools.tankopedia.characteristics.values strings.website.tools.tankopedia.characteristics.values
.gun_flexibility .gun_flexibility
} }
unit="°"
/> />
<InfoWithDelta value="gunDepression" stats={stats} decimals={1} indent /> <InfoWithDelta value="gunDepression" stats={stats} decimals={1} indent />
<InfoWithDelta stats={stats} decimals={1} indent value="gunElevation" /> <InfoWithDelta stats={stats} decimals={1} indent value="gunElevation" />
@@ -5,7 +5,6 @@ import type { ReactNode } from 'react';
export interface InfoProps { export interface InfoProps {
name: ReactNode; name: ReactNode;
children?: ReactNode; children?: ReactNode;
unit?: string;
indent?: boolean; indent?: boolean;
delta?: number; delta?: number;
decimals?: number; decimals?: number;
@@ -16,7 +15,6 @@ export interface InfoProps {
export function Info({ export function Info({
name, name,
children, children,
unit,
indent = false, indent = false,
delta, delta,
decimals, decimals,
@@ -25,17 +23,7 @@ export function Info({
}: InfoProps) { }: InfoProps) {
return ( return (
<Flex align="center" pl={indent ? '2' : '0'} width="100%" gap="4"> <Flex align="center" pl={indent ? '2' : '0'} width="100%" gap="4">
<Text color="gray"> <Text color="gray">{name}</Text>
{name}
{unit != undefined && (
<>
{' '}
<Text color="gray" size="1">
{unit}
</Text>
</>
)}
</Text>
<Box flexGrow="1" /> <Box flexGrow="1" />
@@ -65,8 +53,14 @@ export function Info({
</Text> </Text>
</> </>
)} )}
<Text> <Text>
{prefix} {prefix !== undefined && (
<Text color="gray" size="1">
{prefix}
</Text>
)}
{decimals !== undefined && typeof children === 'number' {decimals !== undefined && typeof children === 'number'
? children.toFixed(decimals) ? children.toFixed(decimals)
: children} : children}
@@ -1,5 +1,6 @@
import { createDefaultSkills } from '@blitzkit/core'; import { createDefaultSkills } from '@blitzkit/core';
import { Flex, Progress, Text } from '@radix-ui/themes'; import { Flex, Progress, Text } from '@radix-ui/themes';
import { clamp } from 'lodash-es';
import { useMemo, type ComponentProps, type ReactNode } from 'react'; import { useMemo, type ComponentProps, type ReactNode } from 'react';
import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions'; import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions';
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions'; import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
@@ -166,10 +167,11 @@ export function InfoWithDelta({
size="1" size="1"
value={goodness * 100} value={goodness * 100}
color={color} color={color}
style={{ height: '0.125rem' }} style={{ height: '0.125rem', opacity: 0.5 }}
/> />
<Text color="gray" size="1"> <Text color="gray" size="1">
{betterTanks.length + 1} / {others.length} {clamp(betterTanks.length + 1, 1, others.length)} / {others.length}
</Text> </Text>
</Flex> </Flex>
)} )}
@@ -18,7 +18,6 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
</Heading> </Heading>
<Info <Info
name={strings.website.tools.tankopedia.characteristics.values.speed} name={strings.website.tools.tankopedia.characteristics.values.speed}
unit="kph"
/> />
<InfoWithDelta value="speedForwards" stats={stats} decimals={0} indent /> <InfoWithDelta value="speedForwards" stats={stats} decimals={0} indent />
<InfoWithDelta value="speedBackwards" stats={stats} decimals={0} indent /> <InfoWithDelta value="speedBackwards" stats={stats} decimals={0} indent />
@@ -26,7 +25,6 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={1} decimals={1}
unit="tn"
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="weight" value="weight"
/> />
@@ -40,13 +38,11 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
value="hardTerrainCoefficient" value="hardTerrainCoefficient"
stats={stats} stats={stats}
decimals={0} decimals={0}
unit="%"
indent indent
/> />
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={0} decimals={0}
unit="%"
indent indent
value="mediumTerrainCoefficient" value="mediumTerrainCoefficient"
/> />
@@ -54,7 +50,6 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
value="softTerrainCoefficient" value="softTerrainCoefficient"
stats={stats} stats={stats}
decimals={0} decimals={0}
unit="%"
indent indent
/> />
<Info <Info
@@ -68,14 +63,12 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
value="hardTerrainCoefficientRaw" value="hardTerrainCoefficientRaw"
stats={stats} stats={stats}
decimals={2} decimals={2}
unit="%"
indent indent
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
/> />
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={2} decimals={2}
unit="%"
indent indent
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="mediumTerrainCoefficientRaw" value="mediumTerrainCoefficientRaw"
@@ -83,7 +76,6 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
decimals={2} decimals={2}
unit="%"
indent indent
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value="softTerrainCoefficientRaw" value="softTerrainCoefficientRaw"
@@ -93,7 +85,6 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
strings.website.tools.tankopedia.characteristics.values strings.website.tools.tankopedia.characteristics.values
.power_to_weight_ratio .power_to_weight_ratio
} }
unit="hp/tn"
/> />
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
@@ -113,18 +104,12 @@ export function Maneuverability({ stats }: StatsAcceptorProps) {
indent indent
value="powerToWeightRatioSoftTerrain" value="powerToWeightRatioSoftTerrain"
/> />
<InfoWithDelta <InfoWithDelta stats={stats} decimals={1} value="turretTraverseSpeed" />
stats={stats}
unit="°/s"
decimals={1}
value="turretTraverseSpeed"
/>
<Info <Info
name={ name={
strings.website.tools.tankopedia.characteristics.values strings.website.tools.tankopedia.characteristics.values
.hull_traverse_speed .hull_traverse_speed
} }
unit="°/s"
/> />
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
@@ -14,24 +14,22 @@ export function Survivability({ stats }: StatsAcceptorProps) {
<Heading size="5"> <Heading size="5">
{strings.website.tools.tankopedia.survivability.title} {strings.website.tools.tankopedia.survivability.title}
</Heading> </Heading>
<InfoWithDelta value="health" stats={stats} unit="hp" decimals={0} /> <InfoWithDelta value="health" stats={stats} decimals={0} />
<InfoWithDelta <InfoWithDelta
stats={stats} stats={stats}
name={ name={
strings.website.tools.tankopedia.characteristics.values.fireChance strings.website.tools.tankopedia.characteristics.values.fireChance
} }
unit="%"
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
decimals={0} decimals={0}
value={(stats) => stats.fireChance * 100} value={(stats) => stats.fireChance * 100}
/> />
<InfoWithDelta value="viewRange" stats={stats} unit="m" decimals={0} /> <InfoWithDelta value="viewRange" stats={stats} decimals={0} />
<ViewRangeVisualizer stats={stats} /> <ViewRangeVisualizer stats={stats} />
<Info <Info
name={ name={
strings.website.tools.tankopedia.characteristics.values.camouflage strings.website.tools.tankopedia.characteristics.values.camouflage
} }
unit="%"
/> />
<InfoWithDelta <InfoWithDelta
value={(stats) => stats.camouflageStill * 100} value={(stats) => stats.camouflageStill * 100}
@@ -84,28 +82,24 @@ export function Survivability({ stats }: StatsAcceptorProps) {
value={(stats) => stats.camouflageCaughtOnFire * 100} value={(stats) => stats.camouflageCaughtOnFire * 100}
/> />
<InfoWithDelta <InfoWithDelta
unit="m"
decimals={0} decimals={0}
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
stats={stats} stats={stats}
value="width" value="width"
/> />
<InfoWithDelta <InfoWithDelta
unit="m"
decimals={0} decimals={0}
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
stats={stats} stats={stats}
value="height" value="height"
/> />
<InfoWithDelta <InfoWithDelta
unit="m"
decimals={0} decimals={0}
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
stats={stats} stats={stats}
value="length" value="length"
/> />
<InfoWithDelta <InfoWithDelta
unit="m"
decimals={0} decimals={0}
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
stats={stats} stats={stats}