diff --git a/fluxer_app/src/features/voice/components/VoiceLiveKitRoot.tsx b/fluxer_app/src/features/voice/components/VoiceLiveKitRoot.tsx index 7a866d31d..4002569f3 100644 --- a/fluxer_app/src/features/voice/components/VoiceLiveKitRoot.tsx +++ b/fluxer_app/src/features/voice/components/VoiceLiveKitRoot.tsx @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later +import {VoiceRoomContext} from '@app/features/voice/components/VoiceRoomContext'; import {type RoomAudioRendererProps, RoomContext} from '@livekit/components-react'; import type {Room} from 'livekit-client'; import type React from 'react'; @@ -43,13 +44,15 @@ export function VoiceLiveKitRoot({room, children}: VoiceLiveKitRootProps): React }, [components, room]); if (!room) { - return <>{children}; + return {children}; } return ( - - {children} - {components && } - + + + {children} + {components && } + + ); } diff --git a/fluxer_app/src/features/voice/components/VoiceRoomContext.ts b/fluxer_app/src/features/voice/components/VoiceRoomContext.ts new file mode 100644 index 000000000..ebe42f8c7 --- /dev/null +++ b/fluxer_app/src/features/voice/components/VoiceRoomContext.ts @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +import type {Room} from 'livekit-client'; +import {createContext, useContext} from 'react'; + +export const VoiceRoomContext = createContext(undefined); + +export function useMaybeVoiceRoom(): Room | undefined { + return useContext(VoiceRoomContext); +}