🎨(frontend) clarify video toggle naming and improve typing

Enhance toggle naming in video controls to explicitly indicate special
processor handling functionality and improve toggleProps TypeScript
typing.

Makes code more self-documenting by clearly identifying processor-aware
toggle behavior while strengthening type safety
This commit is contained in:
lebaudantoine
2025-08-22 11:30:02 +02:00
committed by aleb_the_flash
parent c2586a392c
commit aa8362c470
2 changed files with 4 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ export type ToggleDeviceProps<T extends ToggleSource> = {
toggle: ( toggle: (
forceState?: boolean, forceState?: boolean,
captureOptions?: CaptureOptionsBySource<T> captureOptions?: CaptureOptionsBySource<T>
) => Promise<void | boolean | undefined> | void ) => Promise<void | boolean | undefined>
context?: 'room' | 'join' context?: 'room' | 'join'
kind: 'audioinput' | 'videoinput' kind: 'audioinput' | 'videoinput'
toggleButtonProps?: Partial<ToggleButtonProps> toggleButtonProps?: Partial<ToggleButtonProps>

View File

@@ -67,7 +67,7 @@ export const VideoDeviceControl = ({
const kind = 'videoinput' const kind = 'videoinput'
const cannotUseDevice = useCannotUseDevice(kind) const cannotUseDevice = useCannotUseDevice(kind)
const toggle = () => { const toggleWithProcessor = async () => {
/** /**
* We need to make sure that we apply the in-memory processor when re-enabling the camera. * We need to make sure that we apply the in-memory processor when re-enabling the camera.
* Before, we had the following bug: * Before, we had the following bug:
@@ -89,7 +89,7 @@ export const VideoDeviceControl = ({
captureOptions: VideoCaptureOptions captureOptions: VideoCaptureOptions
) => Promise<void> ) => Promise<void>
toggle(!trackProps.enabled, { await toggle(!trackProps.enabled, {
processor: processor, processor: processor,
} as VideoCaptureOptions) } as VideoCaptureOptions)
} }
@@ -106,7 +106,7 @@ export const VideoDeviceControl = ({
<ToggleDevice <ToggleDevice
{...trackProps} {...trackProps}
kind={kind} kind={kind}
toggle={toggle} toggle={toggleWithProcessor}
toggleButtonProps={{ toggleButtonProps={{
...(hideMenu ...(hideMenu
? { ? {