Files
jitsi-meet/react/features/recording/components/RecordingLabel.native.js
2018-10-02 20:47:41 +02:00

66 lines
1.6 KiB
JavaScript

// @flow
import React from 'react';
import { connect } from 'react-redux';
import { translate } from '../../base/i18n';
import { CircularLabel } from '../../base/label';
import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
import AbstractRecordingLabel, {
_mapStateToProps
} from './AbstractRecordingLabel';
import styles from './styles';
/**
* Implements a React {@link Component} which displays the current state of
* conference recording.
*
* @extends {Component}
*/
class RecordingLabel extends AbstractRecordingLabel {
/**
* Renders the platform specific label component.
*
* @inheritdoc
*/
_renderLabel() {
let indicatorStyle;
switch (this.props.mode) {
case JitsiRecordingConstants.mode.STREAM:
indicatorStyle = styles.indicatorLive;
break;
case JitsiRecordingConstants.mode.FILE:
indicatorStyle = styles.indicatorRecording;
break;
default:
// Invalid mode is passed to the component.
return null;
}
let status = 'on';
switch (this.props._status) {
case JitsiRecordingConstants.status.PENDING:
status = 'in_progress';
break;
case JitsiRecordingConstants.status.OFF:
status = 'off';
break;
}
return (
<CircularLabel
label = { this.props.t(this._getLabelKey()) }
status = { status }
style = { indicatorStyle } />
);
}
_getLabelKey: () => ?string
}
export default translate(connect(_mapStateToProps)(RecordingLabel));