diff --git a/apps/dispatch-server/package.json b/apps/dispatch-server/package.json index 1e30c78d..c659b110 100644 --- a/apps/dispatch-server/package.json +++ b/apps/dispatch-server/package.json @@ -10,8 +10,8 @@ }, "packageManager": "pnpm@10.11.0", "devDependencies": { - "@repo/db": "*", - "@repo/typescript-config": "*", + "@repo/db": "workspace:*", + "@repo/typescript-config": "workspace:*", "@types/cookie-parser": "^1.4.8", "@types/cors": "^2.8.18", "@types/express": "^5.0.2", diff --git a/apps/dispatch/app/_components/left/SituationBoard.tsx b/apps/dispatch/app/_components/left/SituationBoard.tsx index 1d14859c..fbc5708d 100644 --- a/apps/dispatch/app/_components/left/SituationBoard.tsx +++ b/apps/dispatch/app/_components/left/SituationBoard.tsx @@ -1,13 +1,12 @@ "use client"; import { useLeftMenuStore } from "_store/leftMenuStore"; -import { useSession } from "next-auth/react"; import { cn } from "_helpers/cn"; import { ListCollapse, Plane } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import { getMissionsAPI } from "_querys/missions"; -import { MissionsOnStations, Station } from "@repo/db"; +import { Station } from "@repo/db"; import { getConnectedAircraftsAPI } from "_querys/aircrafts"; -import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_components/map/AircraftMarker"; +import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors"; import { useMapStore } from "_store/mapStore"; import { useDispatchConnectionStore } from "_store/dispatch/connectionStore"; @@ -68,7 +67,7 @@ export const SituationBoard = () => { {/* head */} - ID + E-Nr. Stichwort Stadt Stationen @@ -76,39 +75,42 @@ export const SituationBoard = () => { {/* row 1 */} - {missions?.map((mission) => ( - { - setOpenMissionMarker({ - open: [ - { - id: mission.id, - tab: "home", - }, - ], - close: [], - }); - setMap({ - center: { - lat: mission.addressLat, - lng: mission.addressLng, - }, - zoom: 14, - }); - }} - key={mission.id} - className={cn(mission.state === "draft" && "bg-base-300")} - > - {mission.publicId} - {mission.missionKeywordAbbreviation} - {mission.addressCity} - - {(mission as any).MissionsOnStations?.map( - (mos: { Station: Station }) => mos.Station?.bosCallsignShort, - ).join(", ")} - - - ))} + {missions?.map( + (mission) => + (dispatcherConnected || mission.state !== "draft") && ( + { + setOpenMissionMarker({ + open: [ + { + id: mission.id, + tab: "home", + }, + ], + close: [], + }); + setMap({ + center: { + lat: mission.addressLat, + lng: mission.addressLng, + }, + zoom: 14, + }); + }} + key={mission.id} + className={cn(mission.state === "draft" && "missionListItem")} + > + {mission.publicId} + {mission.missionKeywordAbbreviation} + {mission.addressCity} + + {(mission as any).MissionsOnStations?.map( + (mos: { Station: Station }) => mos.Station?.bosCallsignShort, + ).join(", ")} + + + ), + )} diff --git a/apps/dispatch/app/_components/map/AircraftMarker.tsx b/apps/dispatch/app/_components/map/AircraftMarker.tsx index ba347ad0..f2a920a1 100644 --- a/apps/dispatch/app/_components/map/AircraftMarker.tsx +++ b/apps/dispatch/app/_components/map/AircraftMarker.tsx @@ -16,53 +16,7 @@ import { useQuery } from "@tanstack/react-query"; import { getConnectedAircraftPositionLogAPI, getConnectedAircraftsAPI } from "_querys/aircrafts"; import { getMissionsAPI } from "_querys/missions"; import { checkSimulatorConnected } from "_helpers/simulatorConnected"; - -export const FMS_STATUS_COLORS: { [key: string]: string } = { - "0": "rgb(140,10,10)", - "1": "rgb(10,134,25)", - "2": "rgb(10,134,25)", - "3": "rgb(140,10,10)", - "4": "rgb(140,10,10)", - "5": "rgb(231,77,22)", - "6": "rgb(85,85,85)", - "7": "rgb(140,10,10)", - "8": "rgb(186,105,0)", - "9": "rgb(10,134,25)", - E: "rgb(186,105,0)", - C: "rgb(186,105,0)", - F: "rgb(186,105,0)", - J: "rgb(186,105,0)", - L: "rgb(186,105,0)", - c: "rgb(186,105,0)", - d: "rgb(186,105,0)", - h: "rgb(186,105,0)", - o: "rgb(186,105,0)", - u: "rgb(186,105,0)", -}; - -export const FMS_STATUS_TEXT_COLORS: { [key: string]: string } = { - "0": "rgb(243,27,25)", - "1": "rgb(9,212,33)", - "2": "rgb(9,212,33)", - "3": "rgb(243,27,25)", - "4": "rgb(243,27,25)", - "5": "rgb(251,176,158)", - "6": "rgb(153,153,153)", - "7": "rgb(243,27,25)", - "8": "rgb(255,143,0)", - "9": "rgb(9,212,33)", - N: "rgb(9,212,33)", - E: "rgb(255,143,0)", - C: "rgb(255,143,0)", - F: "rgb(255,143,0)", - J: "rgb(255,143,0)", - L: "rgb(255,143,0)", - c: "rgb(255,143,0)", - d: "rgb(255,143,0)", - h: "rgb(255,143,0)", - o: "rgb(255,143,0)", - u: "rgb(255,143,0)", -}; +import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors"; const AircraftPopupContent = ({ aircraft, diff --git a/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx b/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx index ac3e7d45..35bd80d8 100644 --- a/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx +++ b/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx @@ -1,6 +1,6 @@ "use client"; import React, { useState } from "react"; -import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "../AircraftMarker"; +import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors"; import { ConnectedAircraft, getPublicUser, diff --git a/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx b/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx index fa35e6e8..18e30a49 100644 --- a/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx +++ b/apps/dispatch/app/_components/map/_components/MarkerCluster.tsx @@ -3,7 +3,7 @@ import { useQuery } from "@tanstack/react-query"; import { SmartPopup, useSmartPopup } from "_components/SmartPopup"; import { useDispatchConnectionStore } from "_store/dispatch/connectionStore"; import { useMapStore } from "_store/mapStore"; -import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_components/map/AircraftMarker"; +import { FMS_STATUS_COLORS, FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors"; import { MISSION_STATUS_COLORS, MISSION_STATUS_TEXT_COLORS } from "_components/map/MissionMarkers"; import { cn } from "_helpers/cn"; import { checkSimulatorConnected } from "_helpers/simulatorConnected"; diff --git a/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx b/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx index 44d6ad12..9d8185c7 100644 --- a/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx +++ b/apps/dispatch/app/_components/map/_components/MissionMarkerTabs.tsx @@ -1,6 +1,6 @@ "use client"; import React, { useEffect, useState } from "react"; -import { FMS_STATUS_TEXT_COLORS } from "../AircraftMarker"; +import { FMS_STATUS_TEXT_COLORS } from "_helpers/fmsStatusColors"; import { toast } from "react-hot-toast"; import { Ban, diff --git a/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx b/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx index a79fbb70..2e89c7b6 100644 --- a/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx +++ b/apps/dispatch/app/_components/navbar/ModeSwitchDropdown.tsx @@ -8,12 +8,15 @@ export default function ModeSwitchDropdown() { const path = usePathname(); return ( -
- +
+
{path.includes("pilot") && "Pilot"} {path.includes("dispatch") && "Leitstelle"} -
-
+ ); } diff --git a/apps/dispatch/app/_helpers/fmsStatusColors.ts b/apps/dispatch/app/_helpers/fmsStatusColors.ts new file mode 100644 index 00000000..fa5a3c37 --- /dev/null +++ b/apps/dispatch/app/_helpers/fmsStatusColors.ts @@ -0,0 +1,46 @@ +export const FMS_STATUS_COLORS: { [key: string]: string } = { + "0": "rgb(140,10,10)", + "1": "rgb(10,134,25)", + "2": "rgb(10,134,25)", + "3": "rgb(140,10,10)", + "4": "rgb(140,10,10)", + "5": "rgb(231,77,22)", + "6": "rgb(85,85,85)", + "7": "rgb(140,10,10)", + "8": "rgb(186,105,0)", + "9": "rgb(10,134,25)", + E: "rgb(186,105,0)", + C: "rgb(186,105,0)", + F: "rgb(186,105,0)", + J: "rgb(186,105,0)", + L: "rgb(186,105,0)", + c: "rgb(186,105,0)", + d: "rgb(186,105,0)", + h: "rgb(186,105,0)", + o: "rgb(186,105,0)", + u: "rgb(186,105,0)", +}; + +export const FMS_STATUS_TEXT_COLORS: { [key: string]: string } = { + "0": "rgb(243,27,25)", + "1": "rgb(9,212,33)", + "2": "rgb(9,212,33)", + "3": "rgb(243,27,25)", + "4": "rgb(243,27,25)", + "5": "rgb(251,176,158)", + "6": "rgb(153,153,153)", + "7": "rgb(243,27,25)", + "8": "rgb(255,143,0)", + "9": "rgb(9,212,33)", + N: "rgb(9,212,33)", + E: "rgb(255,143,0)", + C: "rgb(255,143,0)", + F: "rgb(255,143,0)", + J: "rgb(255,143,0)", + L: "rgb(255,143,0)", + c: "rgb(255,143,0)", + d: "rgb(255,143,0)", + h: "rgb(255,143,0)", + o: "rgb(255,143,0)", + u: "rgb(255,143,0)", +}; diff --git a/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx b/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx index c5835bd5..b6669793 100644 --- a/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx +++ b/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx @@ -276,7 +276,7 @@ export const MissionForm = () => { <> { const keyword = keywords?.find((k) => k.abreviation === e.target.value); form.setValue("missionKeywordName", keyword?.name || (null as any)); @@ -332,10 +332,10 @@ export const MissionForm = () => {