Client: Fixed incorrect units for some numbers

This commit is contained in:
Donkie
2023-05-17 22:03:19 +02:00
parent 9ae6bafd35
commit 40dc48668b
5 changed files with 68 additions and 50 deletions

View File

@@ -6,10 +6,10 @@ import {
EditButton,
ShowButton,
DateField,
NumberField,
TextField,
} from "@refinedev/antd";
import { Table, Space } from "antd";
import { NumberFieldUnit } from "../../components/numberField";
export const SpoolList: React.FC<IResourceComponentsProps> = () => {
const { tableProps } = useTable({
@@ -34,12 +34,10 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
title="Used Weight"
render={(value) => {
return (
<NumberField
<NumberFieldUnit
value={value}
unit="g"
options={{
unitDisplay: "short",
unit: "gram",
style: "unit",
maximumFractionDigits: 1,
}}
/>
@@ -54,12 +52,10 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
return <TextField value="Unknown" />;
}
return (
<NumberField
<NumberFieldUnit
value={Math.max(value, 0)}
unit="g"
options={{
unitDisplay: "short",
unit: "gram",
style: "unit",
maximumFractionDigits: 1,
}}
/>