From 9684d79e21a45d8c91b8054fc8f77d55e9c0d9d9 Mon Sep 17 00:00:00 2001 From: nocnico Date: Thu, 24 Apr 2025 23:29:50 +0200 Subject: [PATCH] Mission Marker Home & Log Page --- apps/dispatch/app/_store/missionsStore.ts | 10 +- .../_components/map/AircraftMarker.tsx | 3 +- .../_components/map/MissionMarkers.tsx | 35 ++++- .../map/_components/MissionMarkerTabs.tsx | 144 ++++++++++++++---- 4 files changed, 152 insertions(+), 40 deletions(-) diff --git a/apps/dispatch/app/_store/missionsStore.ts b/apps/dispatch/app/_store/missionsStore.ts index 03d368d7..77917fac 100644 --- a/apps/dispatch/app/_store/missionsStore.ts +++ b/apps/dispatch/app/_store/missionsStore.ts @@ -23,10 +23,10 @@ export const useMissionsStore = create((set) => ({ missionAdditionalInfo: "", addressLat: 52.520008, addressLng: 13.404954, - missionKeywordName: "Test", - missionKeywordCategory: "Test", - missionKeywordAbbreviation: "Test", - missionPatientInfo: "Test", + missionKeywordName: "TestKName", + missionKeywordCategory: "TestKCategory", + missionKeywordAbbreviation: "TestKAbbreviation", + missionPatientInfo: "TestPatientInfo", missionStationIds: [], createdUserId: "1", missionLog: [], @@ -73,7 +73,7 @@ export const useMissionsStore = create((set) => ({ }); if (!res.ok) return undefined; const data = await res.json(); - set({ missions: data }); + //set({ missions: data }); return undefined; }, setMission: (mission) => diff --git a/apps/dispatch/app/dispatch/_components/map/AircraftMarker.tsx b/apps/dispatch/app/dispatch/_components/map/AircraftMarker.tsx index c77910c1..c3c76132 100644 --- a/apps/dispatch/app/dispatch/_components/map/AircraftMarker.tsx +++ b/apps/dispatch/app/dispatch/_components/map/AircraftMarker.tsx @@ -47,6 +47,7 @@ export const FMS_STATUS_TEXT_COLORS: { [key: string]: string } = { "7": "rgb(243,27,25)", "8": "rgb(255,143,0)", "9": "rgb(9,212,33)", + N: "rgb(153,153,153)", }; const AircraftPopupContent = ({ aircraft }: { aircraft: Aircraft }) => { @@ -97,7 +98,7 @@ const AircraftPopupContent = ({ aircraft }: { aircraft: Aircraft }) => { }); }} > - +
= { draft: "#0092b8", @@ -31,11 +33,13 @@ export const MISSION_STATUS_TEXT_COLORS: Record = { const MissionPopupContent = ({ mission }: { mission: Mission }) => { const setMissionTab = useMapStore((state) => state.setMissionTab); const currentTab = useMapStore( - (state) => state.missionTabs[mission.id] || "home", + (state) => + state.missionTabs[mission.id] || + ("home" as "home" | "details" | "chat" | "log"), ); const handleTabChange = useCallback( - (tab: "home" | "details" | "chat") => { + (tab: "home" | "details" | "chat" | "log") => { if (currentTab !== tab) { setMissionTab(mission.id, tab); } @@ -46,11 +50,13 @@ const MissionPopupContent = ({ mission }: { mission: Mission }) => { const renderTabContent = useMemo(() => { switch (currentTab) { case "home": - return ; + return ; case "details": return
Details Content
; case "chat": return
Chat Content
; + case "log": + return ; default: return Error; } @@ -72,7 +78,7 @@ const MissionPopupContent = ({ mission }: { mission: Mission }) => { }); }} > - +
{ >
+
handleTabChange("log")} + > + +
{renderTabContent}
@@ -239,7 +258,7 @@ const MissionMarker = ({ mission }: { mission: Mission }) => { " > - ${mission.missionSummary} + ${mission.missionKeywordCategory}
{ + return ( +
+

+ Einsatzdetails +

+
    +
  • + AB_ATMUNG +
  • +
  • + + Gleichbleibende Atembeschwerden +
  • +
  • + + __202504161 +
  • +
+
+
+

+ 52.520008, 13.404954 +

+

+ Alexanderplatz +

+

+ Berlin, 10178 +

+
+
+
+ + + +
+
+ ); +}; const FMSStatusHistory = () => { + const [isAddingNote, setIsAddingNote] = useState(false); + const [note, setNote] = useState(""); + const dummyData = [ - { status: "3", time: "12:00", unit: "RTW", unitshort: "RTW" }, - { status: "3", time: "12:01", unit: "Christoph 31", unitshort: "CHX31" }, - { status: "4", time: "12:09", unit: "RTW", unitshort: "RTW" }, - { status: "4", time: "12:11", unit: "Christoph 31", unitshort: "CHX31" }, - { status: "7", time: "12:34", unit: "RTW", unitshort: "RTW" }, + { + status: "N", + time: "12:39", + unit: "RTH defekt, verbleibt an Einsatzort", + unitshort: "", + }, { status: "1", time: "12:38", unit: "Christoph 31", unitshort: "CHX31" }, + { status: "7", time: "12:34", unit: "RTW", unitshort: "RTW" }, + { status: "4", time: "12:11", unit: "Christoph 31", unitshort: "CHX31" }, + { status: "4", time: "12:09", unit: "RTW", unitshort: "RTW" }, + { status: "3", time: "12:01", unit: "Christoph 31", unitshort: "CHX31" }, + { status: "3", time: "12:00", unit: "RTW", unitshort: "RTW" }, ]; return (
- {[ - ...new Map(dummyData.map((entry) => [entry.unit, entry])).values(), - ].map((entry, index, array) => ( - -
- - {entry.status} - - {entry.unitshort} -
- {index < array.length - 1 && |} -
- ))} + {!isAddingNote ? ( + + ) : ( +
+ setNote(e.target.value)} + /> + + +
+ )}
-
    +
      {dummyData.map((entry, index) => (
    • {entry.time} @@ -55,4 +146,5 @@ const FMSStatusHistory = () => { ); }; -export default FMSStatusHistory; +export { FMSStatusHistory }; +export default Einsatzdetails;