From b0facf0941fb926d03bb5c1a014ccbc466334c89 Mon Sep 17 00:00:00 2001
From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com>
Date: Fri, 18 Jul 2025 15:59:26 -0700
Subject: [PATCH] #46 Einsatz-Marker & Chat/Report disabled wenn nicht
verbunden
---
apps/dispatch/app/(app)/pilot/page.tsx | 6 ++----
apps/dispatch/app/_components/left/Chat.tsx | 16 +++++++++++++-
apps/dispatch/app/_components/left/Report.tsx | 18 +++++++++++++++-
.../app/_components/map/ContextMenu.tsx | 4 ++--
apps/dispatch/app/_components/map/Map.tsx | 2 ++
.../app/_components/map/MapAdditionals.tsx | 20 ++++++++++++++++++
apps/dispatch/public/icons/mapMarker.png | Bin 0 -> 13885 bytes
7 files changed, 58 insertions(+), 8 deletions(-)
create mode 100644 apps/dispatch/app/_components/map/MapAdditionals.tsx
create mode 100644 apps/dispatch/public/icons/mapMarker.png
diff --git a/apps/dispatch/app/(app)/pilot/page.tsx b/apps/dispatch/app/(app)/pilot/page.tsx
index 05e3bdb9..fbb33e52 100644
--- a/apps/dispatch/app/(app)/pilot/page.tsx
+++ b/apps/dispatch/app/(app)/pilot/page.tsx
@@ -32,11 +32,9 @@ const PilotPage = () => {
{/*
*/}
-
+
diff --git a/apps/dispatch/app/_components/left/Chat.tsx b/apps/dispatch/app/_components/left/Chat.tsx
index b62e4842..21b0b177 100644
--- a/apps/dispatch/app/_components/left/Chat.tsx
+++ b/apps/dispatch/app/_components/left/Chat.tsx
@@ -9,6 +9,7 @@ import { useQuery } from "@tanstack/react-query";
import { getConnectedDispatcherAPI } from "_querys/dispatcher";
import { getConnectedAircraftsAPI } from "_querys/aircrafts";
import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
+import { usePilotConnectionStore } from "_store/pilot/connectionStore";
export const Chat = () => {
const {
@@ -28,6 +29,7 @@ export const Chat = () => {
const [addTabValue, setAddTabValue] = useState
("default");
const [message, setMessage] = useState("");
const dispatcherConnected = useDispatchConnectionStore((state) => state.status === "connected");
+ const pilotConnected = usePilotConnectionStore((state) => state.status === "connected");
const { data: dispatcher } = useQuery({
queryKey: ["dispatcher"],
@@ -51,6 +53,14 @@ export const Chat = () => {
(a) => a.userId !== session.data?.user.id && dispatcherConnected,
);
+ const btnActive = pilotConnected || dispatcherConnected;
+
+ useEffect(() => {
+ if (!btnActive) {
+ setChatOpen(false);
+ }
+ }, [btnActive, setChatOpen]);
+
return (
@@ -58,8 +68,12 @@ export const Chat = () => {
)}