(fix): remove unused dependencies
Some checks failed
/ build-desktop (linux) (push) Failing after 52s
/ build-web (push) Failing after 1m3s
/ build-mobile (push) Failing after 1m6s
/ release (push) Has been skipped

(fix): remove dead code
(fix): remove unused exports
This commit is contained in:
Alois 2026-06-03 14:53:18 +02:00
commit be56080ba1
29 changed files with 168 additions and 338 deletions

View file

@ -0,0 +1,55 @@
import { create } from "zustand";
type SpeakingState = {
speakingParticipantIds: Set<number>;
micGated: boolean;
};
const useSpeakingState = create<SpeakingState>(() => ({
speakingParticipantIds: new Set(),
micGated: false,
}));
export function setMicGated(micGated: boolean) {
useSpeakingState.setState({ micGated });
}
export function clearSpeakingParticipants() {
useSpeakingState.setState({ speakingParticipantIds: new Set() });
}
export function removeSpeakingParticipant(participantId: number) {
useSpeakingState.setState((state) => {
if (!state.speakingParticipantIds.has(participantId)) return state;
const next = new Set(state.speakingParticipantIds);
next.delete(participantId);
return { speakingParticipantIds: next };
});
}
export function updateSpeakingParticipants(changed: Map<number, boolean>) {
useSpeakingState.setState((state) => {
let hasDiff = false;
const next = new Set(state.speakingParticipantIds);
for (const [id, speaking] of changed) {
if (speaking) {
if (!next.has(id)) {
next.add(id);
hasDiff = true;
}
} else if (next.has(id)) {
next.delete(id);
hasDiff = true;
}
}
return hasDiff ? { speakingParticipantIds: next } : state;
});
}
export function useIsSpeaking(participantId: number): boolean {
return useSpeakingState((state) =>
state.speakingParticipantIds.has(participantId),
);
}