added Callback and custon notification Toast, client notification event handler
This commit is contained in:
@@ -47,6 +47,7 @@ export const useAudioStore = create<TalkState>((set, get) => ({
|
||||
const { room, isTalking } = get();
|
||||
if (!room) return;
|
||||
room.localParticipant.setMicrophoneEnabled(!isTalking);
|
||||
|
||||
if (!isTalking) {
|
||||
// If old status was not talking, we need to emit the PTT event
|
||||
if (pilotSocket.connected) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { create } from "zustand";
|
||||
import { dispatchSocket } from "../../dispatch/socket";
|
||||
import toast from "react-hot-toast";
|
||||
import { HPGnotificationToast } from "_components/customToasts/HPGnotification";
|
||||
import { NotificationPayload } from "@repo/db";
|
||||
|
||||
interface ConnectionStore {
|
||||
status: "connected" | "disconnected" | "connecting" | "error";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { OSMWay } from "@repo/db";
|
||||
import { create } from "zustand";
|
||||
|
||||
interface MapStore {
|
||||
export interface MapStore {
|
||||
contextMenu: {
|
||||
lat: number;
|
||||
lng: number;
|
||||
@@ -10,6 +10,7 @@ interface MapStore {
|
||||
center: L.LatLngExpression;
|
||||
zoom: number;
|
||||
};
|
||||
setMap: (map: MapStore["map"]) => void;
|
||||
openMissionMarker: {
|
||||
id: number;
|
||||
tab: "home" | "details" | "patient" | "log";
|
||||
@@ -67,19 +68,24 @@ export const useMapStore = create<MapStore>((set, get) => ({
|
||||
center: [51.5, 10.5],
|
||||
zoom: 6,
|
||||
},
|
||||
setMap: (map) => {
|
||||
set(() => ({
|
||||
map,
|
||||
}));
|
||||
},
|
||||
searchPopup: null,
|
||||
searchElements: [],
|
||||
setSearchPopup: (popup) =>
|
||||
set((state) => ({
|
||||
set(() => ({
|
||||
searchPopup: popup,
|
||||
})),
|
||||
contextMenu: null,
|
||||
setContextMenu: (contextMenu) =>
|
||||
set((state) => ({
|
||||
set(() => ({
|
||||
contextMenu,
|
||||
})),
|
||||
setSearchElements: (elements) =>
|
||||
set((state) => ({
|
||||
set(() => ({
|
||||
searchElements: elements,
|
||||
})),
|
||||
aircraftTabs: {},
|
||||
|
||||
@@ -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