Fix computation of BN level

This commit is contained in:
nickofolas 2022-05-07 16:19:31 -05:00
parent 1f8c5164d7
commit d43ec1d501
2 changed files with 6 additions and 6 deletions

@ -12,10 +12,10 @@ import { IBitNodeMultipliers } from "../BitNodeMultipliers";
interface IProps { interface IProps {
n: number; n: number;
showNext?: boolean; level?: number;
} }
export function BitnodeMultiplierDescription({ n, showNext = false }: IProps): React.ReactElement { export function BitnodeMultiplierDescription({ n, level }: IProps): React.ReactElement {
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
if (n === 1) return <></>; if (n === 1) return <></>;
@ -26,15 +26,15 @@ export function BitnodeMultiplierDescription({ n, showNext = false }: IProps): R
{open ? <ExpandLess color="primary" /> : <ExpandMore color="primary" />} {open ? <ExpandLess color="primary" /> : <ExpandMore color="primary" />}
</ListItemButton> </ListItemButton>
<Collapse in={open}> <Collapse in={open}>
<BitNodeMultipliersDisplay n={n} showNext={showNext} /> <BitNodeMultipliersDisplay n={n} level={level} />
</Collapse> </Collapse>
</Box> </Box>
); );
} }
export const BitNodeMultipliersDisplay = ({ n, showNext = false }: IProps): React.ReactElement => { export const BitNodeMultipliersDisplay = ({ n, level }: IProps): React.ReactElement => {
const player = use.Player(); const player = use.Player();
const mults = getBitNodeMultipliers(n, player.sourceFileLvl(n) + +!!showNext); const mults = getBitNodeMultipliers(n, level ?? Math.min(player.sourceFileLvl(n) + 1, n === 12 ? Infinity : 3));
return ( return (
<Box sx={{ columnCount: 2, columnGap: 1, mb: -2 }}> <Box sx={{ columnCount: 2, columnGap: 1, mb: -2 }}>

@ -41,7 +41,7 @@ export function PortalModal(props: IProps): React.ReactElement {
<br /> <br />
<br /> <br />
<Typography>{bitNode.info}</Typography> <Typography>{bitNode.info}</Typography>
<BitnodeMultiplierDescription n={props.n} showNext={!props.flume} /> <BitnodeMultiplierDescription n={props.n} level={newLevel} />
<br /> <br />
<br /> <br />
<Button <Button