UI: Fix clipped numbers when values are too big in Augmentations page (#1250)

This commit is contained in:
catloversg 2024-05-11 08:51:12 +07:00 committed by GitHub
parent b88361921e
commit 19984a6f22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -23,14 +23,19 @@ interface IBitNodeModifiedStatsProps {
color: string; color: string;
} }
function customFormatPercent(value: number): string {
return formatPercent(value, 2, 100);
}
function BitNodeModifiedStats(props: IBitNodeModifiedStatsProps): React.ReactElement { function BitNodeModifiedStats(props: IBitNodeModifiedStatsProps): React.ReactElement {
// If player doesn't have SF5 or if the property isn't affected by BitNode mults // If player doesn't have SF5 or if the property isn't affected by BitNode mults
if (props.mult === 1 || Player.sourceFileLvl(5) === 0) if (props.mult === 1 || Player.sourceFileLvl(5) === 0)
return <Typography color={props.color}>{formatPercent(props.base)}</Typography>; return <Typography color={props.color}>{customFormatPercent(props.base)}</Typography>;
return ( return (
<Typography color={props.color}> <Typography color={props.color}>
<span style={{ opacity: 0.5 }}>{formatPercent(props.base)}</span> {formatPercent(props.base * props.mult)} <span style={{ opacity: 0.5 }}>{customFormatPercent(props.base)}</span>{" "}
{customFormatPercent(props.base * props.mult)}
</Typography> </Typography>
); );
} }