From 523d2ed28ccd43f367da005fdcd06123a72c2191 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 10 Aug 2024 23:01:03 +0200 Subject: [PATCH] added time picker --- src/App.js | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/App.js b/src/App.js index 109212f..6bcdac8 100644 --- a/src/App.js +++ b/src/App.js @@ -9,9 +9,9 @@ import { Grid, InputNumber, Row, - Select, Slider, Space, + TimePicker, } from "antd"; import { useForm } from "antd/es/form/Form"; import useMessage from "antd/es/message/useMessage"; @@ -143,6 +143,15 @@ function App() { .then((values) => { setProcessStatus("Sende Anfrage"); + let durationInSeconds = 0; + + if (values.duration !== undefined) { + const duration = values.duration; + + durationInSeconds = + duration.$s + duration.$m * 60 + duration.$H * 3600; + } + myFetch({ url: urlPath, method: "POST", @@ -150,7 +159,7 @@ function App() { distance: distance, acceleration: acceleration, direction: direction, - duration: values.duration * (durationUnit === "seconds" ? 1 : 60), + duration: durationInSeconds, }, showNotification: messageApi, }) @@ -194,6 +203,7 @@ function App() { form={form} layout="vertical" onFinish={() => sendControlRequest("/start")} + requiredMark={false} >
- - setDurationUnit(value)} - > - Sekunden - Minuten - - } - /> + +