diff --git a/apps/dispatch/app/(app)/dispatch/page.tsx b/apps/dispatch/app/(app)/dispatch/page.tsx index 648945fc..af5c8045 100644 --- a/apps/dispatch/app/(app)/dispatch/page.tsx +++ b/apps/dispatch/app/(app)/dispatch/page.tsx @@ -18,14 +18,10 @@ const DispatchPage = () => {
{/* */}
-
+
-
- -
-
- -
+ +
diff --git a/apps/dispatch/app/(app)/pilot/page.tsx b/apps/dispatch/app/(app)/pilot/page.tsx index 015ec84e..ca3b6cdd 100644 --- a/apps/dispatch/app/(app)/pilot/page.tsx +++ b/apps/dispatch/app/(app)/pilot/page.tsx @@ -33,14 +33,10 @@ 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 = () => { )}