added Callback and custon notification Toast, client notification event handler
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import { Station } from "@repo/db";
|
||||
import { MissionSdsLog, Station } from "@repo/db";
|
||||
import { fmsStatusDescription } from "_data/fmsStatusDescription";
|
||||
import { DisplayLineProps } from "pilot/_components/mrt/Mrt";
|
||||
import { create } from "zustand";
|
||||
import { syncTabs } from "zustand-sync-tabs";
|
||||
|
||||
interface SetSdsPageParams {
|
||||
page: "sds";
|
||||
station: Station;
|
||||
sdsMessage: MissionSdsLog;
|
||||
}
|
||||
|
||||
interface SetHomePageParams {
|
||||
page: "home";
|
||||
station: Station;
|
||||
@@ -23,6 +29,7 @@ interface SetNewStatusPageParams {
|
||||
type SetPageParams =
|
||||
| SetHomePageParams
|
||||
| SetSendingStatusPageParams
|
||||
| SetSdsPageParams
|
||||
| SetNewStatusPageParams;
|
||||
|
||||
interface MrtStore {
|
||||
@@ -123,6 +130,25 @@ export const useMrtStore = create<MrtStore>(
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "sds": {
|
||||
const { sdsMessage } = pageData as SetSdsPageParams;
|
||||
set({
|
||||
page: "sds",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `neue SDS-Nachricht`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{
|
||||
textLeft: sdsMessage.data.message,
|
||||
style: {},
|
||||
textSize: "1",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
set({ page: "home" });
|
||||
break;
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
import { create } from "zustand";
|
||||
import { dispatchSocket } from "../../dispatch/socket";
|
||||
import { ConnectedAircraft, Mission, Station, User } from "@repo/db";
|
||||
import {
|
||||
ConnectedAircraft,
|
||||
Mission,
|
||||
MissionSdsLog,
|
||||
NotificationPayload,
|
||||
Station,
|
||||
User,
|
||||
} from "@repo/db";
|
||||
import { pilotSocket } from "pilot/socket";
|
||||
import { useDmeStore } from "_store/pilot/dmeStore";
|
||||
import { useMrtStore } from "_store/pilot/MrtStore";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
interface ConnectionStore {
|
||||
status: "connected" | "disconnected" | "connecting" | "error";
|
||||
@@ -103,3 +112,13 @@ pilotSocket.on("mission-alert", (data: Mission & { Stations: Station[] }) => {
|
||||
page: "new-mission",
|
||||
});
|
||||
});
|
||||
|
||||
pilotSocket.on("sds-message", (sdsMessage: MissionSdsLog) => {
|
||||
const station = usePilotConnectionStore.getState().selectedStation;
|
||||
if (!station) return;
|
||||
useMrtStore.getState().setPage({
|
||||
page: "sds",
|
||||
station,
|
||||
sdsMessage,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user