diff --git a/apps/dispatch-server/socket-events/connect-dispatch.ts b/apps/dispatch-server/socket-events/connect-dispatch.ts index d4cce20e..4a4248df 100644 --- a/apps/dispatch-server/socket-events/connect-dispatch.ts +++ b/apps/dispatch-server/socket-events/connect-dispatch.ts @@ -74,31 +74,6 @@ export const handleConnectDispatch = io.to("dispatchers").emit("dispatchers-update", connectedDispatcherEntry); io.to("pilots").emit("dispatchers-update", connectedDispatcherEntry); - socket.on("stop-other-transmition", async ({ ownRole, otherRole }) => { - const aircrafts = await prisma.connectedAircraft.findMany({ - where: { - Station: { - bosCallsignShort: otherRole, - }, - logoutTime: null, - }, - include: { - Station: true, - }, - }); - const dispatchers = await prisma.connectedDispatcher.findMany({ - where: { - zone: otherRole, - logoutTime: null, - }, - }); - [...aircrafts, ...dispatchers].forEach((entry) => { - io.to(`user:${entry.userId}`).emit("force-end-transmission", { - by: ownRole, - }); - }); - }); - socket.on("disconnect", async () => { await prisma.connectedDispatcher.update({ where: { diff --git a/apps/dispatch/app/_components/Audio/Audio.tsx b/apps/dispatch/app/_components/Audio/Audio.tsx index df531c20..9181b11c 100644 --- a/apps/dispatch/app/_components/Audio/Audio.tsx +++ b/apps/dispatch/app/_components/Audio/Audio.tsx @@ -45,10 +45,9 @@ export const Audio = () => { }); const { selectedStation, status: pilotState } = usePilotConnectionStore((state) => state); - const { selectedZone, status: dispatcherState } = useDispatchConnectionStore((state) => state); const session = useSession(); - + const [isReceivingBlick, setIsReceivingBlick] = useState(false); const [recentSpeakers, setRecentSpeakers] = useState([]); useEffect(() => { @@ -63,6 +62,20 @@ export const Audio = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [speakingParticipants]); + useEffect(() => { + if (speakingParticipants.length > 0) { + setIsReceivingBlick(true); + + const timeout = setInterval(() => { + setIsReceivingBlick((s) => !s); + }, 1000); + return () => { + clearTimeout(timeout); + setIsReceivingBlick(false); + }; + } + }, [setIsReceivingBlick, speakingParticipants]); + useEffect(() => { if (message && state !== "error") { const timeout = setTimeout(() => { @@ -93,39 +106,37 @@ export const Audio = () => { className={cn("btn btn-sm btn-ghost border-warning bg-transparent ")} onClick={() => { removeMessage(); - // Probably via socket event to set ppt = false for participant - if (!canStopOtherSpeakers) return; - speakingParticipants.forEach((p) => { - dispatchSocket.emit("stop-other-transmition", { - ownRole: role, - otherRole: p.attributes.role, - }); - }); }} > {message} )} - {(displayedSpeakers.length || message) && ( + {displayedSpeakers.length > 0 && (
0 && "tooltip", )} data-tip="Funkspruch unterbrechen" >