diff --git a/apps/dispatch-server/socket-events/connect-desktop.ts b/apps/dispatch-server/socket-events/connect-desktop.ts
index a6d1ce3f..1a4b78e8 100644
--- a/apps/dispatch-server/socket-events/connect-desktop.ts
+++ b/apps/dispatch-server/socket-events/connect-desktop.ts
@@ -14,32 +14,5 @@ export const handleConnectDesktop = (socket: Socket, io: Server) => () => {
socket.on("ptt", async (data: PTTData) => {
socket.to(`user:${user.id}`).emit("ptt", data);
- const connectedAircraft = await prisma.connectedAircraft.findFirst({
- where: {
- userId: user.id,
- logoutTime: null,
- },
- include: {
- Station: true,
- },
- });
-
- const connectedDispatcher = await prisma.connectedDispatcher.findFirst({
- where: {
- userId: user.id,
- logoutTime: null,
- },
- });
- const otherPttData = {
- publicUser: getPublicUser(user),
- source:
- connectedAircraft?.Station.bosCallsignShort || connectedDispatcher
- ? "Leitstelle"
- : user.publicId,
- };
- if (data.shouldTransmit) {
- socket.to("dispatchers").emit("other-ptt", otherPttData);
- socket.to("pilots").emit("other-ptt", otherPttData);
- }
});
};
diff --git a/apps/dispatch-server/socket-events/connect-pilot.ts b/apps/dispatch-server/socket-events/connect-pilot.ts
index d37618d4..0e5c93e2 100644
--- a/apps/dispatch-server/socket-events/connect-pilot.ts
+++ b/apps/dispatch-server/socket-events/connect-pilot.ts
@@ -112,22 +112,6 @@ export const handleConnectPilot =
connectedAircraftEntry,
);
- // Add a listener for station-specific events
- socket.on("ptt", async ({ shouldTransmit, channel }) => {
- if (shouldTransmit) {
- io.to("dispatchers").emit("other-ptt", {
- publicUser: getPublicUser(user),
- channel,
- source: Station?.bosCallsignShort,
- });
- io.to("piots").emit("other-ptt", {
- publicUser: getPublicUser(user),
- channel,
- source: Station?.bosCallsignShort,
- });
- }
- });
-
socket.on("disconnect", async () => {
await prisma.connectedAircraft
.update({
diff --git a/apps/dispatch/app/_components/left/SituationBoard.tsx b/apps/dispatch/app/_components/left/SituationBoard.tsx
index fbc5708d..63c9ab3e 100644
--- a/apps/dispatch/app/_components/left/SituationBoard.tsx
+++ b/apps/dispatch/app/_components/left/SituationBoard.tsx
@@ -12,7 +12,11 @@ import { useDispatchConnectionStore } from "_store/dispatch/connectionStore";
export const SituationBoard = () => {
const { setSituationTabOpen, situationTabOpen } = useLeftMenuStore();
- const dispatcherConnected = useDispatchConnectionStore((state) => state.status === "connected");
+ const { status, setHideDraftMissions, hideDraftMissions } = useDispatchConnectionStore(
+ (state) => state,
+ );
+ const dispatcherConnected = status === "connected";
+
const { data: missions } = useQuery({
queryKey: ["missions", "missions-on-stations"],
queryFn: () =>
@@ -34,6 +38,11 @@ export const SituationBoard = () => {
},
),
});
+
+ const filteredMissions = missions?.filter(
+ (mission) => !hideDraftMissions || mission.state !== "draft",
+ );
+
const { data: connectedAircrafts } = useQuery({
queryKey: ["aircrafts"],
queryFn: () => getConnectedAircraftsAPI(),
@@ -60,8 +69,21 @@ export const SituationBoard = () => {
- Einsatzliste
+ Einsatzliste{" "}
+
+
+
+
+
{/* head */}
@@ -74,8 +96,7 @@ export const SituationBoard = () => {
- {/* row 1 */}
- {missions?.map(
+ {filteredMissions?.map(
(mission) =>
(dispatcherConnected || mission.state !== "draft") && (
{
};
export const MissionLayer = () => {
- const dispatcherConnected = useDispatchConnectionStore((s) => s.status) === "connected";
+ const dispatchState = useDispatchConnectionStore((s) => s);
+ const dispatcherConnected = dispatchState.status === "connected";
+
const { data: missions = [] } = useQuery({
queryKey: ["missions"],
queryFn: () =>
@@ -377,10 +379,15 @@ export const MissionLayer = () => {
const filteredMissions = useMemo(() => {
if (!dispatcherConnected) {
- return missions.filter((m: Mission) => m.state === "running");
+ return missions.filter((m: Mission) => {
+ m.state === "running";
+ });
+ }
+ if (dispatchState.hideDraftMissions) {
+ return missions.filter((m: Mission) => m.state !== "draft");
}
return missions;
- }, [missions, dispatcherConnected]);
+ }, [missions, dispatcherConnected, dispatchState.hideDraftMissions]);
// IDEA: Add Marker to Map Layer / LayerGroup
return (
diff --git a/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx b/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx
index 91df9ccd..bcda4889 100644
--- a/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx
+++ b/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx
@@ -334,6 +334,7 @@ const SDSTab = ({
const [isChatOpen, setIsChatOpen] = useState(false);
const [note, setNote] = useState("");
const queryClient = useQueryClient();
+ const textInputRef = React.useRef(null);
const dispatcherConnected = useDispatchConnectionStore((s) => s.status) === "connected";
@@ -352,13 +353,23 @@ const SDSTab = ({
},
});
- const log =
- (mission?.missionLog as unknown as MissionLog[])
- ?.slice()
- .reverse()
- .filter(
- (entry) => entry.type === "sds-log" && entry.data.stationId === aircraft.Station.id,
- ) || [];
+ const log = useMemo(
+ () =>
+ (mission?.missionLog as unknown as MissionLog[])
+ ?.slice()
+ .reverse()
+ .filter(
+ (entry) => entry.type === "sds-log" && entry.data.stationId === aircraft.Station.id,
+ ) || [],
+ [mission?.missionLog, aircraft.Station.id],
+ );
+
+ useEffect(() => {
+ const interval = setInterval(() => {
+ textInputRef.current?.focus();
+ }, 100);
+ return () => clearInterval(interval);
+ });
return (
@@ -377,11 +388,13 @@ const SDSTab = ({
) : (
setNote(e.target.value)}
+ ref={textInputRef}
/>