Open source video conferencing app powered by LiveKit. Built with Django and React.
π(frontend) hoist mute confirmation dialog to VideoConference level
lebaudantoine9e0d57a8c661
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 59cc7172..36f336ea 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -29,6 +29,7 @@ and this project adheres to- π(frontend) treat client-initiated connect aborts as events- π(frontend) use state instead of a ref for MoreControls container- π(frontend) stop init_virtual_background from firing on blur updates+- π(frontend) hoist mute confirmation dialog to VideoConference level## [1.27.0] - 2026-08-14diff --git a/src/frontend/src/features/participantTile/components/participantTileFocus/MuteButton.tsx b/src/frontend/src/features/participantTile/components/participantTileFocus/MuteButton.tsxindex 97a7ab12..2c2d1e06 100644--- a/src/frontend/src/features/participantTile/components/participantTileFocus/MuteButton.tsx+++ b/src/frontend/src/features/participantTile/components/participantTileFocus/MuteButton.tsx@@ -1,11 +1,9 @@import { Participant, Track } from 'livekit-client'import { useTranslation } from 'react-i18next'import { useTrackMutedIndicator } from '@livekit/components-react'-import { useMuteParticipant } from '@/features/rooms/api/muteParticipant'-import { useState } from 'react'import { Button } from '@/primitives'import { RiMicLine, RiMicOffLine } from '@remixicon/react'-import { MuteAlertDialog } from '@/features/rooms/livekit/components/MuteAlertDialog'+import { openMuteDialog } from '@/stores/muteDialog'export const MuteButton = ({ participant }: { participant: Participant }) => {const { t } = useTranslation('rooms', { keyPrefix: 'participantTileFocus' })@@ -15,31 +13,18 @@ export const MuteButton = ({ participant }: { participant: Participant }) => {source: Track.Source.Microphone,})- const { muteParticipant } = useMuteParticipant()- const [isAlertOpen, setIsAlertOpen] = useState(false)-const name = participant.name || participant.identityreturn (- <>- <Button- isDisabled={isMuted}- size={'sm'}- variant={'primaryTextDark'}- square- onPress={() => setIsAlertOpen(true)}- tooltip={t('muteParticipant', { name })}- >- {!isMuted ? <RiMicLine /> : <RiMicOffLine />}- </Button>- <MuteAlertDialog- isOpen={isAlertOpen}- onSubmit={() =>- muteParticipant(participant).then(() => setIsAlertOpen(false))- }- onClose={() => setIsAlertOpen(false)}- name={name}- />- </>+ <Button+ isDisabled={isMuted}+ size={'sm'}+ variant={'primaryTextDark'}+ square+ onPress={() => openMuteDialog(participant)}+ tooltip={t('muteParticipant', { name })}+ >+ {!isMuted ? <RiMicLine /> : <RiMicOffLine />}+ </Button>)}diff --git a/src/frontend/src/features/participants/components/ParticipantRow.tsx b/src/frontend/src/features/participants/components/ParticipantRow.tsxindex 3e7efc11..93029c3f 100644--- a/src/frontend/src/features/participants/components/ParticipantRow.tsx+++ b/src/frontend/src/features/participants/components/ParticipantRow.tsx@@ -19,13 +19,11 @@ import {import Source = Track.Sourceimport { RiMicFill, RiMicOffFill } from '@remixicon/react'import { Button } from '@/primitives'-import { useState } from 'react'-import { useMuteParticipant } from '@/features/rooms/api/muteParticipant'import { useCanMute } from '@/features/rooms/livekit/hooks/useCanMute'import { ParticipantMenuButton } from './menu/ParticipantMenuButton'import { PinBadge } from './PinBadge'import { UnauthenticatedBadge } from './UnauthenticatedBadge'-import { MuteAlertDialog } from '@/features/rooms/livekit/components/MuteAlertDialog'+import { openMuteDialog } from '@/stores/muteDialog'import { ParticipantName } from './ParticipantName'type MicIndicatorProps = {@@ -34,7 +32,6 @@ type MicIndicatorProps = {const MicIndicator = ({ participant }: MicIndicatorProps) => {const { t } = useTranslation('rooms')- const { muteParticipant } = useMuteParticipant()const { isMuted } = useTrackMutedIndicator({participant: participant,source: Source.Microphone,@@ -42,7 +39,6 @@ const MicIndicator = ({ participant }: MicIndicatorProps) => {const canMute = useCanMute(participant)const isSpeaking = useIsSpeaking(participant)- const [isAlertOpen, setIsAlertOpen] = useState(false)const name = participant.name || participant.identityconst label = isLocal(participant)@@ -52,46 +48,34 @@ const MicIndicator = ({ participant }: MicIndicatorProps) => {})return (- <>- <Button- square- variant="greyscale"- size="sm"- tooltip={label}- aria-label={label}- isDisabled={isMuted || !canMute}- onPress={async () =>- !isMuted && isLocal(participant)- ? await (participant as LocalParticipant)?.setMicrophoneEnabled(- false- )- : setIsAlertOpen(true)- }- data-attr="participants-mute"- >- {isMuted ? (- <RiMicOffFill color={'gray'} aria-hidden={true} />- ) : (- <RiMicFill- className={css({- color: isSpeaking ? 'primaryDark.300' : 'primaryDark.50',- animation: isSpeaking- ? 'pulse_background 800ms infinite'- : undefined,- })}- aria-hidden={true}- />- )}- </Button>- <MuteAlertDialog- isOpen={isAlertOpen}- onSubmit={() =>- muteParticipant(participant).then(() => setIsAlertOpen(false))- }- onClose={() => setIsAlertOpen(false)}- name={name}- />- </>+ <Button+ square+ variant="greyscale"+ size="sm"+ tooltip={label}+ aria-label={label}+ isDisabled={isMuted || !canMute}+ onPress={async () =>+ !isMuted && isLocal(participant)+ ? await (participant as LocalParticipant)?.setMicrophoneEnabled(false)+ : openMuteDialog(participant)+ }+ data-attr="participants-mute"+ >+ {isMuted ? (+ <RiMicOffFill color={'gray'} aria-hidden={true} />+ ) : (+ <RiMicFill+ className={css({+ color: isSpeaking ? 'primaryDark.300' : 'primaryDark.50',+ animation: isSpeaking+ ? 'pulse_background 800ms infinite'+ : undefined,+ })}+ aria-hidden={true}+ />+ )}+ </Button>)}diff --git a/src/frontend/src/features/rooms/livekit/components/MuteAlertDialogProvider.tsx b/src/frontend/src/features/rooms/livekit/components/MuteAlertDialogProvider.tsxnew file mode 100644index 00000000..b03eb688--- /dev/null+++ b/src/frontend/src/features/rooms/livekit/components/MuteAlertDialogProvider.tsx@@ -0,0 +1,28 @@+import { useRef } from 'react'+import { useSnapshot } from 'valtio'+import { useMuteParticipant } from '@/features/rooms/api/muteParticipant'+import { closeMuteDialog, muteDialogStore } from '@/stores/muteDialog'+import { MuteAlertDialog } from './MuteAlertDialog'++export const MuteAlertDialogProvider = () => {+ const { participant } = useSnapshot(muteDialogStore)+ const { muteParticipant } = useMuteParticipant()++ const lastNameRef = useRef('')+ if (participant) {+ lastNameRef.current = participant.name || participant.identity+ }++ return (+ <MuteAlertDialog+ isOpen={!!participant}+ name={lastNameRef.current}+ onClose={closeMuteDialog}+ onSubmit={() => {+ const target = muteDialogStore.participant+ if (!target) return+ muteParticipant(target).then(closeMuteDialog)+ }}+ />+ )+}diff --git a/src/frontend/src/features/rooms/livekit/prefabs/VideoConference.tsx b/src/frontend/src/features/rooms/livekit/prefabs/VideoConference.tsxindex f470aae7..16084e99 100644--- a/src/frontend/src/features/rooms/livekit/prefabs/VideoConference.tsx+++ b/src/frontend/src/features/rooms/livekit/prefabs/VideoConference.tsx@@ -19,6 +19,7 @@ import { RoomMetadataSynchronizer } from '../components/RoomMetadataSynchronizerimport { useNoiseReduction } from '../hooks/useNoiseReduction'import { VideoResolutionSubscription } from '../components/VideoResolutionSubscription'import { SettingsDialogProvider } from '@/features/settings/components/SettingsDialogProvider'+import { MuteAlertDialogProvider } from '@/features/rooms/livekit/components/MuteAlertDialogProvider'import { IsIdleDisconnectModal } from '../components/IsIdleDisconnectModal'import { ReactionPortals } from '@/features/reactions/components/ReactionPortals'import { RoomContentArea } from '@/features/layout/components/RoomContentArea'@@ -144,6 +145,7 @@ export function VideoConference({ ...props }: VideoConferenceProps) {<ConnectionStateToast /><RecordingProvider /><SettingsDialogProvider />+ <MuteAlertDialogProvider /><ReactionPortals /></div></>diff --git a/src/frontend/src/stores/muteDialog.ts b/src/frontend/src/stores/muteDialog.tsnew file mode 100644index 00000000..d4aa4c69--- /dev/null+++ b/src/frontend/src/stores/muteDialog.ts@@ -0,0 +1,18 @@+import { proxy, ref } from 'valtio'+import type { Participant } from 'livekit-client'++type State = {+ participant: Participant | null+}++export const muteDialogStore = proxy<State>({+ participant: null,+})++export const openMuteDialog = (participant: Participant) => {+ muteDialogStore.participant = ref(participant)+}++export const closeMuteDialog = () => {+ muteDialogStore.participant = null+}