diff --git a/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx b/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx
index 2e89c7b6..3a323a6c 100644
--- a/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx
+++ b/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx
@@ -1,30 +1,41 @@
"use client";
-import { ArrowLeftRight, Plane, Workflow } from "lucide-react";
+import { ArrowLeftRight, Plane, Radar, Workflow } from "lucide-react";
+import { useSession } from "next-auth/react";
import Link from "next/link";
import { usePathname } from "next/navigation";
export default function ModeSwitchDropdown() {
const path = usePathname();
+ const session = useSession();
return (
-
{path.includes("pilot") && "Pilot"}
+
{path.includes("pilot") && "Pilot"}
{path.includes("dispatch") && "Leitstelle"}
+ {session.data?.user.permissions?.includes("DISPO") && (
+ -
+
+ Leitstelle
+
+
+ )}
+ {session.data?.user.permissions?.includes("PILOT") && (
+ -
+
+ Pilot
+
+
+ )}
-
-
- Leitstelle
-
-
- -
-
- Pilot
+
+ Tracker
diff --git a/apps/dispatch/app/pilot/_components/ConnectedDispatcher.tsx b/apps/dispatch/app/pilot/_components/ConnectedDispatcher.tsx
new file mode 100644
index 00000000..d81bf1b4
--- /dev/null
+++ b/apps/dispatch/app/pilot/_components/ConnectedDispatcher.tsx
@@ -0,0 +1,96 @@
+import { BADGES, PublicUser } from "@repo/db";
+import { useQuery } from "@tanstack/react-query";
+import { Badge } from "_components/Badge/Badge";
+import { getConnectedAircraftsAPI } from "_querys/aircrafts";
+import { getConnectedDispatcherAPI } from "_querys/connected-user";
+import { Plane, Workflow } from "lucide-react";
+
+export const ConnectedDispatcher = () => {
+ const { data: dispatcher } = useQuery({
+ queryKey: ["dispatcher"],
+ queryFn: () => getConnectedDispatcherAPI(),
+ refetchInterval: 10000,
+ });
+ const { data: aircrafts } = useQuery({
+ queryKey: ["aircrafts"],
+ queryFn: () => getConnectedAircraftsAPI(),
+ refetchInterval: 10000,
+ });
+
+ const connections = (aircrafts?.length || 0) + (dispatcher?.length || 0);
+
+ return (
+
+
+
+
+ {/*
Kein Disponent Online
*/}
+
+
+ {connections} {connections == 1 ? "Verbundenes Mitglied" : "Verbundene Mitglieder"}
+
+
+
0 ? "badge-success" : "badge-error"
+ }`}
+ >
+ {dispatcher?.length || 0}
+
+
+
{aircrafts?.length || 0}
+
+
+
+
+ {!dispatcher?.length && (
+
Aktuell sind keine Disponenten verbunden
+ )}
+
+
+
+
+
+ );
+};
diff --git a/apps/dispatch/app/pilot/page.tsx b/apps/dispatch/app/pilot/page.tsx
index 20d8d35c..24b817e6 100644
--- a/apps/dispatch/app/pilot/page.tsx
+++ b/apps/dispatch/app/pilot/page.tsx
@@ -5,6 +5,7 @@ import { Chat } from "../_components/left/Chat";
import { Report } from "../_components/left/Report";
import { Dme } from "pilot/_components/dme/Dme";
import dynamic from "next/dynamic";
+import { ConnectedDispatcher } from "./_components/ConnectedDispatcher";
const Map = dynamic(() => import("../_components/map/Map"), {
ssr: false,
});
@@ -22,6 +23,7 @@ const DispatchPage = () => {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f3926b44..f7bacd60 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -57,9 +57,6 @@ importers:
'@repo/typescript-config':
specifier: workspace:*
version: link:../../packages/typescript-config
- '@types/cookie-parser':
- specifier: ^1.4.8
- version: 1.4.8(@types/express@5.0.2)
'@types/cors':
specifier: ^2.8.18
version: 2.8.18