mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
16 lines
703 B
TypeScript
16 lines
703 B
TypeScript
import * as React from "react";
|
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
|
|
|
interface IProps {
|
|
money: number | string;
|
|
player?: IPlayer;
|
|
}
|
|
export function Money(props: IProps): JSX.Element {
|
|
if(props.player !== undefined) {
|
|
if(typeof props.money !== 'number') throw new Error('if player if provided, money should be number, contact dev');
|
|
if(!props.player.canAfford(props.money))
|
|
return <span className={"unbuyable samefont"}>{numeralWrapper.formatMoney(props.money)}</span>
|
|
}
|
|
return <span className={"money-gold samefont"}>{typeof props.money === 'number' ? numeralWrapper.formatMoney(props.money) : props.money}</span>
|
|
} |