Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref: Convert some class components to function components (#13103)
Robert Pintilii89c914272c02
diff --git a/react/features/chat/components/AbstractMessageRecipient.ts b/react/features/chat/components/AbstractMessageRecipient.tsindex b7e27a6272..51581fdfe9 100644--- a/react/features/chat/components/AbstractMessageRecipient.ts+++ b/react/features/chat/components/AbstractMessageRecipient.ts@@ -37,8 +37,6 @@ export interface IProps extends WithTranslation {* Shows widget if it is necessary.*/_visible: boolean;-- classes?: any;}/**diff --git a/react/features/chat/components/web/MessageRecipient.tsx b/react/features/chat/components/web/MessageRecipient.tsxindex 3433868d40..094af88950 100644--- a/react/features/chat/components/web/MessageRecipient.tsx+++ b/react/features/chat/components/web/MessageRecipient.tsx@@ -1,20 +1,19 @@-import { Theme } from '@mui/material';-import { withStyles } from '@mui/styles';-import React from 'react';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';-import { translate } from '../../../base/i18n/functions';import { IconCloseLarge } from '../../../base/icons/svg';import { withPixelLineHeight } from '../../../base/styles/functions.web';import Button from '../../../base/ui/components/web/Button';import { BUTTON_TYPES } from '../../../base/ui/constants.any';-import AbstractMessageRecipient, {+import {IProps,_mapDispatchToProps,_mapStateToProps} from '../AbstractMessageRecipient';-const styles = (theme: Theme) => {+const useStyles = makeStyles()(theme => {return {container: {margin: '0 16px 8px',@@ -37,83 +36,57 @@ const styles = (theme: Theme) => {}}};-};--/**- * Class to implement the displaying of the recipient of the next message.- */-class MessageRecipient extends AbstractMessageRecipient<IProps> {- /**- * Initializes a new {@code MessageRecipient} instance.- *- * @param {IProps} props - The read-only properties with which the new instance- * is to be initialized.- */- constructor(props: IProps) {- super(props);+});- // Bind event handler so it is only bound once for every instance.- this._onKeyPress = this._onKeyPress.bind(this);- }+const MessageRecipient = ({+ _privateMessageRecipient,+ _isLobbyChatActive,+ _lobbyMessageRecipient,+ _onRemovePrivateMessageRecipient,+ _onHideLobbyChatRecipient,+ _visible+}: IProps) => {+ const { classes } = useStyles();+ const { t } = useTranslation();- /**- * KeyPress handler for accessibility.- *- * @param {Object} e - The key event to handle.- *- * @returns {void}- */- _onKeyPress(e: React.KeyboardEvent) {+ const _onKeyPress = useCallback((e: React.KeyboardEvent) => {if (- (this.props._onRemovePrivateMessageRecipient || this.props._onHideLobbyChatRecipient)- && (e.key === ' ' || e.key === 'Enter')+ (_onRemovePrivateMessageRecipient || _onHideLobbyChatRecipient)+ && (e.key === ' ' || e.key === 'Enter')) {e.preventDefault();- if (this.props._isLobbyChatActive && this.props._onHideLobbyChatRecipient) {- this.props._onHideLobbyChatRecipient();- } else if (this.props._onRemovePrivateMessageRecipient) {- this.props._onRemovePrivateMessageRecipient();+ if (_isLobbyChatActive && _onHideLobbyChatRecipient) {+ _onHideLobbyChatRecipient();+ } else if (_onRemovePrivateMessageRecipient) {+ _onRemovePrivateMessageRecipient();}}- }-- /**- * Implements {@code PureComponent#render}.- *- * @inheritdoc- */- render() {- const { _privateMessageRecipient, _isLobbyChatActive,- _lobbyMessageRecipient, _visible } = this.props;-- if ((!_privateMessageRecipient && !_isLobbyChatActive) || !_visible) {- return null;- }-- const { classes, t } = this.props;+ }, [ _onRemovePrivateMessageRecipient, _onHideLobbyChatRecipient, _isLobbyChatActive ]);- return (- <div- className = { classes.container }- id = 'chat-recipient'- role = 'alert'>- <span>- { t(_isLobbyChatActive ? 'chat.lobbyChatMessageTo' : 'chat.messageTo', {- recipient: _isLobbyChatActive ? _lobbyMessageRecipient : _privateMessageRecipient- }) }- </span>- <Button- accessibilityLabel = { t('dialog.close') }- className = { classes.iconButton }- icon = { IconCloseLarge }- onClick = { _isLobbyChatActive- ? this.props._onHideLobbyChatRecipient : this.props._onRemovePrivateMessageRecipient }- onKeyPress = { this._onKeyPress }- type = { BUTTON_TYPES.TERTIARY } />- </div>- );+ if ((!_privateMessageRecipient && !_isLobbyChatActive) || !_visible) {+ return null;}-}-export default translate(connect(_mapStateToProps, _mapDispatchToProps)(- withStyles(styles)(MessageRecipient)));+ return (+ <div+ className = { classes.container }+ id = 'chat-recipient'+ role = 'alert'>+ <span>+ {t(_isLobbyChatActive ? 'chat.lobbyChatMessageTo' : 'chat.messageTo', {+ recipient: _isLobbyChatActive ? _lobbyMessageRecipient : _privateMessageRecipient+ })}+ </span>+ <Button+ accessibilityLabel = { t('dialog.close') }+ className = { classes.iconButton }+ icon = { IconCloseLarge }+ onClick = { _isLobbyChatActive+ ? _onHideLobbyChatRecipient : _onRemovePrivateMessageRecipient }+ onKeyPress = { _onKeyPress }+ type = { BUTTON_TYPES.TERTIARY } />+ </div>+ );+};++export default connect(_mapStateToProps, _mapDispatchToProps)(MessageRecipient);diff --git a/react/features/device-selection/components/DeviceSelector.web.tsx b/react/features/device-selection/components/DeviceSelector.web.tsxindex b0f5fa9e4e..ea6e249528 100644--- a/react/features/device-selection/components/DeviceSelector.web.tsx+++ b/react/features/device-selection/components/DeviceSelector.web.tsx@@ -1,21 +1,14 @@-import { Theme } from '@mui/material';-import { withStyles } from '@mui/styles';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';+import { makeStyles } from 'tss-react/mui';-import { translate } from '../../base/i18n/functions';import { withPixelLineHeight } from '../../base/styles/functions.web';import Select from '../../base/ui/components/web/Select';/*** The type of the React {@code Component} props of {@link DeviceSelector}.*/-interface IProps extends WithTranslation {-- /**- * CSS classes object.- */- classes: any;+interface IProps {/*** MediaDeviceInfos used for display in the select element.@@ -58,7 +51,7 @@ interface IProps extends WithTranslation {selectedDeviceId: string;}-const styles = (theme: Theme) => {+const useStyles = makeStyles()(theme => {return {textSelector: {width: '100%',@@ -71,87 +64,34 @@ const styles = (theme: Theme) => {border: `1px solid ${theme.palette.ui03}`}};-};--/**- * React component for selecting a device from a select element. Wraps- * AKDropdownMenu with device selection specific logic.- *- * @augments Component- */-class DeviceSelector extends Component<IProps> {- /**- * Initializes a new DeviceSelector instance.- *- * @param {Object} props - The read-only React Component props with which- * the new instance is to be initialized.- */- constructor(props: IProps) {- super(props);-- this._onSelect = this._onSelect.bind(this);- this._createDropdown = this._createDropdown.bind(this);- }-- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- if (this.props.hasPermission === undefined) {- return null;- }-- if (!this.props.hasPermission) {- return this._renderNoPermission();- }+});++const DeviceSelector = ({+ devices,+ hasPermission,+ isDisabled,+ label,+ onSelect,+ selectedDeviceId+}: IProps) => {+ const { classes } = useStyles();+ const { t } = useTranslation();++ const _onSelect = useCallback((e: React.ChangeEvent<HTMLSelectElement>) => {+ const deviceId = e.target.value;- if (!this.props.devices || !this.props.devices.length) {- return this._renderNoDevices();+ if (selectedDeviceId !== deviceId) {+ onSelect(deviceId);}+ }, [ selectedDeviceId, onSelect ]);- const items = this.props.devices.map(device => {- return {- value: device.deviceId,- label: device.label || device.deviceId- };- });- const defaultSelected = this.props.devices.find(item =>- item.deviceId === this.props.selectedDeviceId- );-- return this._createDropdown({- defaultSelected,- isDisabled: this.props.isDisabled,- items,- placeholder: this.props.t('deviceSelection.selectADevice')- });- }-- /**- * Creates a AKDropdownMenu Component using passed in props and options. If- * the dropdown needs to be disabled, then only the AKDropdownMenu trigger- * element is returned to simulate a disabled state.- *- * @param {Object} options - Additional configuration for display.- * @param {Object} options.defaultSelected - The option that should be set- * as currently chosen.- * @param {boolean} options.isDisabled - If true, only the AKDropdownMenu- * trigger component will be returned to simulate a disabled dropdown.- * @param {Array} options.items - All the selectable options to display.- * @param {string} options.placeholder - The translation key to display when- * no selection has been made.- * @private- * @returns {ReactElement}- */- _createDropdown(options: { defaultSelected?: MediaDeviceInfo; isDisabled: boolean;- items?: Array<{ label: string; value: string; }>; placeholder: string; }) {+ const _createDropdown = (options: {+ defaultSelected?: MediaDeviceInfo; isDisabled: boolean;+ items?: Array<{ label: string; value: string; }>; placeholder: string;+ }) => {const triggerText= (options.defaultSelected && (options.defaultSelected.label || options.defaultSelected.deviceId))- || options.placeholder;- const { classes } = this.props;+ || options.placeholder;if (options.isDisabled || !options.items?.length) {return (@@ -163,56 +103,51 @@ class DeviceSelector extends Component<IProps> {return (<Select- label = { this.props.t(this.props.label) }- onChange = { this._onSelect }+ label = { t(label) }+ onChange = { _onSelect }options = { options.items }- value = { this.props.selectedDeviceId } />+ value = { selectedDeviceId } />);- }+ };- /**- * Invokes the passed in callback to notify of selection changes.- *- * @param {Object} e - The key event to handle.- *- * @private- * @returns {void}- */- _onSelect(e: React.ChangeEvent<HTMLSelectElement>) {- const deviceId = e.target.value;+ const _renderNoDevices = () => _createDropdown({+ isDisabled: true,+ placeholder: t('settings.noDevice')+ });- if (this.props.selectedDeviceId !== deviceId) {- this.props.onSelect(deviceId);- }+ const _renderNoPermission = () => _createDropdown({+ isDisabled: true,+ placeholder: t('deviceSelection.noPermission')+ });++ if (hasPermission === undefined) {+ return null;}- /**- * Creates a Select Component that is disabled and has a placeholder- * indicating there are no devices to select.- *- * @private- * @returns {ReactElement}- */- _renderNoDevices() {- return this._createDropdown({- isDisabled: true,- placeholder: this.props.t('settings.noDevice')- });+ if (!hasPermission) {+ return _renderNoPermission();}- /**- * Creates a AKDropdownMenu Component that is disabled and has a placeholder- * stating there is no permission to display the devices.- *- * @private- * @returns {ReactElement}- */- _renderNoPermission() {- return this._createDropdown({- isDisabled: true,- placeholder: this.props.t('deviceSelection.noPermission')- });+ if (!devices || !devices.length) {+ return _renderNoDevices();}-}-export default withStyles(styles)(translate(DeviceSelector));+ const items = devices.map(device => {+ return {+ value: device.deviceId,+ label: device.label || device.deviceId+ };+ });+ const defaultSelected = devices.find(item =>+ item.deviceId === selectedDeviceId+ );++ return _createDropdown({+ defaultSelected,+ isDisabled,+ items,+ placeholder: t('deviceSelection.selectADevice')+ });+};++export default DeviceSelector;diff --git a/react/features/e2ee/components/ParticipantVerificationDialog.tsx b/react/features/e2ee/components/ParticipantVerificationDialog.tsxindex 8a6bd69465..b64dfb9954 100644--- a/react/features/e2ee/components/ParticipantVerificationDialog.tsx+++ b/react/features/e2ee/components/ParticipantVerificationDialog.tsx@@ -1,17 +1,15 @@-import { withStyles } from '@mui/styles';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';import { IReduxState, IStore } from '../../app/types';-import { translate } from '../../base/i18n/functions';import { getParticipantById } from '../../base/participants/functions';import Dialog from '../../base/ui/components/web/Dialog';import { participantVerified } from '../actions';import { ISas } from '../reducer';-interface IProps extends WithTranslation {- classes: any;+interface IProps {decimal: string;dispatch: IStore['dispatch'];emoji: string;@@ -20,18 +18,11 @@ interface IProps extends WithTranslation {sas: ISas;}-/**- * Creates the styles for the component.- *- * @param {Object} theme - The current UI theme.- *- * @returns {Object}- */-const styles = () => {+const useStyles = makeStyles()(() => {return {container: {display: 'flex',- flexDirection: 'column' as const,+ flexDirection: 'column',margin: '16px'},row: {@@ -39,7 +30,7 @@ const styles = () => {display: 'flex'},item: {- textAlign: 'center' as const,+ textAlign: 'center',margin: '16px'},emoji: {@@ -47,101 +38,70 @@ const styles = () => {margin: '12px'}};-};---/**- * Class for the dialog displayed for E2EE sas verification.- */-export class ParticipantVerificationDialog extends Component<IProps> {- /**- * Instantiates a new instance.- *- * @inheritdoc- */- constructor(props: IProps) {- super(props);-- this._onConfirmed = this._onConfirmed.bind(this);- this._onDismissed = this._onDismissed.bind(this);- }-- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const { emoji } = this.props.sas;- const { participantName } = this.props;-- const { classes, t } = this.props;-- return (- <Dialog- cancel = {{ translationKey: 'dialog.verifyParticipantDismiss' }}- ok = {{ translationKey: 'dialog.verifyParticipantConfirm' }}- onCancel = { this._onDismissed }- onSubmit = { this._onConfirmed }- titleKey = 'dialog.verifyParticipantTitle'>- <div>- { t('dialog.verifyParticipantQuestion', { participantName }) }- </div>+});- <div className = { classes.container }>- <div className = { classes.row }>- {/* @ts-ignore */}- {emoji.slice(0, 4).map((e: Array<string>) =>- (<div- className = { classes.item }- key = { e.toString() }>- <div className = { classes.emoji }>{ e[0] }</div>- <div>{ e[1].charAt(0).toUpperCase() + e[1].slice(1) }</div>- </div>))}- </div>-- <div className = { classes.row }>- {/* @ts-ignore */}- {emoji.slice(4, 7).map((e: Array<string>) =>- (<div- className = { classes.item }- key = { e.toString() }>- <div className = { classes.emoji }>{ e[0] } </div>- <div>{ e[1].charAt(0).toUpperCase() + e[1].slice(1) }</div>- </div>))}- </div>+const ParticipantVerificationDialog = ({+ dispatch,+ participantName,+ pId,+ sas+}: IProps) => {+ const { classes } = useStyles();+ const { t } = useTranslation();- </div>+ const _onDismissed = useCallback(() => {+ dispatch(participantVerified(pId, false));- </Dialog>- );- }+ return true;+ }, [ pId ]);- /**- * Notifies this ParticipantVerificationDialog that it has been dismissed by cancel.- *- * @private- * @returns {void}- */- _onDismissed() {- this.props.dispatch(participantVerified(this.props.pId, false));+ const _onConfirmed = useCallback(() => {+ dispatch(participantVerified(pId, true));return true;- }+ }, [ pId ]);++ const { emoji } = sas;++ return (+ <Dialog+ cancel = {{ translationKey: 'dialog.verifyParticipantDismiss' }}+ ok = {{ translationKey: 'dialog.verifyParticipantConfirm' }}+ onCancel = { _onDismissed }+ onSubmit = { _onConfirmed }+ titleKey = 'dialog.verifyParticipantTitle'>+ <div>+ {t('dialog.verifyParticipantQuestion', { participantName })}+ </div>++ <div className = { classes.container }>+ <div className = { classes.row }>+ {/* @ts-ignore */}+ {emoji.slice(0, 4).map((e: Array<string>) =>+ (<div+ className = { classes.item }+ key = { e.toString() }>+ <div className = { classes.emoji }>{e[0]}</div>+ <div>{e[1].charAt(0).toUpperCase() + e[1].slice(1)}</div>+ </div>))}+ </div>- /**- * Notifies this ParticipantVerificationDialog that it has been dismissed with confirmation.- *- * @private- * @returns {void}- */- _onConfirmed() {- this.props.dispatch(participantVerified(this.props.pId, true));+ <div className = { classes.row }>+ {/* @ts-ignore */}+ {emoji.slice(4, 7).map((e: Array<string>) =>+ (<div+ className = { classes.item }+ key = { e.toString() }>+ <div className = { classes.emoji }>{e[0]} </div>+ <div>{e[1].charAt(0).toUpperCase() + e[1].slice(1)}</div>+ </div>))}+ </div>- return true;- }-}+ </div>++ </Dialog>+ );+};/*** Maps part of the Redux store to the props of this component.@@ -160,5 +120,4 @@ export function _mapStateToProps(state: IReduxState, ownProps: IProps) {};}-export default translate(connect(_mapStateToProps)(- withStyles(styles)(ParticipantVerificationDialog)));+export default connect(_mapStateToProps)(ParticipantVerificationDialog);diff --git a/react/features/notifications/components/web/NotificationsContainer.tsx b/react/features/notifications/components/web/NotificationsContainer.tsxindex 7ce93745d3..2aa05d1756 100644--- a/react/features/notifications/components/web/NotificationsContainer.tsx+++ b/react/features/notifications/components/web/NotificationsContainer.tsx@@ -1,8 +1,6 @@-import { withStyles } from '@mui/styles';-import clsx from 'clsx';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback } from 'react';import { connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';import { hideNotification } from '../../actions';@@ -11,7 +9,7 @@ import { INotificationProps } from '../../types';import NotificationsTransition from '../NotificationsTransition';import Notification from './Notification';-interface IProps extends WithTranslation {+interface IProps {/*** Whether we are a SIP gateway or not.@@ -32,11 +30,6 @@ interface IProps extends WithTranslation {uid: string;}>;- /**- * JSS classes object.- */- classes: any;-/*** Invoked to update the redux store in order to remove notifications.*/@@ -48,10 +41,10 @@ interface IProps extends WithTranslation {portal?: boolean;}-const useStyles = () => {+const useStyles = makeStyles()(() => {return {container: {- position: 'absolute' as const,+ position: 'absolute',left: '16px',bottom: '84px',width: '320px',@@ -64,73 +57,42 @@ const useStyles = () => {maxWidth: 'calc(100% - 32px)'}};-};--/**- * Implements a React {@link Component} which displays notifications and handles- * automatic dismissal after a notification is shown for a defined timeout- * period.- *- * @augments {Component}- */-class NotificationsContainer extends Component<IProps> {-- /**- * Initializes a new {@code NotificationsContainer} instance.- *- * @inheritdoc- */- constructor(props: IProps) {- super(props);-- // Bind event handlers so they are only bound once for every instance.- this._onDismissed = this._onDismissed.bind(this);+});++const NotificationsContainer = ({+ _iAmSipGateway,+ _notifications,+ dispatch,+ portal+}: IProps) => {+ const { classes, cx } = useStyles();++ const _onDismissed = useCallback((uid: string) => {+ dispatch(hideNotification(uid));+ }, []);++ if (_iAmSipGateway) {+ return null;}- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const { _notifications } = this.props;-- if (this.props._iAmSipGateway) {- return null;- }-- return (- <div- className = { clsx(this.props.classes.container, {- [this.props.classes.containerPortal]: this.props.portal- }) }- id = 'notifications-container'>- <NotificationsTransition>- {_notifications.map(({ props, uid }) => (- <Notification- { ...props }- key = { uid }- onDismissed = { this._onDismissed }- uid = { uid } />- )) || null }- </NotificationsTransition>- </div>- );- }-- /**- * Emits an action to remove the notification from the redux store so it- * stops displaying.- *- * @param {string} uid - The id of the notification to be removed.- * @private- * @returns {void}- */- _onDismissed(uid: string) {- this.props.dispatch(hideNotification(uid));- }-}+ return (+ <div+ className = { cx(classes.container, {+ [classes.containerPortal]: portal+ }) }+ id = 'notifications-container'>+ <NotificationsTransition>+ {_notifications.map(({ props, uid }) => (+ <Notification+ { ...props }+ key = { uid }+ onDismissed = { _onDismissed }+ uid = { uid } />+ )) || null}+ </NotificationsTransition>+ </div>+ );+};/*** Maps (parts of) the Redux state to the associated props for this component.@@ -152,4 +114,4 @@ function _mapStateToProps(state: IReduxState) {};}-export default connect(_mapStateToProps)(withStyles(useStyles)(NotificationsContainer));+export default connect(_mapStateToProps)(NotificationsContainer);diff --git a/react/features/reactions/components/web/ReactionsMenu.tsx b/react/features/reactions/components/web/ReactionsMenu.tsxindex c1b2ffaef3..c4a2fed355 100644--- a/react/features/reactions/components/web/ReactionsMenu.tsx+++ b/react/features/reactions/components/web/ReactionsMenu.tsx@@ -1,15 +1,12 @@-import { Theme } from '@mui/material';-import { ClassNameMap, withStyles } from '@mui/styles';-import clsx from 'clsx';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback, useEffect } from 'react';+import { useTranslation } from 'react-i18next';import { connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';import { createReactionMenuEvent, createToolbarEvent } from '../../../analytics/AnalyticsEvents';import { sendAnalytics } from '../../../analytics/functions';import { IReduxState, IStore } from '../../../app/types';import { isMobileBrowser } from '../../../base/environment/utils';-import { translate } from '../../../base/i18n/functions';import { raiseHand } from '../../../base/participants/actions';import { getLocalParticipant, hasRaisedHand } from '../../../base/participants/functions';import GifsMenu from '../../../gifs/components/web/GifsMenu';@@ -25,7 +22,7 @@ import { REACTIONS, REACTIONS_MENU_HEIGHT } from '../../constants';// @ts-ignoreimport ReactionButton from './ReactionButton';-interface IProps extends WithTranslation {+interface IProps {/*** Docks the toolbox.@@ -57,15 +54,10 @@ interface IProps extends WithTranslation {*/_raisedHand: boolean;- /**- * An object containing the CSS classes.- */- classes: ClassNameMap<string>;-/*** The Redux Dispatch function.*/- dispatch: Function;+ dispatch: IStore['dispatch'];/*** Whether or not it's displayed in the overflow menu.@@ -73,7 +65,7 @@ interface IProps extends WithTranslation {overflowMenu?: boolean;}-const styles = (theme: Theme) => {+const useStyles = makeStyles()(theme => {return {overflow: {width: 'auto',@@ -81,85 +73,46 @@ const styles = (theme: Theme) => {backgroundColor: theme.palette.ui01,boxShadow: 'none',borderRadius: 0,- position: 'relative' as const,- boxSizing: 'border-box' as const,+ position: 'relative',+ boxSizing: 'border-box',height: `${REACTIONS_MENU_HEIGHT}px`}};-};--/**- * Implements the reactions menu.- *- * @returns {ReactElement}- */-class ReactionsMenu extends Component<IProps> {- /**- * Initializes a new {@code ReactionsMenu} instance.- *- * @param {IProps} props - The read-only React {@code Component} props with- * which the new instance is to be initialized.- */- constructor(props: IProps) {- super(props);-- this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);- this._getReactionButtons = this._getReactionButtons.bind(this);- }-- /**- * Implements React Component's componentDidMount.- *- * @inheritdoc- */- componentDidMount() {- this.props._dockToolbox(true);- }-- /**- * Implements React Component's componentWillUnmount.- *- * @inheritdoc- */- componentWillUnmount() {- this.props._dockToolbox(false);- }-- /**- * Creates an analytics toolbar event and dispatches an action for toggling- * raise hand.- *- * @returns {void}- */- _onToolbarToggleRaiseHand() {- const { dispatch, _raisedHand } = this.props;+});++const ReactionsMenu = ({+ _dockToolbox,+ _isGifEnabled,+ _isGifMenuVisible,+ _isMobile,+ _raisedHand,+ dispatch,+ overflowMenu+}: IProps) => {+ const { classes, cx } = useStyles();+ const { t } = useTranslation();++ useEffect(() => {+ _dockToolbox(true);++ return () => {+ _dockToolbox(false);+ };+ }, []);++ const _doToggleRaiseHand = () => {+ dispatch(raiseHand(!_raisedHand));+ };+ const _onToolbarToggleRaiseHand = useCallback(() => {sendAnalytics(createToolbarEvent('raise.hand',{ enable: !_raisedHand }));- this._doToggleRaiseHand();+ _doToggleRaiseHand();dispatch(toggleReactionsMenuVisibility());- }-- /**- * Dispatches an action to toggle the local participant's raised hand state.- *- * @private- * @returns {void}- */- _doToggleRaiseHand() {- const { _raisedHand } = this.props;+ }, [ _raisedHand ]);- this.props.dispatch(raiseHand(!_raisedHand));- }-- /**- * Returns the emoji reaction buttons.- *- * @returns {Array}- */- _getReactionButtons() {- const { t, dispatch } = this.props;+ const _getReactionButtons = () => {let modifierKey = 'Alt';if (window.navigator?.platform) {@@ -179,7 +132,6 @@ class ReactionsMenu extends Component<IProps> {sendAnalytics(createReactionMenuEvent(key));}- // @ts-ignorereturn (<ReactionButtonaccessibilityLabel = { t(`toolbar.accessibilityLabel.${key}`) }icon = { REACTIONS[key].emoji }@@ -189,44 +141,34 @@ class ReactionsMenu extends Component<IProps> {toggled = { false }tooltip = { `${t(`toolbar.${key}`)} (${modifierKey} + ${REACTIONS[key].shortcutChar})` } />);});- }-- /**- * Implements React's {@link Component#render}.- *- * @inheritdoc- */- render() {- const { _raisedHand, t, overflowMenu, _isMobile, classes, _isGifMenuVisible, _isGifEnabled } = this.props;+ };- return (- <div- className = { clsx('reactions-menu', _isGifEnabled && 'with-gif',- overflowMenu && `overflow ${classes.overflow}`) }>- {_isGifEnabled && _isGifMenuVisible && <GifsMenu />}- <div className = 'reactions-row'>- { this._getReactionButtons() }- {_isGifEnabled && <GifsMenuButton />}- </div>- {_isMobile && (- <div className = 'raise-hand-row'>- {/* @ts-ignore */}- <ReactionButton- accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }- icon = '✋'- key = 'raisehand'- label = {- `${t(`toolbar.${_raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`)}- ${overflowMenu ? '' : ' (R)'}`- }- onClick = { this._onToolbarToggleRaiseHand }- toggled = { true } />- </div>- )}+ return (+ <div+ className = { cx('reactions-menu', _isGifEnabled && 'with-gif',+ overflowMenu && `overflow ${classes.overflow}`) }>+ {_isGifEnabled && _isGifMenuVisible && <GifsMenu />}+ <div className = 'reactions-row'>+ {_getReactionButtons()}+ {_isGifEnabled && <GifsMenuButton />}</div>- );- }-}+ {_isMobile && (+ <div className = 'raise-hand-row'>+ <ReactionButton+ accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }+ icon = '✋'+ key = 'raisehand'+ label = {+ `${t(`toolbar.${_raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`)}+ ${overflowMenu ? '' : ' (R)'}`+ }+ onClick = { _onToolbarToggleRaiseHand }+ toggled = { true } />+ </div>+ )}+ </div>+ );+};/*** Function that maps parts of Redux state tree into component props.@@ -260,7 +202,4 @@ function mapDispatchToProps(dispatch: IStore['dispatch']) {};}-export default translate(connect(- mapStateToProps,- mapDispatchToProps-)(withStyles(styles)(ReactionsMenu)));+export default connect(mapStateToProps, mapDispatchToProps)(ReactionsMenu);diff --git a/react/features/settings/components/web/SettingsDialog.tsx b/react/features/settings/components/web/SettingsDialog.tsxindex 92a296e1fa..493708045b 100644--- a/react/features/settings/components/web/SettingsDialog.tsx+++ b/react/features/settings/components/web/SettingsDialog.tsx@@ -1,6 +1,6 @@-import { withStyles } from '@mui/styles';-import React, { Component } from 'react';+import React from 'react';import { connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';import {@@ -62,11 +62,6 @@ interface IProps {*/_tabs: IDialogTab<any>[];- /**- * An object containing the CSS classes.- */- classes: Object;-/*** Which settings tab should be initially displayed. If not defined then* the first tab will be displayed.@@ -85,57 +80,36 @@ interface IProps {isDisplayedOnWelcomePage: boolean;}-/**- * Creates the styles for the component.- *- * @param {Object} theme - The current UI theme.- *- * @returns {Object}- */-const styles = () => {+const useStyles = makeStyles()(() => {return {settingsDialog: {display: 'flex',width: '100%'}};-};+});-/**- * A React {@code Component} for displaying a dialog to modify local settings- * and conference-wide (moderator) settings. This version is connected to- * redux to get the current settings.- *- * @augments Component- */-class SettingsDialog extends Component<IProps> {+const SettingsDialog = ({ _tabs, defaultTab, dispatch }: IProps) => {+ const { classes } = useStyles();- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const { _tabs, defaultTab, dispatch } = this.props;- const correctDefaultTab = _tabs.find(tab => tab.name === defaultTab)?.name;- const tabs = _tabs.map(tab => {- return {- ...tab,- submit: (...args: any) => tab.submit- && dispatch(tab.submit(...args))- };- });+ const correctDefaultTab = _tabs.find(tab => tab.name === defaultTab)?.name;+ const tabs = _tabs.map(tab => {+ return {+ ...tab,+ className: `settings-pane ${classes.settingsDialog}`,+ submit: (...args: any) => tab.submit+ && dispatch(tab.submit(...args))+ };+ });- return (- <DialogWithTabs- className = 'settings-dialog'- defaultTab = { correctDefaultTab }- tabs = { tabs }- titleKey = 'settings.title' />- );- }-}+ return (+ <DialogWithTabs+ className = 'settings-dialog'+ defaultTab = { correctDefaultTab }+ tabs = { tabs }+ titleKey = 'settings.title' />+ );+};/*** Maps (parts of) the Redux state to the associated props for the@@ -149,7 +123,7 @@ class SettingsDialog extends Component<IProps> {* }}*/function _mapStateToProps(state: IReduxState, ownProps: any) {- const { classes, isDisplayedOnWelcomePage } = ownProps;+ const { isDisplayedOnWelcomePage } = ownProps;const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];// The settings sections to display.@@ -188,7 +162,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {selectedAudioOutputId: tabState.selectedAudioOutputId};},- className: `settings-pane ${classes.settingsDialog}`,submit: (newState: any) => submitAudioDeviceSelectionTab(newState, isDisplayedOnWelcomePage),icon: IconVolumeUp});@@ -211,7 +184,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {selectedVideoInputId: tabState.selectedVideoInputId};},- className: `settings-pane ${classes.settingsDialog}`,submit: (newState: any) => submitVideoDeviceSelectionTab(newState, isDisplayedOnWelcomePage),icon: IconVideo});@@ -223,7 +195,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {component: VirtualBackgroundTab,labelKey: 'virtualBackground.title',props: getVirtualBackgroundTabProps(state),- className: `settings-pane ${classes.settingsDialog}`,submit: (newState: any) => submitVirtualBackgroundTab(newState),cancel: () => {const { _virtualBackground } = getVirtualBackgroundTabProps(state);@@ -254,7 +225,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {};},props: getNotificationsTabProps(state, showSoundsSettings),- className: `settings-pane ${classes.settingsDialog}`,submit: submitNotificationsTab,icon: IconBell});@@ -277,7 +247,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {startReactionsMuted: tabState?.startReactionsMuted};},- className: `settings-pane ${classes.settingsDialog}`,submit: submitModeratorTab,icon: IconModerator});@@ -289,7 +258,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {component: ProfileTab,labelKey: 'profile.title',props: getProfileTabProps(state),- className: `settings-pane ${classes.settingsDialog}`,submit: submitProfileTab,icon: IconUser});@@ -300,7 +268,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {name: SETTINGS_TABS.CALENDAR,component: CalendarTab,labelKey: 'settings.calendar.title',- className: `settings-pane ${classes.settingsDialog}`,icon: IconCalendar});}@@ -318,7 +285,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {keyboardShortcutsEnabled: tabState?.keyboardShortcutsEnabled};},- className: `settings-pane ${classes.settingsDialog}`,submit: submitShortcutsTab,icon: IconShortcuts});@@ -340,7 +306,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {maxStageParticipants: tabState?.maxStageParticipants};},- className: `settings-pane ${classes.settingsDialog}`,submit: submitMoreTab,icon: IconGear});@@ -349,4 +314,4 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {return { _tabs: tabs };}-export default withStyles(styles)(connect(_mapStateToProps)(SettingsDialog));+export default connect(_mapStateToProps)(SettingsDialog);diff --git a/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx b/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsxindex 349001b1c7..24ea83e57b 100644--- a/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx+++ b/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx@@ -1,12 +1,11 @@/* eslint-disable lines-around-comment */-import { withStyles } from '@mui/styles';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { batch, connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';-import { IReduxState } from '../../../app/types';+import { IReduxState, IStore } from '../../../app/types';import { isMobileBrowser } from '../../../base/environment/utils';-import { translate } from '../../../base/i18n/functions';import { IconDotsHorizontal } from '../../../base/icons/svg';import { getLocalParticipant } from '../../../base/participants/functions';import Popover from '../../../base/popover/components/Popover.web';@@ -36,7 +35,7 @@ import TogglePinToStageButton from './TogglePinToStageButton';* The type of the React {@code Component} props of* {@link LocalVideoMenuTriggerButton}.*/-interface IProps extends WithTranslation {+interface IProps {/*** The id of the local participant.@@ -79,15 +78,10 @@ interface IProps extends WithTranslation {*/buttonVisible: boolean;- /**- * An object containing the CSS classes.- */- classes: any;-/*** The redux dispatch function.*/- dispatch: Function;+ dispatch: IStore['dispatch'];/*** Hides popover.@@ -110,7 +104,7 @@ interface IProps extends WithTranslation {thumbnailType: string;}-const styles = () => {+const useStyles = makeStyles()(() => {return {triggerButton: {padding: '3px !important',@@ -123,7 +117,7 @@ const styles = () => {},contextMenu: {- position: 'relative' as const,+ position: 'relative',marginTop: 0,right: 'auto',padding: '0',@@ -134,133 +128,91 @@ const styles = () => {marginLeft: '36px'}};-};--/**- * React Component for displaying an icon associated with opening the- * the video menu for the local participant.- *- * @augments {Component}- */-class LocalVideoMenuTriggerButton extends Component<IProps> {-- /**- * Initializes a new LocalVideoMenuTriggerButton instance.- *- * @param {Object} props - The read-only React Component props with which- * the new instance is to be initialized.- */- constructor(props: IProps) {- super(props);-- this._onPopoverClose = this._onPopoverClose.bind(this);- this._onPopoverOpen = this._onPopoverOpen.bind(this);- }--- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const {- _localParticipantId,- _menuPosition,- _overflowDrawer,- _showConnectionInfo,- _showHideSelfViewButton,- _showLocalVideoFlipButton,- _showPinToStage,- buttonVisible,- classes,- hidePopover,- popoverVisible,- t- } = this.props;-- const content = _showConnectionInfo- ? <ConnectionIndicatorContent participantId = { _localParticipantId } />- : (- <ContextMenu- className = { classes.contextMenu }- hidden = { false }- inDrawer = { _overflowDrawer }>- <ContextMenuItemGroup>- { _showLocalVideoFlipButton- && <FlipLocalVideoButton- className = { _overflowDrawer ? classes.flipText : '' }- onClick = { hidePopover } />- }- { _showHideSelfViewButton- && <HideSelfViewVideoButton- className = { _overflowDrawer ? classes.flipText : '' }- onClick = { hidePopover } />- }- {- _showPinToStage && <TogglePinToStageButton- className = { _overflowDrawer ? classes.flipText : '' }- noIcon = { true }- onClick = { hidePopover }- participantID = { _localParticipantId } />- }- { isMobileBrowser()- && <ConnectionStatusButton participantId = { _localParticipantId } />- }- </ContextMenuItemGroup>- </ContextMenu>- );-- return (- isMobileBrowser() || _showLocalVideoFlipButton || _showHideSelfViewButton- ? <Popover- content = { content }- headingLabel = { t('dialog.localUserControls') }- id = 'local-video-menu-trigger'- onPopoverClose = { this._onPopoverClose }- onPopoverOpen = { this._onPopoverOpen }- position = { _menuPosition }- visible = { popoverVisible }>- {buttonVisible && !isMobileBrowser() && (- <Button- accessibilityLabel = { t('dialog.localUserControls') }- className = { classes.triggerButton }- icon = { IconDotsHorizontal }- size = 'small' />- )}- </Popover>- : null- );- }-- /**- * Disable and hide toolbox while context menu is open.- *- * @returns {void}- */- _onPopoverOpen() {- const { dispatch, showPopover } = this.props;-+});++const LocalVideoMenuTriggerButton = ({+ _localParticipantId,+ _menuPosition,+ _overflowDrawer,+ _showConnectionInfo,+ _showHideSelfViewButton,+ _showLocalVideoFlipButton,+ _showPinToStage,+ buttonVisible,+ dispatch,+ hidePopover,+ showPopover,+ popoverVisible+}: IProps) => {+ const { classes } = useStyles();+ const { t } = useTranslation();++ const _onPopoverOpen = useCallback(() => {showPopover();dispatch(setParticipantContextMenuOpen(true));- }-- /**- * Render normal context menu next time popover dialog opens.- *- * @returns {void}- */- _onPopoverClose() {- const { hidePopover, dispatch } = this.props;+ }, []);+ const _onPopoverClose = useCallback(() => {hidePopover();batch(() => {dispatch(setParticipantContextMenuOpen(false));dispatch(renderConnectionStatus(false));});- }-}+ }, []);++ const content = _showConnectionInfo+ ? <ConnectionIndicatorContent participantId = { _localParticipantId } />+ : (+ <ContextMenu+ className = { classes.contextMenu }+ hidden = { false }+ inDrawer = { _overflowDrawer }>+ <ContextMenuItemGroup>+ {_showLocalVideoFlipButton+ && <FlipLocalVideoButton+ className = { _overflowDrawer ? classes.flipText : '' }+ onClick = { hidePopover } />+ }+ {_showHideSelfViewButton+ && <HideSelfViewVideoButton+ className = { _overflowDrawer ? classes.flipText : '' }+ onClick = { hidePopover } />+ }+ {+ _showPinToStage && <TogglePinToStageButton+ className = { _overflowDrawer ? classes.flipText : '' }+ noIcon = { true }+ onClick = { hidePopover }+ participantID = { _localParticipantId } />+ }+ {isMobileBrowser()+ && <ConnectionStatusButton participantId = { _localParticipantId } />+ }+ </ContextMenuItemGroup>+ </ContextMenu>+ );++ return (+ isMobileBrowser() || _showLocalVideoFlipButton || _showHideSelfViewButton+ ? <Popover+ content = { content }+ headingLabel = { t('dialog.localUserControls') }+ id = 'local-video-menu-trigger'+ onPopoverClose = { _onPopoverClose }+ onPopoverOpen = { _onPopoverOpen }+ position = { _menuPosition }+ visible = { popoverVisible }>+ {buttonVisible && !isMobileBrowser() && (+ <Button+ accessibilityLabel = { t('dialog.localUserControls') }+ className = { classes.triggerButton }+ icon = { IconDotsHorizontal }+ size = 'small' />+ )}+ </Popover>+ : null+ );+};/*** Maps (parts of) the Redux state to the associated {@code LocalVideoMenuTriggerButton}'s props.@@ -306,4 +258,4 @@ function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {};}-export default translate(connect(_mapStateToProps)(withStyles(styles)(LocalVideoMenuTriggerButton)));+export default connect(_mapStateToProps)(LocalVideoMenuTriggerButton);diff --git a/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx b/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsxindex 6c7fd878a6..1c36a3a708 100644--- a/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx+++ b/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx@@ -1,12 +1,11 @@/* eslint-disable lines-around-comment */-import { withStyles } from '@mui/styles';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { batch, connect } from 'react-redux';+import { makeStyles } from 'tss-react/mui';-import { IReduxState } from '../../../app/types';+import { IReduxState, IStore } from '../../../app/types';import { isMobileBrowser } from '../../../base/environment/utils';-import { translate } from '../../../base/i18n/functions';import { IconDotsHorizontal } from '../../../base/icons/svg';import { getLocalParticipant, getParticipantById } from '../../../base/participants/functions';import { IParticipant } from '../../../base/participants/types';@@ -29,7 +28,7 @@ import { REMOTE_CONTROL_MENU_STATES } from './RemoteControlButton';* The type of the React {@code Component} props of* {@link RemoteVideoMenuTriggerButton}.*/-interface IProps extends WithTranslation {+interface IProps {/*** Whether the remote video context menu is disabled.@@ -72,15 +71,10 @@ interface IProps extends WithTranslation {*/buttonVisible: boolean;- /**- * An object containing the CSS classes.- */- classes: any;-/*** The redux dispatch function.*/- dispatch: Function;+ dispatch: IStore['dispatch'];/*** Hides popover.@@ -108,7 +102,7 @@ interface IProps extends WithTranslation {thumbnailType: string;}-const styles = () => {+const useStyles = makeStyles()(() => {return {triggerButton: {padding: '3px !important',@@ -121,126 +115,51 @@ const styles = () => {},contextMenu: {- position: 'relative' as const,+ position: 'relative',marginTop: 0,right: 'auto',marginRight: '4px',marginBottom: '4px'}};-};--/**- * React {@code Component} for displaying an icon associated with opening the- * the {@code VideoMenu}.- *- * @augments {Component}- */-class RemoteVideoMenuTriggerButton extends Component<IProps> {-- /**- * Initializes a new RemoteVideoMenuTriggerButton instance.- *- * @param {Object} props - The read-only React Component props with which- * the new instance is to be initialized.- */- constructor(props: IProps) {- super(props);-- this._onPopoverClose = this._onPopoverClose.bind(this);- this._onPopoverOpen = this._onPopoverOpen.bind(this);- }-- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const {- _disabled,- _showConnectionInfo,- _participantDisplayName,- buttonVisible,- classes,- participantID,- popoverVisible- } = this.props;- let content;-- if (_showConnectionInfo) {- content = <ConnectionIndicatorContent participantId = { participantID } />;- } else if (!_disabled) {- content = this._renderRemoteVideoMenu();- }-- if (!content) {- return null;- }-- const username = _participantDisplayName;-- return (- <Popover- content = { content }- headingLabel = { this.props.t('dialog.remoteUserControls', { username }) }- id = 'remote-video-menu-trigger'- onPopoverClose = { this._onPopoverClose }- onPopoverOpen = { this._onPopoverOpen }- position = { this.props._menuPosition }- visible = { popoverVisible }>- { buttonVisible && !_disabled && (- !isMobileBrowser() && <Button- accessibilityLabel = { this.props.t('dialog.remoteUserControls', { username }) }- className = { classes.triggerButton }- icon = { IconDotsHorizontal }- size = 'small' />- )}- </Popover>- );- }-- /**- * Disable and hide toolbox while context menu is open.- *- * @returns {void}- */- _onPopoverOpen() {- const { dispatch, showPopover } = this.props;-+});++const RemoteVideoMenuTriggerButton = ({+ _disabled,+ _localVideoOwner,+ _menuPosition,+ _participant,+ _participantDisplayName,+ _remoteControlState,+ _showConnectionInfo,+ buttonVisible,+ dispatch,+ hidePopover,+ participantID,+ popoverVisible,+ showPopover+}: IProps) => {+ const { classes } = useStyles();+ const { t } = useTranslation();++ const _onPopoverOpen = useCallback(() => {showPopover();dispatch(setParticipantContextMenuOpen(true));- }-- /**- * Render normal context menu next time popover dialog opens.- *- * @returns {void}- */- _onPopoverClose() {- const { dispatch, hidePopover } = this.props;+ }, []);+ const _onPopoverClose = useCallback(() => {hidePopover();batch(() => {dispatch(setParticipantContextMenuOpen(false));dispatch(renderConnectionStatus(false));});- }-- /**- * Creates a new {@code VideoMenu} with buttons for interacting with- * the remote participant.- *- * @private- * @returns {ReactElement}- */- _renderRemoteVideoMenu() {- const { _localVideoOwner, _participant, _remoteControlState, classes } = this.props;+ }, []);+ // eslint-disable-next-line react/no-multi-comp+ const _renderRemoteVideoMenu = () => {const props = {className: classes.contextMenu,- onSelect: this._onPopoverClose,+ onSelect: _onPopoverClose,participant: _participant,thumbnailMenu: true};@@ -258,8 +177,41 @@ class RemoteVideoMenuTriggerButton extends Component<IProps> {{ ...props }remoteControlState = { _remoteControlState } />);+ };++ let content;++ if (_showConnectionInfo) {+ content = <ConnectionIndicatorContent participantId = { participantID } />;+ } else if (!_disabled) {+ content = _renderRemoteVideoMenu();}-}++ if (!content) {+ return null;+ }++ const username = _participantDisplayName;++ return (+ <Popover+ content = { content }+ headingLabel = { t('dialog.remoteUserControls', { username }) }+ id = 'remote-video-menu-trigger'+ onPopoverClose = { _onPopoverClose }+ onPopoverOpen = { _onPopoverOpen }+ position = { _menuPosition }+ visible = { popoverVisible }>+ {buttonVisible && !_disabled && (+ !isMobileBrowser() && <Button+ accessibilityLabel = { t('dialog.remoteUserControls', { username }) }+ className = { classes.triggerButton }+ icon = { IconDotsHorizontal }+ size = 'small' />+ )}+ </Popover>+ );+};/*** Maps (parts of) the Redux state to the associated {@code RemoteVideoMenuTriggerButton}'s props.@@ -322,5 +274,4 @@ function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {};}-export default translate(connect(_mapStateToProps)(- withStyles(styles)(RemoteVideoMenuTriggerButton)));+export default connect(_mapStateToProps)(RemoteVideoMenuTriggerButton);diff --git a/react/features/video-menu/components/web/VerifyParticipantButton.tsx b/react/features/video-menu/components/web/VerifyParticipantButton.tsxindex bf20f2cf59..e90a57b417 100644--- a/react/features/video-menu/components/web/VerifyParticipantButton.tsx+++ b/react/features/video-menu/components/web/VerifyParticipantButton.tsx@@ -1,10 +1,8 @@-import { withStyles } from '@mui/styles';-import React, { Component } from 'react';-import { WithTranslation } from 'react-i18next';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { connect } from 'react-redux';-import { IReduxState } from '../../../app/types';-import { translate } from '../../../base/i18n/functions';+import { IReduxState, IStore } from '../../../app/types';import { IconCheck } from '../../../base/icons/svg';import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';import { startVerification } from '../../../e2ee/actions';@@ -13,12 +11,12 @@ import { startVerification } from '../../../e2ee/actions';* The type of the React {@code Component} props of* {@link VerifyParticipantButton}.*/-interface IProps extends WithTranslation {+interface IProps {/*** The redux {@code dispatch} function.*/- dispatch: Function;+ dispatch: IStore['dispatch'];/*** The ID of the participant that this button is supposed to verified.@@ -26,75 +24,27 @@ interface IProps extends WithTranslation {participantID: string;}-const styles = () => {- return {- triggerButton: {- padding: '3px !important',- borderRadius: '4px'- },-- contextMenu: {- position: 'relative' as const,- marginTop: 0,- right: 'auto',- marginRight: '4px',- marginBottom: '4px'- }- };-};--/**- * React {@code Component} for displaying an icon associated with opening the- * the {@code VideoMenu}.- *- * @augments {Component}- */-class VerifyParticipantButton extends Component<IProps> {-- /**- * Instantiates a new {@code Component}.- *- * @inheritdoc- */- constructor(props: IProps) {- super(props);-- this._handleClick = this._handleClick.bind(this);- }-- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const { participantID, t } = this.props;-- return (- <ContextMenuItem- accessibilityLabel = { t('videothumbnail.verify') }- className = 'verifylink'- icon = { IconCheck }- id = { `verifylink_${participantID}` }- // eslint-disable-next-line react/jsx-handler-names- onClick = { this._handleClick }- text = { t('videothumbnail.verify') } />- );- }-- /**- * Handles clicking / pressing the button, and starts the participant verification process.- *- * @private- * @returns {void}- */- _handleClick() {- const { dispatch, participantID } = this.props;+const VerifyParticipantButton = ({+ dispatch,+ participantID+}: IProps) => {+ const { t } = useTranslation();+ const _handleClick = useCallback(() => {dispatch(startVerification(participantID));- }-}+ }, [ participantID ]);++ return (+ <ContextMenuItem+ accessibilityLabel = { t('videothumbnail.verify') }+ className = 'verifylink'+ icon = { IconCheck }+ id = { `verifylink_${participantID}` }+ // eslint-disable-next-line react/jsx-handler-names+ onClick = { _handleClick }+ text = { t('videothumbnail.verify') } />+ );+};/*** Maps (parts of) the Redux state to the associated {@code RemoteVideoMenuTriggerButton}'s props.@@ -112,4 +62,4 @@ function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {};}-export default translate(connect(_mapStateToProps)(withStyles(styles)(VerifyParticipantButton)));+export default connect(_mapStateToProps)(VerifyParticipantButton);