diff --git a/react/features/virtual-background/components/VirtualBackgrounds.tsx b/react/features/virtual-background/components/VirtualBackgrounds.tsx index 6c852832d5..57e3ca9d28 100644 --- a/react/features/virtual-background/components/VirtualBackgrounds.tsx +++ b/react/features/virtual-background/components/VirtualBackgrounds.tsx @@ -32,11 +32,6 @@ interface IProps extends WithTranslation { */ _images: Array; - /** - * The current local flip x status. - */ - _localFlipX: boolean; - /** * Whether or not multi-stream send support is enabled. */ @@ -47,24 +42,11 @@ interface IProps extends WithTranslation { */ _showUploadButton: boolean; - /** - * Returns the selected virtual background object. - */ - _virtualBackground: any; - /** * The redux {@code dispatch} function. */ dispatch: IStore['dispatch']; - /** - * The initial options copied in the state for the {@code VirtualBackground} component. - * - * NOTE: currently used only for electron in order to open the dialog in the correct state after desktop sharing - * selection. - */ - initialOptions?: Object; - /** * Options change handler. */ @@ -205,13 +187,9 @@ const useStyles = makeStyles()(theme => { */ function VirtualBackgrounds({ _images, - _localFlipX, - selectedThumbnail, _showUploadButton, - _virtualBackground, onOptionsChange, options, - initialOptions, selectedVideoInputId, t }: IProps) { @@ -221,10 +199,6 @@ function VirtualBackgrounds({ const [ storedImages, setStoredImages ] = useState>((localImages && safeJsonParse(localImages)) || []); const [ loading, setLoading ] = useState(false); - useEffect(() => { - onOptionsChange({ ...initialOptions }); - }, []); - const deleteStoredImage = useCallback(e => { const imageId = e.currentTarget.getAttribute('data-imageid'); @@ -377,7 +351,11 @@ function VirtualBackgrounds({ return acc; }, {}) }; - const currentBackgroundLabel = labelsMap[selectedThumbnail] || labelsMap.none; + const currentBackgroundLabel = options?.selectedThumbnail ? labelsMap[options.selectedThumbnail] : labelsMap.none; + const isThumbnailSelected = useCallback(thumbnail => options?.selectedThumbnail === thumbnail, [ options ]); + const getSelectedThumbnailClass = useCallback( + thumbnail => isThumbnailSelected(thumbnail) && classes.selectedThumbnail, [ isThumbnailSelected, options ] + ); return ( <> @@ -415,10 +393,10 @@ function VirtualBackgrounds({ content = { t('virtualBackground.removeBackground') } position = { 'top' }>
{