diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index 03fdd798f..4a94a1231 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -7,7 +7,7 @@ import { fetchTankDefinitions, } from '@blitzkit/core'; import { Flex, Progress, Text } from '@radix-ui/themes'; -import { useMemo } from 'react'; +import { useMemo, type ComponentProps } from 'react'; import { tankCharacteristics, type TankCharacteristics, @@ -95,6 +95,13 @@ export function InfoWithDelta({ ? othersValue < uhWhatDoICallThisVariable : othersValue > uhWhatDoICallThisVariable; }); + const goodness = (others.length - betterTanks.length) / others.length; + let color: ComponentProps['color']; + + if (goodness <= 0.25) color = 'red'; + else if (goodness <= 0.5) color = 'orange'; + else if (goodness <= 0.75) color = 'yellow'; + else color = 'green'; return ( @@ -103,12 +110,12 @@ export function InfoWithDelta({ {!noRanking && ( - + {betterTanks.length + 1} / {others.length} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx index 33ccd655b..b7a763e21 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx @@ -138,7 +138,7 @@ export function Characteristics() { }} > - + Firepower @@ -520,7 +520,7 @@ export function Characteristics() { )} - + Crew training @@ -598,7 +598,7 @@ export function Characteristics() { - + Maneuverability - + Survivability