mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 02:32:55 +02:00
UI: Added new locale-aware and configurable number formatting (#354)
This commit is contained in:
@@ -12,7 +12,7 @@ import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions
|
||||
import { Player } from "@player";
|
||||
import { Router } from "./GameRoot";
|
||||
import { Page } from "./Router";
|
||||
import { numeralWrapper } from "./numeralFormat";
|
||||
import { formatExp, formatPercent } from "./formatNumber";
|
||||
import { Money } from "./React/Money";
|
||||
import { MoneyRate } from "./React/MoneyRate";
|
||||
import { ProgressBar } from "./React/Progress";
|
||||
@@ -56,7 +56,7 @@ function ExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Hacking Exp"
|
||||
color={Settings.theme.hack}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.hackExp * CYCLES_PER_SEC)} / sec`,
|
||||
content: `${formatExp(rate.hackExp * CYCLES_PER_SEC)} / sec`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -67,7 +67,7 @@ function ExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Strength Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.strExp * CYCLES_PER_SEC)} / sec`,
|
||||
content: `${formatExp(rate.strExp * CYCLES_PER_SEC)} / sec`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -78,7 +78,7 @@ function ExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Defense Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.defExp * CYCLES_PER_SEC)} / sec`,
|
||||
content: `${formatExp(rate.defExp * CYCLES_PER_SEC)} / sec`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -89,7 +89,7 @@ function ExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Dexterity Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.dexExp * CYCLES_PER_SEC)} / sec`,
|
||||
content: `${formatExp(rate.dexExp * CYCLES_PER_SEC)} / sec`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -100,7 +100,7 @@ function ExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Agility Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.agiExp * CYCLES_PER_SEC)} / sec`,
|
||||
content: `${formatExp(rate.agiExp * CYCLES_PER_SEC)} / sec`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -111,7 +111,7 @@ function ExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Charisma Exp"
|
||||
color={Settings.theme.cha}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.chaExp * CYCLES_PER_SEC)} / sec`,
|
||||
content: `${formatExp(rate.chaExp * CYCLES_PER_SEC)} / sec`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -128,7 +128,7 @@ function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Hacking Exp"
|
||||
color={Settings.theme.hack}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.hackExp)}`,
|
||||
content: `${formatExp(rate.hackExp)}`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -139,7 +139,7 @@ function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Strength Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.strExp)}`,
|
||||
content: `${formatExp(rate.strExp)}`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -150,7 +150,7 @@ function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Defense Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.defExp)}`,
|
||||
content: `${formatExp(rate.defExp)}`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -161,7 +161,7 @@ function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Dexterity Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.dexExp)}`,
|
||||
content: `${formatExp(rate.dexExp)}`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -172,7 +172,7 @@ function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Agility Exp"
|
||||
color={Settings.theme.combat}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.agiExp)}`,
|
||||
content: `${formatExp(rate.agiExp)}`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -183,7 +183,7 @@ function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
|
||||
name="Charisma Exp"
|
||||
color={Settings.theme.cha}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatExp(rate.chaExp)}`,
|
||||
content: `${formatExp(rate.chaExp)}`,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
@@ -235,7 +235,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
title: `You are attempting ${crime.workName}`,
|
||||
|
||||
gains: [
|
||||
<Typography>Success chance: {numeralWrapper.formatPercentage(successChance)}</Typography>,
|
||||
<Typography>Success chance: {formatPercent(successChance)}</Typography>,
|
||||
<Typography>Gains (on success)</Typography>,
|
||||
<StatsRow name="Money:" color={Settings.theme.money}>
|
||||
<Typography>
|
||||
|
||||
Reference in New Issue
Block a user