bitburner-src/src/Bladeburner/ui/SuccessChance.tsx

19 lines
437 B
TypeScript
Raw Normal View History

2021-08-21 20:00:28 +02:00
import React from "react";
2021-09-25 20:42:57 +02:00
import { formatNumber } from "../../utils/StringHelperFunctions";
2021-08-21 20:00:28 +02:00
interface IProps {
2021-09-05 01:09:30 +02:00
chance: number[];
2021-08-21 20:00:28 +02:00
}
export function SuccessChance(props: IProps): React.ReactElement {
2021-09-05 01:09:30 +02:00
if (props.chance[0] === props.chance[1]) {
return <>{formatNumber(props.chance[0] * 100, 1)}%</>;
}
2021-08-21 20:00:28 +02:00
2021-09-05 01:09:30 +02:00
return (
<>
2021-09-09 05:47:34 +02:00
{formatNumber(props.chance[0] * 100, 1)}% ~ {formatNumber(props.chance[1] * 100, 1)}%
2021-09-05 01:09:30 +02:00
</>
);
2021-08-21 20:00:28 +02:00
}