i wrote this shit!!
This commit is contained in:
parent
d2e4ee550b
commit
a4f670ebd4
@ -99,7 +99,7 @@ export function ResourceDisplay() {
|
|||||||
<Box textAlign="center" minW="120px">
|
<Box textAlign="center" minW="120px">
|
||||||
<Text fontSize="sm" fontWeight="bold" color="brand.300" variant="pixel">Click Power</Text>
|
<Text fontSize="sm" fontWeight="bold" color="brand.300" variant="pixel">Click Power</Text>
|
||||||
<Flex justify="center" align="center" gap={1}>
|
<Flex justify="center" align="center" gap={1}>
|
||||||
<Text fontSize="md" color="text.primary">{formatNumber(clickPower)}</Text>
|
<Text fontSize="md" color="text.primary">{clickPower}</Text>
|
||||||
<Tooltip label={`Upgrade to level ${clickPower + 1} (${formatNumber(clickPowerUpgradeCost)} points)`}>
|
<Tooltip label={`Upgrade to level ${clickPower + 1} (${formatNumber(clickPowerUpgradeCost)} points)`}>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|||||||
@ -14,7 +14,10 @@ export function formatNumber(value: number, decimals: number = 3, useCommas: boo
|
|||||||
const suffixes = ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'Dc'];
|
const suffixes = ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'Dc'];
|
||||||
|
|
||||||
// If the number is 1000 or less, format without decimals
|
// If the number is 1000 or less, format without decimals
|
||||||
if (value <= 1000) {
|
if (value < 10) {
|
||||||
|
return value.toFixed(2);
|
||||||
|
}
|
||||||
|
else if (value <= 1000) {
|
||||||
return useCommas ? Math.floor(value).toLocaleString() : Math.floor(value).toString();
|
return useCommas ? Math.floor(value).toLocaleString() : Math.floor(value).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user