fix call preferences not persisting

This commit is contained in:
7w1 committed 2026-03-13 14:16:09 -05:00
1 parent 6cd5704e18
commit 1b97bb8780
2 files changed
+16 -7

No files matched your search

+14 -7
View File
@@ -1,4 +1,4 @@
import { MouseEventHandler, useCallback, useRef, useState } from 'react';
import { MouseEventHandler, useCallback, useEffect, useRef, useState } from 'react';
import {
Box,
Button,
@@ -15,7 +15,13 @@ import {
toRem,
} from 'folds';
import FocusTrap from 'focus-trap-react';
import { SequenceCard } from '../../components/sequence-card';
import { SequenceCard } from '$components/sequence-card';
import { CallEmbed, useCallControlState } from '$plugins/call';
import { stopPropagation } from '$utils/keyboard';
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
import { useRoom } from '$hooks/useRoom';
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
import { useCallPreferences } from '$state/hooks/callPreferences';
import * as css from './styles.css';
import {
ChatButton,
@@ -25,11 +31,6 @@ import {
SoundButton,
VideoButton,
} from './Controls';
import { CallEmbed, useCallControlState } from '../../plugins/call';
import { stopPropagation } from '../../utils/keyboard';
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
import { useRoom } from '../../hooks/useRoom';
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
type CallControlsProps = {
callEmbed: CallEmbed;
@@ -45,6 +46,12 @@ export function CallControls({ callEmbed }: CallControlsProps) {
callEmbed.control
);
const { setPreferences } = useCallPreferences();
useEffect(() => {
setPreferences({ microphone, video, sound });
}, [microphone, video, sound, setPreferences]);
const [cords, setCords] = useState<RectCords>();
const handleOpenMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
+2
View File
@@ -18,6 +18,7 @@ export const useCallPreferences = (): CallPreferences & {
toggleMicrophone: () => void;
toggleVideo: () => void;
toggleSound: () => void;
setPreferences: (prefs: CallPreferences) => void;
} => {
const callPrefAtom = useCallPreferencesAtom();
const [pref, setPref] = useAtom(callPrefAtom);
@@ -57,5 +58,6 @@ export const useCallPreferences = (): CallPreferences & {
toggleMicrophone,
toggleVideo,
toggleSound,
setPreferences: setPref,
};
};