mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 10:12:53 +02:00
UI: Added new locale-aware and configurable number formatting (#354)
This commit is contained in:
@@ -10,7 +10,7 @@ import { TickerHeaderFormatData } from "../data/TickerHeaderFormatData";
|
||||
|
||||
import { Player } from "@player";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { formatMoney, formatPercent } from "../../ui/formatNumber";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
type IProps = {
|
||||
@@ -22,7 +22,7 @@ const localesWithLongPriceFormat = ["cs", "lv", "pl", "ru"];
|
||||
export function StockTickerHeaderText(props: IProps): React.ReactElement {
|
||||
const stock = props.stock;
|
||||
|
||||
const stockPriceFormat = numeralWrapper.formatMoney(stock.price);
|
||||
const stockPriceFormat = formatMoney(stock.price);
|
||||
const spacesAllottedForStockPrice = localesWithLongPriceFormat.includes(Settings.Locale) ? 15 : 12;
|
||||
const spacesAfterStockName = " ".repeat(
|
||||
1 +
|
||||
@@ -34,7 +34,7 @@ export function StockTickerHeaderText(props: IProps): React.ReactElement {
|
||||
|
||||
let hdrText = `${stock.name}${spacesAfterStockName}${stock.symbol} -${spacesBeforePrice}${stockPriceFormat}`;
|
||||
if (Player.has4SData) {
|
||||
hdrText += ` - Volatility: ${numeralWrapper.formatPercentage(stock.mv / 100)} - Price Forecast: `;
|
||||
hdrText += ` - Volatility: ${formatPercent(stock.mv / 100)} - Price Forecast: `;
|
||||
let plusOrMinus = stock.b; // True for "+", false for "-"
|
||||
if (stock.otlkMag < 0) {
|
||||
plusOrMinus = !plusOrMinus;
|
||||
|
||||
Reference in New Issue
Block a user