mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-28 03:47:03 +02:00
UI: Added new locale-aware and configurable number formatting (#354)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Metadata used to construct all Hash Upgrades
|
||||
import React from "react";
|
||||
import { IConstructorParams } from "../HashUpgrade";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatInt } from "../../ui/formatNumber";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
|
||||
export const HashUpgradesMetadata: IConstructorParams[] = [
|
||||
@@ -72,7 +72,7 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
|
||||
desc: "Exchange hashes for 1k Scientific Research in all of your Corporation's Industries",
|
||||
name: "Exchange for Corporation Research",
|
||||
effectText: (level: number): JSX.Element | null => (
|
||||
<>Acquired a total of {level}k Scientific Research in your industries.</>
|
||||
<>Acquired a total of {formatInt(level * 1000)} Scientific Research in your industries.</>
|
||||
),
|
||||
value: 1000,
|
||||
},
|
||||
@@ -81,7 +81,7 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
|
||||
desc: "Exchange hashes for 100 Bladeburner Rank",
|
||||
name: "Exchange for Bladeburner Rank",
|
||||
effectText: (level: number): JSX.Element | null => (
|
||||
<>Acquired a total of {numeralWrapper.format(100 * level, "0a")} Bladeburner rank</>
|
||||
<>Acquired a total of {formatInt(100 * level)} Bladeburner rank</>
|
||||
),
|
||||
value: 100,
|
||||
},
|
||||
@@ -90,7 +90,7 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
|
||||
desc: "Exchanges hashes for 10 Bladeburner Skill Points",
|
||||
name: "Exchange for Bladeburner SP",
|
||||
effectText: (level: number): JSX.Element | null => (
|
||||
<>Acquired a total of {numeralWrapper.format(10 * level, "0a")} Bladeburner Skill Points</>
|
||||
<>Acquired a total of {formatInt(10 * level)} Bladeburner Skill Points</>
|
||||
),
|
||||
value: 10,
|
||||
},
|
||||
|
||||
@@ -29,7 +29,7 @@ import TableBody from "@mui/material/TableBody";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatRam } from "../../ui/formatNumber";
|
||||
import { calculateMoneyGainRate } from "../formulas/HacknetNodes";
|
||||
|
||||
interface IProps {
|
||||
@@ -196,7 +196,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
<Typography>RAM:</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography>{numeralWrapper.formatRAM(node.ram)}</Typography>
|
||||
<Typography>{formatRam(node.ram)}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeRAMButton}</TableCell>
|
||||
</TableRow>
|
||||
|
||||
@@ -31,7 +31,7 @@ import { TableCell } from "../../ui/React/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatRam } from "../../ui/formatNumber";
|
||||
import { calculateHashGainRate } from "../formulas/HacknetServers";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
|
||||
@@ -273,10 +273,10 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
</span>{" "}
|
||||
max production rate. (achieved when 100% RAM is allocated to it)
|
||||
<br />
|
||||
{numeralWrapper.formatRAM(node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} (
|
||||
{formatRam(node.ramUsed)} / {formatRam(node.maxRam)} (
|
||||
{Math.round((100 * node.ramUsed) / node.maxRam)}%) RAM allocated to script.
|
||||
<br />
|
||||
{numeralWrapper.formatRAM(node.maxRam - node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} (
|
||||
{formatRam(node.maxRam - node.ramUsed)} / {formatRam(node.maxRam)} (
|
||||
{Math.round((100 * (node.maxRam - node.ramUsed)) / node.maxRam)}%) RAM allocated to hash production.
|
||||
</Typography>
|
||||
}
|
||||
@@ -311,7 +311,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
<Typography>RAM:</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography>{numeralWrapper.formatRAM(node.maxRam)}</Typography>
|
||||
<Typography>{formatRam(node.maxRam)}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeRamButton}</TableCell>
|
||||
</TableRow>
|
||||
|
||||
Reference in New Issue
Block a user