feat(transcriptions): add TranscribingLabel.native

This commit is contained in:
paweldomas 2018-08-16 14:34:26 -05:00 committed by Любомир Маринов
parent 6dea107bcd
commit 008fb868a6
5 changed files with 70 additions and 47 deletions

View File

@ -20,6 +20,11 @@ export type Props = {
*/ */
_filmstripVisible: boolean, _filmstripVisible: boolean,
/**
* Whether the video quality label should be displayed.
*/
_showTranscribingLabel: boolean,
/** /**
* Whether the video quality label should be displayed. * Whether the video quality label should be displayed.
*/ */
@ -66,9 +71,13 @@ export default class AbstractLabels<P: Props, S> extends Component<P, S> {
* @returns {React$Element} * @returns {React$Element}
*/ */
_renderTranscribingLabel() { _renderTranscribingLabel() {
return ( if (this.props._showTranscribingLabel) {
<TranscribingLabel /> return (
); <TranscribingLabel />
);
}
return null;
} }
/** /**
@ -92,12 +101,14 @@ export default class AbstractLabels<P: Props, S> extends Component<P, S> {
* @private * @private
* @returns {{ * @returns {{
* _filmstripVisible: boolean, * _filmstripVisible: boolean,
* _showTranscribingLabel: boolean,
* _showVideoQualityLabel: boolean * _showVideoQualityLabel: boolean
* }} * }}
*/ */
export function _abstractMapStateToProps(state: Object) { export function _abstractMapStateToProps(state: Object) {
return { return {
_filmstripVisible: isFilmstripVisible(state), _filmstripVisible: isFilmstripVisible(state),
_showTranscribingLabel: state['features/transcribing'].isTranscribing,
_showVideoQualityLabel: !shouldDisplayTileView(state) _showVideoQualityLabel: !shouldDisplayTileView(state)
}; };
} }

View File

@ -58,6 +58,9 @@ class Labels extends AbstractLabels<Props, *> {
this._renderRecordingLabel( this._renderRecordingLabel(
JitsiRecordingConstants.mode.STREAM) JitsiRecordingConstants.mode.STREAM)
} }
{
this._renderTranscribingLabel()
}
{/* {/*
* Emil, Lyubomir, Nichole, and Zoli said that the Labels * Emil, Lyubomir, Nichole, and Zoli said that the Labels
* should not be rendered in Picture-in-Picture. Saul argued * should not be rendered in Picture-in-Picture. Saul argued
@ -73,6 +76,8 @@ class Labels extends AbstractLabels<Props, *> {
_renderRecordingLabel: string => React$Element<*>; _renderRecordingLabel: string => React$Element<*>;
_renderTranscribingLabel: () => React$Element<*>
_renderVideoQualityLabel: () => React$Element<*>; _renderVideoQualityLabel: () => React$Element<*>;
} }

View File

@ -0,0 +1,12 @@
// @flow
/**
* The type of the React {@code Component} props of {@link TranscribingLabel}.
*/
export type Props = {
/**
* Invoked to obtain translated strings.
*/
t: Function
};

View File

@ -0,0 +1,31 @@
// @flow
import React, { Component } from 'react';
import { translate } from '../../base/i18n';
import { CircularLabel } from '../../base/label';
import { type Props } from './AbstractTranscribingLabel';
/**
* React {@code Component} for displaying a label when a transcriber is in the
* conference.
*
* @extends Component
*/
class TranscribingLabel extends Component<Props> {
/**
* Renders the platform-specific label component.
*
* @inheritdoc
*/
render() {
return (
<CircularLabel
label = { this.props.t('transcribing.tr') } />
);
}
}
export default translate(TranscribingLabel);

View File

@ -1,30 +1,15 @@
// @flow // @flow
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { translate } from '../../base/i18n/index';
import { CircularLabel } from '../../base/label/index';
import Tooltip from '@atlaskit/tooltip'; import Tooltip from '@atlaskit/tooltip';
import React, { Component } from 'react';
import { translate } from '../../base/i18n';
import { CircularLabel } from '../../base/label';
import { type Props } from './AbstractTranscribingLabel';
/** /**
* The type of the React {@code Component} props of {@link TranscribingLabel}. * React {@code Component} for displaying a label when a transcriber is in the
*/
type Props = {
/**
* Invoked to obtain translated strings.
*/
t: Function,
/**
* Boolean value indicating current transcribing status
*/
_transcribing: boolean
};
/**
* React Component for displaying a label when a transcriber is in the
* conference. * conference.
* *
* @extends Component * @extends Component
@ -38,10 +23,6 @@ class TranscribingLabel extends Component<Props> {
* @returns {ReactElement} * @returns {ReactElement}
*/ */
render() { render() {
if (!this.props._transcribing) {
return null;
}
return ( return (
<Tooltip <Tooltip
content = { this.props.t('transcribing.labelToolTip') } content = { this.props.t('transcribing.labelToolTip') }
@ -55,21 +36,4 @@ class TranscribingLabel extends Component<Props> {
} }
/** export default translate(TranscribingLabel);
* Maps (parts of) the Redux state to the associated props for the
* {@code TranscribingLabel} component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {{
* }}
*/
function _mapStateToProps(state) {
const { isTranscribing } = state['features/transcribing'];
return {
_transcribing: isTranscribing
};
}
export default translate(connect(_mapStateToProps)(TranscribingLabel));