Client: Fixed incorrect units for some numbers
This commit is contained in:
@@ -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,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from "react";
|
||||
import { IResourceComponentsProps, useShow } from "@refinedev/core";
|
||||
import { Show, NumberField, DateField, TextField } from "@refinedev/antd";
|
||||
import { Typography } from "antd";
|
||||
import { NumberFieldUnit } from "../../components/numberField";
|
||||
|
||||
const { Title } = Typography;
|
||||
|
||||
@@ -28,22 +29,18 @@ export const SpoolShow: React.FC<IResourceComponentsProps> = () => {
|
||||
<>{filamentData?.data?.id}</>
|
||||
)} */}
|
||||
<Title level={5}>Remaining Weight</Title>
|
||||
<NumberField
|
||||
<NumberFieldUnit
|
||||
value={record?.remaining_weight ?? ""}
|
||||
unit="g"
|
||||
options={{
|
||||
unitDisplay: "short",
|
||||
unit: "gram",
|
||||
style: "unit",
|
||||
maximumFractionDigits: 1,
|
||||
}}
|
||||
/>
|
||||
<Title level={5}>Used Weight</Title>
|
||||
<NumberField
|
||||
<NumberFieldUnit
|
||||
value={record?.used_weight ?? ""}
|
||||
unit="g"
|
||||
options={{
|
||||
unitDisplay: "short",
|
||||
unit: "gram",
|
||||
style: "unit",
|
||||
maximumFractionDigits: 1,
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user