From 18a4dfaf6e31a96d6c67b5f7e6a0b7397d9c12ed Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Mon, 9 Jun 2025 23:58:08 -0700 Subject: [PATCH] added revalidate btn --- .../app/_components/map/MissionMarkers.tsx | 14 ++++------- .../map/_components/MarkerCluster.tsx | 14 ++++++----- .../map/_components/MissionMarkerTabs.tsx | 23 ++++++++++++++++--- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/apps/dispatch/app/_components/map/MissionMarkers.tsx b/apps/dispatch/app/_components/map/MissionMarkers.tsx index 9afe839c..2cf1a4a0 100644 --- a/apps/dispatch/app/_components/map/MissionMarkers.tsx +++ b/apps/dispatch/app/_components/map/MissionMarkers.tsx @@ -378,15 +378,11 @@ export const MissionLayer = () => { }); const filteredMissions = useMemo(() => { - if (!dispatcherConnected) { - return missions.filter((m: Mission) => { - m.state === "running"; - }); - } - if (dispatchState.hideDraftMissions) { - return missions.filter((m: Mission) => m.state !== "draft"); - } - return missions; + return missions.filter((m: Mission) => { + if (m.state === "draft" && !dispatcherConnected) return false; + if (dispatchState.hideDraftMissions && m.state === "draft") return false; + return true; + }); }, [missions, dispatcherConnected, dispatchState.hideDraftMissions]); // IDEA: Add Marker to Map Layer / LayerGroup diff --git a/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx b/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx index aeb70b02..e0707994 100644 --- a/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx +++ b/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx @@ -135,13 +135,14 @@ const PopupContent = ({ export const MarkerCluster = () => { const map = useMap(); + const dispatchState = useDispatchConnectionStore((s) => s); + const dispatcherConnected = dispatchState.status === "connected"; const { data: aircrafts } = useQuery({ queryKey: ["aircrafts"], queryFn: getConnectedAircraftsAPI, refetchInterval: 10_000, }); - const dispatcherConnected = useDispatchConnectionStore((s) => s.status) === "connected"; const { data: missions = [] } = useQuery({ queryKey: ["missions"], queryFn: () => @@ -151,11 +152,12 @@ export const MarkerCluster = () => { }); const filteredMissions = useMemo(() => { - if (!dispatcherConnected) { - return missions.filter((m: Mission) => m.state === "running"); - } - return missions; - }, [missions, dispatcherConnected]); + return missions.filter((m: Mission) => { + if (m.state === "draft" && !dispatcherConnected) return false; + if (dispatchState.hideDraftMissions && m.state === "draft") return false; + return true; + }); + }, [missions, dispatcherConnected, dispatchState.hideDraftMissions]); // Track zoom level in state const [zoom, setZoom] = useState(() => map.getZoom()); diff --git a/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx b/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx index 31f9d628..d47edeed 100644 --- a/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx +++ b/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx @@ -35,7 +35,12 @@ import { import { usePannelStore } from "_store/pannelStore"; import { useSession } from "next-auth/react"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { deleteMissionAPI, editMissionAPI, sendMissionAPI } from "_querys/missions"; +import { + deleteMissionAPI, + editMissionAPI, + sendMissionAPI, + startHpgValidation, +} from "_querys/missions"; import { getConnectedAircraftsAPI } from "_querys/aircrafts"; import { getStationsAPI } from "_querys/stations"; import { useDispatchConnectionStore } from "_store/dispatch/connectionStore"; @@ -190,8 +195,8 @@ const Einsatzdetails = ({
- {hpgNeedsAttention && ( -
+ {true && ( +
+
)}