minor fixes Pilot navbar
This commit is contained in:
@@ -4,6 +4,7 @@ import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { getStationsAPI } from "_querys/stations";
|
import { getStationsAPI } from "_querys/stations";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
|
||||||
export const ConnectionBtn = () => {
|
export const ConnectionBtn = () => {
|
||||||
const modalRef = useRef<HTMLDialogElement>(null);
|
const modalRef = useRef<HTMLDialogElement>(null);
|
||||||
@@ -15,6 +16,7 @@ export const ConnectionBtn = () => {
|
|||||||
logoffTime: null,
|
logoffTime: null,
|
||||||
selectedStationId: null,
|
selectedStationId: null,
|
||||||
});
|
});
|
||||||
|
const [logoffDebounce, setLogoffDebounce] = useState<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
const { data: stations } = useQuery({
|
const { data: stations } = useQuery({
|
||||||
queryKey: ["stations"],
|
queryKey: ["stations"],
|
||||||
@@ -73,6 +75,7 @@ export const ConnectionBtn = () => {
|
|||||||
) : (
|
) : (
|
||||||
<h3 className="text-lg font-bold mb-5">Als Pilot anmelden</h3>
|
<h3 className="text-lg font-bold mb-5">Als Pilot anmelden</h3>
|
||||||
)}
|
)}
|
||||||
|
{connection.status !== "connected" && (
|
||||||
<fieldset className="fieldset w-full">
|
<fieldset className="fieldset w-full">
|
||||||
<label className="floating-label w-full text-base">
|
<label className="floating-label w-full text-base">
|
||||||
<span>Station</span>
|
<span>Station</span>
|
||||||
@@ -94,16 +97,23 @@ export const ConnectionBtn = () => {
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
)}
|
||||||
<fieldset className="fieldset w-full mt-2">
|
<fieldset className="fieldset w-full mt-2">
|
||||||
<label className="floating-label w-full text-base">
|
<label className="floating-label w-full text-base">
|
||||||
<span>Logoff Zeit (UTC+1)</span>
|
<span>Logoff Zeit (UTC+1)</span>
|
||||||
<input
|
<input
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
|
const value = e.target.value;
|
||||||
setForm({
|
setForm({
|
||||||
...form,
|
...form,
|
||||||
logoffTime: e.target.value,
|
logoffTime: value,
|
||||||
})
|
});
|
||||||
}
|
if (logoffDebounce) clearTimeout(logoffDebounce);
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
toast.success("Änderung gespeichert!");
|
||||||
|
}, 2000);
|
||||||
|
setLogoffDebounce(timeout);
|
||||||
|
}}
|
||||||
value={form.logoffTime ?? ""}
|
value={form.logoffTime ?? ""}
|
||||||
type="time"
|
type="time"
|
||||||
className="input w-full"
|
className="input w-full"
|
||||||
|
|||||||
Reference in New Issue
Block a user