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