Fix dispatcherConnected elements
This commit is contained in:
@@ -38,6 +38,7 @@ import {
|
|||||||
} from "querys/missions";
|
} from "querys/missions";
|
||||||
import { getConnectedAircraftsAPI } from "querys/aircrafts";
|
import { getConnectedAircraftsAPI } from "querys/aircrafts";
|
||||||
import { getStationsAPI } from "querys/stations";
|
import { getStationsAPI } from "querys/stations";
|
||||||
|
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
|
||||||
|
|
||||||
const Einsatzdetails = ({ mission }: { mission: Mission }) => {
|
const Einsatzdetails = ({ mission }: { mission: Mission }) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -80,6 +81,8 @@ const Einsatzdetails = ({ mission }: { mission: Mission }) => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const dispatcherConnected =
|
||||||
|
useDispatchConnectionStore((s) => s.status) === "connected";
|
||||||
const { setMissionFormValues, setOpen } = usePannelStore((state) => state);
|
const { setMissionFormValues, setOpen } = usePannelStore((state) => state);
|
||||||
return (
|
return (
|
||||||
<div className="p-4 text-base-content">
|
<div className="p-4 text-base-content">
|
||||||
@@ -87,9 +90,7 @@ const Einsatzdetails = ({ mission }: { mission: Mission }) => {
|
|||||||
<h2 className="flex items-center gap-2 text-lg font-bold">
|
<h2 className="flex items-center gap-2 text-lg font-bold">
|
||||||
<Flag /> Einsatzdetails
|
<Flag /> Einsatzdetails
|
||||||
</h2>
|
</h2>
|
||||||
{mission.state !== "draft" &&
|
{mission.state !== "draft" && dispatcherConnected && (
|
||||||
typeof window !== "undefined" &&
|
|
||||||
!window.location.pathname.startsWith("/pilot") && (
|
|
||||||
<div className="space-x-2">
|
<div className="space-x-2">
|
||||||
<div
|
<div
|
||||||
className="tooltip tooltip-primary tooltip-left font-semibold"
|
className="tooltip tooltip-primary tooltip-left font-semibold"
|
||||||
@@ -366,14 +367,16 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const dispatcherConnected =
|
||||||
|
useDispatchConnectionStore((s) => s.status) === "connected";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 text-base-content">
|
<div className="p-4 text-base-content">
|
||||||
<div className="flex items-center w-full justify-between">
|
<div className="flex items-center w-full justify-between">
|
||||||
<h2 className="flex items-center gap-2 text-lg font-bold mb-3">
|
<h2 className="flex items-center gap-2 text-lg font-bold mb-3">
|
||||||
<SmartphoneNfc /> Rettungsmittel
|
<SmartphoneNfc /> Rettungsmittel
|
||||||
</h2>
|
</h2>
|
||||||
{typeof window !== "undefined" &&
|
{dispatcherConnected && (
|
||||||
!window.location.pathname.startsWith("/pilot") && (
|
|
||||||
<div
|
<div
|
||||||
className="tooltip tooltip-primary tooltip-left font-semibold"
|
className="tooltip tooltip-primary tooltip-left font-semibold"
|
||||||
data-tip="Einsatz erneut alarmieren"
|
data-tip="Einsatz erneut alarmieren"
|
||||||
@@ -422,6 +425,8 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
{dispatcherConnected && (
|
||||||
|
<div>
|
||||||
<div className="divider mt-0 mb-0" />
|
<div className="divider mt-0 mb-0" />
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{/* TODO: make it a small multiselect */}
|
{/* TODO: make it a small multiselect */}
|
||||||
@@ -437,6 +442,8 @@ const Rettungsmittel = ({ mission }: { mission: Mission }) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -446,6 +453,9 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
|||||||
const [note, setNote] = useState("");
|
const [note, setNote] = useState("");
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const dispatcherConnected =
|
||||||
|
useDispatchConnectionStore((s) => s.status) === "connected";
|
||||||
|
|
||||||
const editMissionMutation = useMutation({
|
const editMissionMutation = useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({
|
||||||
id,
|
id,
|
||||||
@@ -464,8 +474,7 @@ const FMSStatusHistory = ({ mission }: { mission: Mission }) => {
|
|||||||
if (!session.data?.user) return null;
|
if (!session.data?.user) return null;
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
{typeof window !== "undefined" &&
|
{dispatcherConnected && (
|
||||||
!window.location.pathname.startsWith("/pilot") && (
|
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{!isAddingNote ? (
|
{!isAddingNote ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user