mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-06 07:37:56 +02:00
UI: Added new locale-aware and configurable number formatting (#354)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import { purchaseServer } from "../../Server/ServerPurchases";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatRam } from "../../ui/formatNumber";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { Modal } from "../../ui/React/Modal";
|
||||
import { Player } from "@player";
|
||||
@@ -37,7 +37,7 @@ export function PurchaseServerModal(props: IProps): React.ReactElement {
|
||||
return (
|
||||
<Modal open={props.open} onClose={props.onClose}>
|
||||
<Typography>
|
||||
Would you like to purchase a new server with {numeralWrapper.formatRAM(props.ram)} of RAM for{" "}
|
||||
Would you like to purchase a new server with {formatRam(props.ram)} of RAM for{" "}
|
||||
<Money money={props.cost} forPurchase={true} />?
|
||||
</Typography>
|
||||
<br />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Player } from "@player";
|
||||
import { purchaseRamForHomeComputer } from "../../Server/ServerPurchases";
|
||||
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatRam } from "../../ui/formatNumber";
|
||||
|
||||
import { MathJax } from "better-react-mathjax";
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
@@ -45,8 +45,8 @@ export function RamButton(props: IProps): React.ReactElement {
|
||||
</Typography>
|
||||
<br />
|
||||
<Button disabled={!Player.canAfford(cost)} onClick={buy}>
|
||||
Upgrade 'home' RAM ({numeralWrapper.formatRAM(homeComputer.maxRam)} ->
|
||||
{numeralWrapper.formatRAM(homeComputer.maxRam * 2)}) -
|
||||
Upgrade 'home' RAM ({formatRam(homeComputer.maxRam)} ->
|
||||
{formatRam(homeComputer.maxRam * 2)}) -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
|
||||
@@ -9,7 +9,7 @@ import Tooltip from "@mui/material/Tooltip";
|
||||
|
||||
import { Crimes } from "../../Crime/Crimes";
|
||||
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatPercent } from "../../ui/formatNumber";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { Page } from "../../ui/Router";
|
||||
import { Player } from "@player";
|
||||
@@ -37,7 +37,7 @@ export function SlumsLocation(): React.ReactElement {
|
||||
{crimes.map((crime) => (
|
||||
<Tooltip title={crime.tooltipText}>
|
||||
<Button onClick={(e) => doCrime(e, crime)}>
|
||||
{crime.type} ({numeralWrapper.formatPercentage(crime.successRate(Player))} chance of success)
|
||||
{crime.type} ({formatPercent(crime.successRate(Player))} chance of success)
|
||||
</Button>
|
||||
</Tooltip>
|
||||
))}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { getPurchaseServerCost } from "../../Server/ServerPurchases";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { Player } from "@player";
|
||||
import { PurchaseServerModal } from "./PurchaseServerModal";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatRam } from "../../ui/formatNumber";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
interface IServerProps {
|
||||
@@ -31,7 +31,7 @@ function ServerButton(props: IServerProps): React.ReactElement {
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => setOpen(true)} disabled={!Player.canAfford(cost)}>
|
||||
Purchase {numeralWrapper.formatRAM(props.ram)} Server -
|
||||
Purchase {formatRam(props.ram)} Server -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
<PurchaseServerModal
|
||||
|
||||
Reference in New Issue
Block a user