/* global $, APP, interfaceConfig */ import React, { Component } from 'react'; import { connect as reactReduxConnect } from 'react-redux'; import { connect, disconnect } from '../../base/connection'; /** * For legacy reasons, inline style for display none. * @type {{display: string}} */ const DISPLAY_NONE_STYLE = { display: 'none' }; /** * Implements a React Component which renders initial conference layout */ class Conference extends Component { /** * Conference component's property types. * * @static */ static propTypes = { dispatch: React.PropTypes.func } /** * Until we don't rewrite UI using react components * we use UI.start from old app. Also method translates * component right after it has been mounted. * * @inheritdoc */ componentDidMount() { APP.UI.start(); // XXX Temporary solution until we add React translation. APP.translation.translateElement($('#videoconference_page')); this.props.dispatch(connect()); } /** * Disconnect from the conference when component will be * unmounted. * * @inheritdoc */ componentWillUnmount() { this.props.dispatch(disconnect()); } /** * Initializes Conference component instance. * * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ constructor(props) { super(props); const showBrandWatermark = interfaceConfig.SHOW_BRAND_WATERMARK; const showJitsiWatermark = interfaceConfig.SHOW_JITSI_WATERMARK; const showJitsiWatermarkForGuest = interfaceConfig.SHOW_WATERMARK_FOR_GUESTS; this.state = { ...this.state, showBrandWatermark, showJitsiWatermark, showJitsiWatermarkForGuest, brandWatermarkLink: showBrandWatermark ? interfaceConfig.BRAND_WATERMARK_LINK : '', jitsiWatermarkLink: showJitsiWatermark || showJitsiWatermarkForGuest ? interfaceConfig.JITSI_WATERMARK_LINK : '', showPoweredBy: interfaceConfig.SHOW_POWERED_BY }; } /** * Implements React's {@link Component#render()}. * * @inheritdoc * @returns {ReactElement} */ render() { return (
{ this._renderJitsiWatermark() } { this._renderBrandWatermark() } { this._renderPoweredBy() }
HD
); } /** * Method that returns brand watermark element if it is enabled. * * @returns {ReactElement|null} * @private */ _renderBrandWatermark() { if (this.state.showBrandWatermark) { return (
); } return null; } /** * Method that returns jitsi watermark element if it is enabled. * * @returns {ReactElement|null} * @private */ _renderJitsiWatermark() { if (this.state.showJitsiWatermark || (APP.tokenData.isGuest && this.state.showJitsiWatermarkForGuest)) { return (
); } return null; } /** * Renders powered by block if it is enabled. * * @returns {ReactElement|null} * @private */ _renderPoweredBy() { if (this.state.showPoweredBy) { return ( jitsi.org ); } return null; } } export default reactReduxConnect()(Conference);