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: remove some Abstract components (#13553)
Robert Pintilii961a9236fd18
diff --git a/react/features/display-name/components/AbstractDisplayNamePrompt.tsx b/react/features/display-name/components/AbstractDisplayNamePrompt.tsxdeleted file mode 100644index 7949309e91..0000000000--- a/react/features/display-name/components/AbstractDisplayNamePrompt.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { Component } from 'react';-import { WithTranslation } from 'react-i18next';--import { IStore } from '../../app/types';-import { updateSettings } from '../../base/settings/actions';--/**- * The type of the React {@code Component} props of- * {@link AbstractDisplayNamePrompt}.- */-export interface IProps extends WithTranslation {-- /**- * Invoked to update the local participant's display name.- */- dispatch: IStore['dispatch'];-- /**- * Function to be invoked after a successful display name change.- */- onPostSubmit?: Function;-}--/**- * Implements an abstract class for {@code DisplayNamePrompt}.- */-export default class AbstractDisplayNamePrompt<S>- extends Component<IProps, S> {- /**- * Instantiates a new component.- *- * @inheritdoc- */- constructor(props: IProps) {- super(props);-- this._onSetDisplayName = this._onSetDisplayName.bind(this);- }-- /**- * Dispatches an action to update the local participant's display name. A- * name must be entered for the action to dispatch.- *- * It returns a boolean to comply the Dialog behaviour:- * {@code true} - the dialog should be closed.- * {@code false} - the dialog should be left open.- *- * @param {string} displayName - The display name to save.- * @returns {boolean}- */- _onSetDisplayName(displayName: string) {- if (!displayName?.trim()) {- return false;- }-- const { dispatch, onPostSubmit } = this.props;-- // Store display name in settings- dispatch(updateSettings({- displayName- }));-- onPostSubmit?.();-- return true;- }-}diff --git a/react/features/display-name/components/native/DisplayNamePrompt.tsx b/react/features/display-name/components/native/DisplayNamePrompt.tsxindex 2a1b557866..bf3a28354f 100644--- a/react/features/display-name/components/native/DisplayNamePrompt.tsx+++ b/react/features/display-name/components/native/DisplayNamePrompt.tsx@@ -1,13 +1,29 @@-import React from 'react';+import React, { Component } from 'react';import { connect } from 'react-redux';import InputDialog from '../../../base/dialog/components/native/InputDialog';-import AbstractDisplayNamePrompt from '../AbstractDisplayNamePrompt';+import { onSetDisplayName } from '../../functions';+import { IProps } from '../../types';/*** Implements a component to render a display name prompt.*/-class DisplayNamePrompt extends AbstractDisplayNamePrompt<any> {+class DisplayNamePrompt extends Component<IProps> {+ _onSetDisplayName: (displayName: string) => boolean;++ /**+ * Initializes a new {@code DisplayNamePrompt} instance.+ *+ * @param {Object} props - The read-only properties with which the new+ * instance is to be initialized.+ */+ constructor(props: IProps) {+ super(props);++ // Bind event handlers so they are only bound once for every instance.+ this._onSetDisplayName = onSetDisplayName(props.dispatch, props.onPostSubmit);+ }+/*** Implements React's {@link Component#render()}.*diff --git a/react/features/display-name/components/web/DisplayNamePrompt.tsx b/react/features/display-name/components/web/DisplayNamePrompt.tsxindex 902007c855..b5b3632fcd 100644--- a/react/features/display-name/components/web/DisplayNamePrompt.tsx+++ b/react/features/display-name/components/web/DisplayNamePrompt.tsx@@ -1,10 +1,11 @@-import React from 'react';+import React, { Component } from 'react';import { connect } from 'react-redux';import { translate } from '../../../base/i18n/functions';import Dialog from '../../../base/ui/components/web/Dialog';import Input from '../../../base/ui/components/web/Input';-import AbstractDisplayNamePrompt, { IProps } from '../AbstractDisplayNamePrompt';+import { onSetDisplayName } from '../../functions';+import { IProps } from '../../types';/*** The type of the React {@code Component} props of {@link DisplayNamePrompt}.@@ -23,7 +24,9 @@ interface IState {** @augments Component*/-class DisplayNamePrompt extends AbstractDisplayNamePrompt<IState> {+class DisplayNamePrompt extends Component<IProps, IState> {+ _onSetDisplayName: (displayName: string) => boolean;+/*** Initializes a new {@code DisplayNamePrompt} instance.*@@ -40,6 +43,7 @@ class DisplayNamePrompt extends AbstractDisplayNamePrompt<IState> {// Bind event handlers so they are only bound once for every instance.this._onDisplayNameChange = this._onDisplayNameChange.bind(this);this._onSubmit = this._onSubmit.bind(this);+ this._onSetDisplayName = onSetDisplayName(props.dispatch, props.onPostSubmit);}/**diff --git a/react/features/display-name/functions.ts b/react/features/display-name/functions.tsindex 56f6392f48..fce550338e 100644--- a/react/features/display-name/functions.ts+++ b/react/features/display-name/functions.ts@@ -1,3 +1,5 @@+import { IStore } from '../app/types';+import { updateSettings } from '../base/settings/actions';/*** Appends a suffix to the display name.@@ -10,3 +12,33 @@ export function appendSuffix(displayName: string, suffix = ''): string {return `${displayName || suffix}${displayName && suffix && displayName !== suffix ? ` (${suffix})` : ''}`;}++/**+ * Dispatches an action to update the local participant's display name. A+ * name must be entered for the action to dispatch.+ *+ * It returns a boolean to comply the Dialog behaviour:+ * {@code true} - the dialog should be closed.+ * {@code false} - the dialog should be left open.+ *+ * @param {Function} dispatch - Redux dispatch function.+ * @param {Function} onPostSubmit - Function to be invoked after a successful display name change.+ * @param {string} displayName - The display name to save.+ * @returns {boolean}+ */+export function onSetDisplayName(dispatch: IStore['dispatch'], onPostSubmit?: Function) {+ return function(displayName: string) {+ if (!displayName?.trim()) {+ return false;+ }++ // Store display name in settings+ dispatch(updateSettings({+ displayName+ }));++ onPostSubmit?.();++ return true;+ };+}diff --git a/react/features/display-name/types.ts b/react/features/display-name/types.tsnew file mode 100644index 0000000000..8f6ad22531--- /dev/null+++ b/react/features/display-name/types.ts@@ -0,0 +1,20 @@+import { WithTranslation } from 'react-i18next';++import { IStore } from '../app/types';++/**+ * The type of the React {@code Component} props of+ * {@link AbstractDisplayNamePrompt}.+ */+export interface IProps extends WithTranslation {++ /**+ * Invoked to update the local participant's display name.+ */+ dispatch: IStore['dispatch'];++ /**+ * Function to be invoked after a successful display name change.+ */+ onPostSubmit?: Function;+}diff --git a/react/features/e2ee/components/AbstractE2EELabel.ts b/react/features/e2ee/components/AbstractE2EELabel.tsdeleted file mode 100644index 5ed87b0418..0000000000--- a/react/features/e2ee/components/AbstractE2EELabel.ts+++ /dev/null@@ -1,32 +0,0 @@-import { WithTranslation } from 'react-i18next';--import { IReduxState } from '../../app/types';--export interface IProps extends WithTranslation {-- /**- * Custom e2ee labels.- */- _e2eeLabels?: any;-- /**- * True if the label needs to be rendered, false otherwise.- */- _showLabel?: boolean;-}--/**- * Maps (parts of) the redux state to the associated props of this {@code Component}.- *- * @param {Object} state - The redux state.- * @private- * @returns {IProps}- */-export function _mapStateToProps(state: IReduxState) {- const { e2ee = {} } = state['features/base/config'];-- return {- _e2eeLabels: e2ee.labels,- _showLabel: state['features/base/participants'].numberOfParticipantsDisabledE2EE === 0- };-}diff --git a/react/features/e2ee/components/E2EELabel.tsx b/react/features/e2ee/components/E2EELabel.tsxindex 546358d072..47bc204bbd 100644--- a/react/features/e2ee/components/E2EELabel.tsx+++ b/react/features/e2ee/components/E2EELabel.tsx@@ -1,13 +1,26 @@import React from 'react';+import { WithTranslation } from 'react-i18next';import { connect } from 'react-redux';+import { IReduxState } from '../../app/types';import { translate } from '../../base/i18n/functions';import { IconE2EE } from '../../base/icons/svg';import Label from '../../base/label/components/web/Label';import { COLORS } from '../../base/label/constants';import Tooltip from '../../base/tooltip/components/Tooltip';-import { IProps, _mapStateToProps } from './AbstractE2EELabel';+export interface IProps extends WithTranslation {++ /**+ * Custom e2ee labels.+ */+ _e2eeLabels?: any;++ /**+ * True if the label needs to be rendered, false otherwise.+ */+ _showLabel?: boolean;+}const E2EELabel = ({ _e2eeLabels, _showLabel, t }: IProps) => {@@ -27,4 +40,20 @@ const E2EELabel = ({ _e2eeLabels, _showLabel, t }: IProps) => {);};+/**+ * Maps (parts of) the redux state to the associated props of this {@code Component}.+ *+ * @param {Object} state - The redux state.+ * @private+ * @returns {IProps}+ */+export function _mapStateToProps(state: IReduxState) {+ const { e2ee = {} } = state['features/base/config'];++ return {+ _e2eeLabels: e2ee.labels,+ _showLabel: state['features/base/participants'].numberOfParticipantsDisabledE2EE === 0+ };+}+export default translate(connect(_mapStateToProps)(E2EELabel));diff --git a/react/features/filmstrip/components/AbstractRaisedHandIndicator.ts b/react/features/filmstrip/components/AbstractRaisedHandIndicator.tsdeleted file mode 100644index b595f20444..0000000000--- a/react/features/filmstrip/components/AbstractRaisedHandIndicator.ts+++ /dev/null@@ -1,61 +0,0 @@-import React, { Component } from 'react';--import { IReduxState } from '../../app/types';-import { getParticipantById, hasRaisedHand } from '../../base/participants/functions';--export interface IProps {-- /**- * True if the hand is raised for this participant.- */- _raisedHand?: boolean;-- /**- * The participant id who we want to render the raised hand indicator- * for.- */- participantId: string;-}--/**- * Implements an abstract class for the RaisedHandIndicator component.- */-export default abstract class AbstractRaisedHandIndicator<P extends IProps>- extends Component<P> {-- /**- * Implements {@code Component#render}.- *- * @inheritdoc- */- render() {- if (!this.props._raisedHand) {- return null;- }-- return this._renderIndicator();- }-- /**- * Renders the platform specific indicator element.- *- * @returns {React$Element<*>}- */- abstract _renderIndicator(): React.ReactElement;--}--/**- * Maps part of the Redux state to the props of this component.- *- * @param {Object} state - The Redux state.- * @param {IProps} ownProps - The own props of the component.- * @returns {Object}- */-export function _mapStateToProps(state: IReduxState, ownProps: IProps) {- const participant = getParticipantById(state, ownProps.participantId);-- return {- _raisedHand: hasRaisedHand(participant)- };-}diff --git a/react/features/filmstrip/components/native/RaisedHandIndicator.tsx b/react/features/filmstrip/components/native/RaisedHandIndicator.tsxindex 00c9a59400..b80846ffe1 100644--- a/react/features/filmstrip/components/native/RaisedHandIndicator.tsx+++ b/react/features/filmstrip/components/native/RaisedHandIndicator.tsx@@ -1,23 +1,49 @@-import React from 'react';+import React, { Component } from 'react';import { View, ViewStyle } from 'react-native';import { connect } from 'react-redux';+import { IReduxState } from '../../../app/types';import { IconRaiseHand } from '../../../base/icons/svg';+import { getParticipantById, hasRaisedHand } from '../../../base/participants/functions';import BaseIndicator from '../../../base/react/components/native/BaseIndicator';-import AbstractRaisedHandIndicator, {- IProps,- _mapStateToProps-} from '../AbstractRaisedHandIndicator';import styles from './styles';+export interface IProps {++ /**+ * True if the hand is raised for this participant.+ */+ _raisedHand?: boolean;++ /**+ * The participant id who we want to render the raised hand indicator+ * for.+ */+ participantId: string;+}+/*** Thumbnail badge showing that the participant would like to speak.** @augments Component*/-class RaisedHandIndicator extends AbstractRaisedHandIndicator<IProps> {+class RaisedHandIndicator extends Component<IProps> {++ /**+ * Implements {@code Component#render}.+ *+ * @inheritdoc+ */+ render() {+ if (!this.props._raisedHand) {+ return null;+ }++ return this._renderIndicator();+ }+/*** Renders the platform specific indicator element.*@@ -34,4 +60,19 @@ class RaisedHandIndicator extends AbstractRaisedHandIndicator<IProps> {}}+/**+ * Maps part of the Redux state to the props of this component.+ *+ * @param {Object} state - The Redux state.+ * @param {IProps} ownProps - The own props of the component.+ * @returns {Object}+ */+function _mapStateToProps(state: IReduxState, ownProps: IProps) {+ const participant = getParticipantById(state, ownProps.participantId);++ return {+ _raisedHand: hasRaisedHand(participant)+ };+}+export default connect(_mapStateToProps)(RaisedHandIndicator);diff --git a/react/features/reactions/components/web/ReactionButton.tsx b/react/features/reactions/components/web/ReactionButton.tsxindex f4e4777d2e..f458824f87 100644--- a/react/features/reactions/components/web/ReactionButton.tsx+++ b/react/features/reactions/components/web/ReactionButton.tsx@@ -1,21 +1,49 @@-import React from 'react';+import React, { Component } from 'react';import Tooltip from '../../../base/tooltip/components/Tooltip';import { TOOLTIP_POSITION } from '../../../base/ui/constants.any';-import AbstractToolbarButton, {- IProps as AbstractToolbarButtonProps-} from '../../../toolbox/components/AbstractToolbarButton';/*** The type of the React {@code Component} props of {@link ReactionButton}.*/-interface IProps extends AbstractToolbarButtonProps {+interface IProps {++ /**+ * A succinct description of what the button does. Used by accessibility+ * tools and torture tests.+ */+ accessibilityLabel: string;++ /**+ * The Icon of this {@code AbstractToolbarButton}.+ */+ icon: Object;++ /**+ * The style of the Icon of this {@code AbstractToolbarButton}.+ */+ iconStyle?: Object;/*** Optional label for the button.*/label?: string;+ /**+ * On click handler.+ */+ onClick: Function;++ /**+ * {@code AbstractToolbarButton} Styles.+ */+ style?: Array<string> | Object;++ /**+ * An optional modifier to render the button toggled.+ */+ toggled?: boolean;+/*** Optional text to display in the tooltip.*/@@ -26,6 +54,11 @@ interface IProps extends AbstractToolbarButtonProps {* button.*/tooltipPosition: TOOLTIP_POSITION;++ /**+ * The color underlying the button.+ */+ underlayColor?: any;}/**@@ -49,7 +82,7 @@ interface IState {** @augments AbstractToolbarButton*/-class ReactionButton extends AbstractToolbarButton<IProps, IState> {+class ReactionButton extends Component<IProps, IState> {/*** Default values for {@code ReactionButton} component's properties.*@@ -69,6 +102,7 @@ class ReactionButton extends AbstractToolbarButton<IProps, IState> {this._onKeyDown = this._onKeyDown.bind(this);this._onClickHandler = this._onClickHandler.bind(this);+ this._onClick = this._onClick.bind(this);this.state = {increaseLevel: 0,@@ -76,6 +110,20 @@ class ReactionButton extends AbstractToolbarButton<IProps, IState> {};}+ /**+ * Handles clicking/pressing this {@code AbstractToolbarButton} by+ * forwarding the event to the {@code onClick} prop of this instance if any.+ *+ * @protected+ * @returns {*} The result returned by the invocation of the {@code onClick}+ * prop of this instance if any.+ */+ _onClick(...args: any) {+ const { onClick } = this.props;++ return onClick?.(...args);+ }+/*** Handles 'Enter' key on the button to trigger onClick for accessibility.* We should be handling Space onKeyUp but it conflicts with PTT.@@ -168,6 +216,16 @@ class ReactionButton extends AbstractToolbarButton<IProps, IState> {</div>);}++ /**+ * Implements React's {@link Component#render()}.+ *+ * @inheritdoc+ * @returns {ReactElement}+ */+ render() {+ return this._renderButton(this._renderIcon());+ }}export default ReactionButton;diff --git a/react/features/toolbox/components/AbstractToolbarButton.ts b/react/features/toolbox/components/AbstractToolbarButton.tsdeleted file mode 100644index cd55a378c0..0000000000--- a/react/features/toolbox/components/AbstractToolbarButton.ts+++ /dev/null@@ -1,107 +0,0 @@-import React, { Component, ReactElement } from 'react';--/**- * The type of the React {@code Component} props of- * {@link AbstractToolbarButton}.- */-export interface IProps {-- /**- * A succinct description of what the button does. Used by accessibility- * tools and torture tests.- */- accessibilityLabel: string;-- /**- * The Icon of this {@code AbstractToolbarButton}.- */- icon: Object;-- /**- * The style of the Icon of this {@code AbstractToolbarButton}.- */- iconStyle?: Object;-- /**- * On click handler.- */- onClick: Function;-- /**- * {@code AbstractToolbarButton} Styles.- */- style?: Array<string> | Object;-- /**- * An optional modifier to render the button toggled.- */- toggled?: boolean;-- /**- * The color underlying the button.- */- underlayColor?: any;-}--/**- * Abstract (base) class for a button in {@link Toolbar}.- *- * @abstract- */-export default class AbstractToolbarButton<P extends IProps, State=void> extends Component<P, State> {- /**- * Initializes a new {@code AbstractToolbarButton} instance.- *- * @param {Object} props - The React {@code Component} props to initialize- * the new {@code AbstractToolbarButton} instance with.- */- constructor(props: P) {- super(props);-- // Bind event handlers so they are only bound once per instance.- this._onClick = this._onClick.bind(this);- }-- /**- * Handles clicking/pressing this {@code AbstractToolbarButton} by- * forwarding the event to the {@code onClick} prop of this instance if any.- *- * @protected- * @returns {*} The result returned by the invocation of the {@code onClick}- * prop of this instance if any.- */- _onClick(...args: any) {- const { onClick } = this.props;-- return onClick?.(...args);- }-- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- return this._renderButton(this._renderIcon());- }-- /**- * Render a button element.- *- * @param {ReactElement | null} _el - The element to render inside the button.- * @returns {ReactElement}- */- _renderButton(_el: ReactElement | null): React.ReactElement | null {- return null;- }-- /**- * Render an icon element.- *- * @returns {ReactElement | null}- */- _renderIcon(): React.ReactElement | null {- return null;- }-}diff --git a/react/features/transcribing/components/AbstractTranscribingLabel.tsx b/react/features/transcribing/components/AbstractTranscribingLabel.tsxdeleted file mode 100644index d7c1a0e82f..0000000000--- a/react/features/transcribing/components/AbstractTranscribingLabel.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { IReduxState } from '../../app/types';--/**- * The type of the React {@code Component} props of {@link TranscribingLabel}.- */-export interface IProps {-- /**- * True if the label needs to be rendered, false otherwise.- */- _showLabel: boolean;-- /**- * Invoked to obtain translated strings.- */- t: Function;-}--/**- * Maps (parts of) the redux state to the associated props of the- * {@link AbstractTranscribingLabel} {@code Component}.- *- * @param {Object} state - The redux state.- * @private- * @returns {{- * _showLabel: boolean- * }}- */-export function _mapStateToProps(state: IReduxState) {- return {- _showLabel: state['features/transcribing'].isTranscribing- };-}diff --git a/react/features/transcribing/components/TranscribingLabel.native.tsx b/react/features/transcribing/components/TranscribingLabel.native.tsxindex 330dce955f..16c8d64cb4 100644--- a/react/features/transcribing/components/TranscribingLabel.native.tsx+++ b/react/features/transcribing/components/TranscribingLabel.native.tsx@@ -1,10 +1,22 @@import React, { Component } from 'react';+import { WithTranslation } from 'react-i18next';import { connect } from 'react-redux';+import { IReduxState } from '../../app/types';import { translate } from '../../base/i18n/functions';import Label from '../../base/label/components/native/Label';-import { IProps, _mapStateToProps } from './AbstractTranscribingLabel';+/**+ * The type of the React {@code Component} props of {@link TranscribingLabel}.+ */+export interface IProps extends WithTranslation {++ /**+ * True if the label needs to be rendered, false otherwise.+ */+ _showLabel: boolean;+}+/*** React {@code Component} for displaying a label when a transcriber is in the@@ -28,4 +40,20 @@ class TranscribingLabel extends Component<IProps> {}}+/**+ * Maps (parts of) the redux state to the associated props of the+ * {@link AbstractTranscribingLabel} {@code Component}.+ *+ * @param {Object} state - The redux state.+ * @private+ * @returns {{+ * _showLabel: boolean+ * }}+ */+export function _mapStateToProps(state: IReduxState) {+ return {+ _showLabel: state['features/transcribing'].isTranscribing+ };+}+export default translate(connect(_mapStateToProps)(TranscribingLabel));diff --git a/react/features/transcribing/components/TranscribingLabel.web.tsx b/react/features/transcribing/components/TranscribingLabel.web.tsxindex 59c551f965..713ccde68e 100644--- a/react/features/transcribing/components/TranscribingLabel.web.tsx+++ b/react/features/transcribing/components/TranscribingLabel.web.tsx@@ -1,13 +1,15 @@import React from 'react';-import { connect } from 'react-redux';+import { useTranslation } from 'react-i18next';+import { useSelector } from 'react-redux';-import { translate } from '../../base/i18n/functions';+import { IReduxState } from '../../app/types';import Label from '../../base/label/components/web/Label';import Tooltip from '../../base/tooltip/components/Tooltip';-import { IProps, _mapStateToProps } from './AbstractTranscribingLabel';+const TranscribingLabel = () => {+ const _showLabel = useSelector((state: IReduxState) => state['features/transcribing'].isTranscribing);+ const { t } = useTranslation();-const TranscribingLabel = ({ _showLabel, t }: IProps) => {if (!_showLabel) {return null;}@@ -23,4 +25,4 @@ const TranscribingLabel = ({ _showLabel, t }: IProps) => {);};-export default translate(connect(_mapStateToProps)(TranscribingLabel));+export default TranscribingLabel;diff --git a/react/features/video-quality/components/AbstractVideoQualityLabel.ts b/react/features/video-quality/components/AbstractVideoQualityLabel.tsdeleted file mode 100644index 9b88d50569..0000000000--- a/react/features/video-quality/components/AbstractVideoQualityLabel.ts+++ /dev/null@@ -1,37 +0,0 @@-import { Component } from 'react';-import { WithTranslation } from 'react-i18next';--import { IReduxState } from '../../app/types';--export interface IProps extends WithTranslation {-- /**- * Whether or not the conference is in audio only mode.- */- _audioOnly: boolean;-}--/**- * Abstract class for the {@code VideoQualityLabel} component.- */-export default class AbstractVideoQualityLabel<P extends IProps> extends Component<P> {--}--/**- * Maps (parts of) the Redux state to the associated- * {@code AbstractVideoQualityLabel}'s props.- *- * @param {Object} state - The Redux state.- * @private- * @returns {{- * _audioOnly: boolean- * }}- */-export function _abstractMapStateToProps(state: IReduxState) {- const { enabled: audioOnly } = state['features/base/audio-only'];-- return {- _audioOnly: audioOnly- };-}diff --git a/react/features/video-quality/components/VideoQualityLabel.native.tsx b/react/features/video-quality/components/VideoQualityLabel.native.tsxindex 7dbecf9b66..b5505d9a36 100644--- a/react/features/video-quality/components/VideoQualityLabel.native.tsx+++ b/react/features/video-quality/components/VideoQualityLabel.native.tsx@@ -1,17 +1,20 @@-import React from 'react';+import React, { Component } from 'react';+import { WithTranslation } from 'react-i18next';import { connect } from 'react-redux';+import { IReduxState } from '../../app/types';import { translate } from '../../base/i18n/functions';import Label from '../../base/label/components/native/Label';import { StyleType, combineStyles } from '../../base/styles/functions.native';-import AbstractVideoQualityLabel, {- IProps as AbstractProps,- _abstractMapStateToProps-} from './AbstractVideoQualityLabel';import styles from './styles';-interface IProps extends AbstractProps {+interface IProps extends WithTranslation {++ /**+ * Whether or not the conference is in audio only mode.+ */+ _audioOnly: boolean;/*** Style of the component passed as props.@@ -28,7 +31,7 @@ interface IProps extends AbstractProps {* is kept consistent with web and in the future we may introduce the required* api and extend this component with actual quality indication.*/-class VideoQualityLabel extends AbstractVideoQualityLabel<IProps> {+class VideoQualityLabel extends Component<IProps> {/*** Implements React {@link Component}'s render.@@ -51,4 +54,22 @@ class VideoQualityLabel extends AbstractVideoQualityLabel<IProps> {}}-export default translate(connect(_abstractMapStateToProps)(VideoQualityLabel));+/**+ * Maps (parts of) the Redux state to the associated+ * {@code AbstractVideoQualityLabel}'s props.+ *+ * @param {Object} state - The Redux state.+ * @private+ * @returns {{+ * _audioOnly: boolean+ * }}+ */+function _mapStateToProps(state: IReduxState) {+ const { enabled: audioOnly } = state['features/base/audio-only'];++ return {+ _audioOnly: audioOnly+ };+}++export default translate(connect(_mapStateToProps)(VideoQualityLabel));diff --git a/react/features/video-quality/components/VideoQualityLabel.web.tsx b/react/features/video-quality/components/VideoQualityLabel.web.tsxindex b67e1d4cf3..fd7efacdf8 100644--- a/react/features/video-quality/components/VideoQualityLabel.web.tsx+++ b/react/features/video-quality/components/VideoQualityLabel.web.tsx@@ -1,116 +1,67 @@import React from 'react';-import { connect } from 'react-redux';+import { useTranslation } from 'react-i18next';+import { useDispatch, useSelector } from 'react-redux';-import { IReduxState, IStore } from '../../app/types';+import { IReduxState } from '../../app/types';import { openDialog } from '../../base/dialog/actions';-import { translate } from '../../base/i18n/functions';import { IconPerformance } from '../../base/icons/svg';import Label from '../../base/label/components/web/Label';import { COLORS } from '../../base/label/constants';import Tooltip from '../../base/tooltip/components/Tooltip';import { shouldDisplayTileView } from '../../video-layout/functions.web';-import AbstractVideoQualityLabel, {- IProps as AbstractProps,- _abstractMapStateToProps-} from './AbstractVideoQualityLabel';import VideoQualityDialog from './VideoQualityDialog.web';-interface IProps extends AbstractProps {-- /**- * The message to show within the label's tooltip.- */- _tooltipKey: string;-- /**- * Flag controlling visibility of the component.- */- _visible: boolean;-- /**- * The redux dispatch function.- */- dispatch: IStore['dispatch'];-}-/*** React {@code Component} responsible for displaying a label that indicates* the displayed video state of the current conference. {@code AudioOnlyLabel}* Will display when the conference is in audio only mode. {@code HDVideoLabel}* Will display if not in audio only mode and a high-definition large video is* being displayed.+ *+ * @returns {JSX}*/-export class VideoQualityLabel extends AbstractVideoQualityLabel<IProps> {-- /**- * Implements React's {@link Component#render()}.- *- * @inheritdoc- * @returns {ReactElement}- */- render() {- const {- _audioOnly,- _visible,- dispatch,- t- } = this.props;--- if (!_visible) {- return null;- }-- let className, icon, labelContent, tooltipKey;-- if (_audioOnly) {- className = 'audio-only';- labelContent = t('videoStatus.audioOnly');- tooltipKey = 'videoStatus.labelTooltipAudioOnly';- } else {- className = 'current-video-quality';- icon = IconPerformance;- tooltipKey = 'videoStatus.performanceSettings';- }+const VideoQualityLabel = () => {+ const _audioOnly = useSelector((state: IReduxState) => state['features/base/audio-only'].enabled);+ const _visible = useSelector((state: IReduxState) => !(shouldDisplayTileView(state)+ || interfaceConfig.VIDEO_QUALITY_LABEL_DISABLED));+ const dispatch = useDispatch();+ const { t } = useTranslation();++ if (!_visible) {+ return null;+ }- const onClick = () => dispatch(openDialog(VideoQualityDialog));+ let className, icon, labelContent, tooltipKey;- return (- <Tooltip- content = { t(tooltipKey) }- position = { 'bottom' }>- <Label- accessibilityText = { t(tooltipKey) }- className = { className }- color = { COLORS.white }- icon = { icon }- iconColor = '#fff'- id = 'videoResolutionLabel'- // eslint-disable-next-line react/jsx-no-bind- onClick = { onClick }- text = { labelContent } />- </Tooltip>- );+ if (_audioOnly) {+ className = 'audio-only';+ labelContent = t('videoStatus.audioOnly');+ tooltipKey = 'videoStatus.labelTooltipAudioOnly';+ } else {+ className = 'current-video-quality';+ icon = IconPerformance;+ tooltipKey = 'videoStatus.performanceSettings';}-}--/**- * Maps (parts of) the Redux state to the associated {@code VideoQualityLabel}'s- * props.- *- * @param {Object} state - The Redux state.- * @private- * @returns {{- * _audioOnly: boolean,- * _visible: boolean- * }}- */-function _mapStateToProps(state: IReduxState) {- return {- ..._abstractMapStateToProps(state),- _visible: !(shouldDisplayTileView(state) || interfaceConfig.VIDEO_QUALITY_LABEL_DISABLED)- };-}-export default translate(connect(_mapStateToProps)(VideoQualityLabel));+ const onClick = () => dispatch(openDialog(VideoQualityDialog));++ return (+ <Tooltip+ content = { t(tooltipKey) }+ position = { 'bottom' }>+ <Label+ accessibilityText = { t(tooltipKey) }+ className = { className }+ color = { COLORS.white }+ icon = { icon }+ iconColor = '#fff'+ id = 'videoResolutionLabel'+ // eslint-disable-next-line react/jsx-no-bind+ onClick = { onClick }+ text = { labelContent } />+ </Tooltip>+ );+};++export default VideoQualityLabel;