Merge branch 'main' of https://github.com/VAR-Virtual-Air-Rescue/var-monorepo
This commit is contained in:
@@ -290,6 +290,8 @@ const SDSTab = ({
|
|||||||
const [note, setNote] = useState("");
|
const [note, setNote] = useState("");
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const dispatcherConnected = useDispatchConnectionStore((s) => s.status) === "connected";
|
||||||
|
|
||||||
const sendSdsMutation = useMutation({
|
const sendSdsMutation = useMutation({
|
||||||
mutationFn: async ({ id, message }: { id: number; message: MissionSdsLog }) => {
|
mutationFn: async ({ id, message }: { id: number; message: MissionSdsLog }) => {
|
||||||
await sendSdsMessageAPI(id, message);
|
await sendSdsMessageAPI(id, message);
|
||||||
@@ -309,6 +311,8 @@ const SDSTab = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
|
{dispatcherConnected && (
|
||||||
|
<div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{!isChatOpen ? (
|
{!isChatOpen ? (
|
||||||
<button
|
<button
|
||||||
@@ -368,6 +372,8 @@ const SDSTab = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="divider m-0" />
|
<div className="divider m-0" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<ul className="space-y-2 max-h-[300px] overflow-y-auto overflow-x-auto">
|
<ul className="space-y-2 max-h-[300px] overflow-y-auto overflow-x-auto">
|
||||||
{log.map((entry, index) => {
|
{log.map((entry, index) => {
|
||||||
const sdsEntry = entry as MissionSdsLog;
|
const sdsEntry = entry as MissionSdsLog;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export const useMrtStore = create<MrtStore>(
|
|||||||
page: "home",
|
page: "home",
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
textLeft: `VAR#.${station?.bosCallsign}`,
|
textLeft: `${station?.bosCallsign}`,
|
||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
textSize: "2",
|
textSize: "2",
|
||||||
},
|
},
|
||||||
@@ -92,7 +92,7 @@ export const useMrtStore = create<MrtStore>(
|
|||||||
page: "sending-status",
|
page: "sending-status",
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
textLeft: `VAR#.${station?.bosCallsign}`,
|
textLeft: `${station?.bosCallsign}`,
|
||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
textSize: "2",
|
textSize: "2",
|
||||||
},
|
},
|
||||||
@@ -116,7 +116,7 @@ export const useMrtStore = create<MrtStore>(
|
|||||||
page: "new-status",
|
page: "new-status",
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
textLeft: `VAR#.${station?.bosCallsign}`,
|
textLeft: `${station?.bosCallsign}`,
|
||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
textSize: "2",
|
textSize: "2",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -75,13 +75,17 @@ export const useDmeStore = create<MrtStore>(
|
|||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
textMid: pageData.station.bosCallsign
|
textMid: pageData.station.bosCallsign
|
||||||
? `VAR#.${pageData.station.bosCallsign}`
|
? `${pageData.station.bosCallsign}`
|
||||||
: "no Data",
|
: "no Data",
|
||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
},
|
},
|
||||||
{ textMid: "⠀" },
|
{ textMid: "⠀" },
|
||||||
{
|
{
|
||||||
textMid: new Date().toLocaleDateString(),
|
textMid: new Date().toLocaleDateString("de-DE", {
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
textMid: new Date().toLocaleTimeString(),
|
textMid: new Date().toLocaleTimeString(),
|
||||||
@@ -122,9 +126,7 @@ export const useDmeStore = create<MrtStore>(
|
|||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
textLeft: `${pageData.mission.missionKeywordAbbreviation}`,
|
textLeft: `${pageData.mission.missionKeywordAbbreviation}`,
|
||||||
textRight: pageData.mission.Stations.map(
|
textRight: pageData.mission.Stations.map((s) => s.bosCallsignShort).join(","),
|
||||||
(s) => s.bosCallsignShort,
|
|
||||||
).join(","),
|
|
||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -140,16 +142,14 @@ export const useDmeStore = create<MrtStore>(
|
|||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
textLeft:
|
textLeft: pageData.mission.missionPatientInfo || "keine Daten",
|
||||||
pageData.mission.missionPatientInfo || "keine Daten",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
textMid: "Weitere Infos:",
|
textMid: "Weitere Infos:",
|
||||||
style: { fontWeight: "bold" },
|
style: { fontWeight: "bold" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
textLeft:
|
textLeft: pageData.mission.missionAdditionalInfo || "keine Daten",
|
||||||
pageData.mission.missionAdditionalInfo || "keine Daten",
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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