Completed Admin Users form

This commit is contained in:
PxlLoewe
2025-06-04 17:27:58 -07:00
parent 7aceae7c17
commit 3c620b9b67
22 changed files with 592 additions and 235 deletions

View File

@@ -8,6 +8,8 @@ import { dispatchSocket } from "dispatch/socket";
import { Mission, NotificationPayload } from "@repo/db";
import { HPGnotificationToast } from "_components/customToasts/HPGnotification";
import { useMapStore } from "_store/mapStore";
import { AdminMessageToast } from "_components/customToasts/AdminMessage";
import { pilotSocket } from "pilot/socket";
export function QueryProvider({ children }: { children: ReactNode }) {
const mapStore = useMapStore((s) => s);
@@ -39,6 +41,9 @@ export function QueryProvider({ children }: { children: ReactNode }) {
queryClient.invalidateQueries({
queryKey: ["aircrafts"],
});
queryClient.invalidateQueries({
queryKey: ["dispatchers"],
});
};
const invalidateConenctedAircrafts = () => {
@@ -58,13 +63,18 @@ export function QueryProvider({ children }: { children: ReactNode }) {
toast.custom(
(t) => <HPGnotificationToast event={notification} mapStore={mapStore} t={t} />,
{
duration: 9999,
duration: 99999,
},
);
break;
case "admin-message":
toast.custom((t) => <AdminMessageToast event={notification} t={t} />, {
duration: 999999,
});
break;
default:
toast(notification.message);
toast("unbekanntes Notification-Event");
break;
}
};
@@ -76,6 +86,7 @@ export function QueryProvider({ children }: { children: ReactNode }) {
dispatchSocket.on("pilots-update", invalidateConnectedUsers);
dispatchSocket.on("update-connectedAircraft", invalidateConenctedAircrafts);
dispatchSocket.on("notification", handleNotification);
pilotSocket.on("notification", handleNotification);
return () => {
dispatchSocket.off("update-mission", invalidateMission);