fix: Update filament edit page to use temperature ranges

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-14 23:37:00 -06:00
parent bf775f3745
commit a18daa8134

View File

@@ -1,6 +1,6 @@
import { Edit, useForm, useSelect } from "@refinedev/antd"; import { Edit, useForm, useSelect } from "@refinedev/antd";
import { HttpError, IResourceComponentsProps, useTranslate } from "@refinedev/core"; import { HttpError, IResourceComponentsProps, useTranslate } from "@refinedev/core";
import { Alert, ColorPicker, DatePicker, Form, Input, InputNumber, message, Radio, Select, Typography } from "antd"; import { Alert, ColorPicker, DatePicker, Form, Input, InputNumber, message, Radio, Select, Space, Typography } from "antd";
import TextArea from "antd/es/input/TextArea"; import TextArea from "antd/es/input/TextArea";
import dayjs from "dayjs"; import dayjs from "dayjs";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
@@ -288,31 +288,43 @@ export const FilamentEdit: React.FC<IResourceComponentsProps> = () => {
> >
<InputNumber addonAfter="g" precision={1} /> <InputNumber addonAfter="g" precision={1} />
</Form.Item> </Form.Item>
<Form.Item label={t("filament.fields.settings_extruder_temp")}>
<Space.Compact>
<Form.Item <Form.Item
label={t("filament.fields.settings_extruder_temp")} name={["settings_extruder_temp_min"]}
name={["settings_extruder_temp"]} noStyle
rules={[ rules={[{ type: "number", min: 0 }]}
{
required: false,
type: "number",
min: 0,
},
]}
> >
<InputNumber addonAfter="°C" precision={0} /> <InputNumber placeholder={t("filament.fields.temp_min")} addonAfter="°C" precision={0} style={{ width: 140 }} />
</Form.Item> </Form.Item>
<span style={{ padding: "4px 8px", background: "#fafafa", border: "1px solid #d9d9d9", borderLeft: 0, borderRight: 0 }}>-</span>
<Form.Item <Form.Item
label={t("filament.fields.settings_bed_temp")} name={["settings_extruder_temp_max"]}
name={["settings_bed_temp"]} noStyle
rules={[ rules={[{ type: "number", min: 0 }]}
{
required: false,
type: "number",
min: 0,
},
]}
> >
<InputNumber addonAfter="°C" precision={0} /> <InputNumber placeholder={t("filament.fields.temp_max")} addonAfter="°C" precision={0} style={{ width: 140 }} />
</Form.Item>
</Space.Compact>
</Form.Item>
<Form.Item label={t("filament.fields.settings_bed_temp")}>
<Space.Compact>
<Form.Item
name={["settings_bed_temp_min"]}
noStyle
rules={[{ type: "number", min: 0 }]}
>
<InputNumber placeholder={t("filament.fields.temp_min")} addonAfter="°C" precision={0} style={{ width: 140 }} />
</Form.Item>
<span style={{ padding: "4px 8px", background: "#fafafa", border: "1px solid #d9d9d9", borderLeft: 0, borderRight: 0 }}>-</span>
<Form.Item
name={["settings_bed_temp_max"]}
noStyle
rules={[{ type: "number", min: 0 }]}
>
<InputNumber placeholder={t("filament.fields.temp_max")} addonAfter="°C" precision={0} style={{ width: 140 }} />
</Form.Item>
</Space.Compact>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t("filament.fields.article_number")} label={t("filament.fields.article_number")}