diff --git a/react/features/large-video/components/AbstractLabels.js b/react/features/large-video/components/AbstractLabels.js index 75b660e52..a23df84a0 100644 --- a/react/features/large-video/components/AbstractLabels.js +++ b/react/features/large-video/components/AbstractLabels.js @@ -20,11 +20,6 @@ export type Props = { */ _filmstripVisible: boolean, - /** - * Whether the video quality label should be displayed. - */ - _showTranscribingLabel: boolean, - /** * Whether the video quality label should be displayed. */ @@ -71,13 +66,9 @@ export default class AbstractLabels extends Component { * @returns {React$Element} */ _renderTranscribingLabel() { - if (this.props._showTranscribingLabel) { - return ( - - ); - } - - return null; + return ( + + ); } /** @@ -101,14 +92,12 @@ export default class AbstractLabels extends Component { * @private * @returns {{ * _filmstripVisible: boolean, - * _showTranscribingLabel: boolean, * _showVideoQualityLabel: boolean * }} */ export function _abstractMapStateToProps(state: Object) { return { _filmstripVisible: isFilmstripVisible(state), - _showTranscribingLabel: state['features/transcribing'].isTranscribing, _showVideoQualityLabel: !shouldDisplayTileView(state) }; } diff --git a/react/features/transcribing/components/AbstractTranscribingLabel.js b/react/features/transcribing/components/AbstractTranscribingLabel.js index 0f3680df8..f586167c4 100644 --- a/react/features/transcribing/components/AbstractTranscribingLabel.js +++ b/react/features/transcribing/components/AbstractTranscribingLabel.js @@ -5,8 +5,29 @@ */ export type Props = { + /** + * 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: Object) { + return { + _showLabel: state['features/transcribing'].isTranscribing + }; +} diff --git a/react/features/transcribing/components/TranscribingLabel.native.js b/react/features/transcribing/components/TranscribingLabel.native.js index 6fa3254f8..27e8d63f9 100644 --- a/react/features/transcribing/components/TranscribingLabel.native.js +++ b/react/features/transcribing/components/TranscribingLabel.native.js @@ -1,11 +1,12 @@ // @flow import React, { Component } from 'react'; +import { connect } from 'react-redux'; import { translate } from '../../base/i18n'; import { CircularLabel } from '../../base/label'; -import { type Props } from './AbstractTranscribingLabel'; +import { _mapStateToProps, type Props } from './AbstractTranscribingLabel'; /** * React {@code Component} for displaying a label when a transcriber is in the @@ -21,6 +22,10 @@ class TranscribingLabel extends Component { * @inheritdoc */ render() { + if (!this.props._showLabel) { + return null; + } + return ( @@ -28,4 +33,4 @@ class TranscribingLabel extends Component { } } -export default translate(TranscribingLabel); +export default translate(connect(_mapStateToProps)(TranscribingLabel)); diff --git a/react/features/transcribing/components/TranscribingLabel.web.js b/react/features/transcribing/components/TranscribingLabel.web.js index 7296f840f..e77b987a9 100644 --- a/react/features/transcribing/components/TranscribingLabel.web.js +++ b/react/features/transcribing/components/TranscribingLabel.web.js @@ -2,11 +2,12 @@ import Tooltip from '@atlaskit/tooltip'; import React, { Component } from 'react'; +import { connect } from 'react-redux'; import { translate } from '../../base/i18n'; import { CircularLabel } from '../../base/label'; -import { type Props } from './AbstractTranscribingLabel'; +import { _mapStateToProps, type Props } from './AbstractTranscribingLabel'; /** * React {@code Component} for displaying a label when a transcriber is in the @@ -23,6 +24,10 @@ class TranscribingLabel extends Component { * @returns {ReactElement} */ render() { + if (!this.props._showLabel) { + return null; + } + return ( { } -export default translate(TranscribingLabel); +export default translate(connect(_mapStateToProps)(TranscribingLabel));