mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-11 10:06:10 +02:00
UI: Added new locale-aware and configurable number formatting (#354)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { TextField, StandardTextFieldProps } from "@mui/material";
|
||||
import React from "react";
|
||||
import { numeralWrapper } from "../numeralFormat";
|
||||
import { parseBigNumber } from "../formatNumber";
|
||||
|
||||
interface IProps extends Omit<StandardTextFieldProps, "onChange"> {
|
||||
onChange: (v: number) => void;
|
||||
@@ -10,7 +10,7 @@ export function NumberInput(props: IProps): React.ReactElement {
|
||||
const textProps = {
|
||||
...props,
|
||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const amt = numeralWrapper.parseMoney(event.target.value);
|
||||
const amt = parseBigNumber(event.target.value);
|
||||
if (event.target.value === "" || isNaN(amt)) props.onChange(NaN);
|
||||
else props.onChange(amt);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user