import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import classnames from 'classnames'; import * as appPropTypes from './appPropTypes'; import * as requestActions from '../redux/requestActions'; import FullScreen from './FullScreen'; class Sidebar extends Component { constructor(props) { super(props); this.fullscreen = new FullScreen(document); this.state = { fullscreen : false }; } handleToggleFullscreen = () => { if (this.fullscreen.fullscreenElement) { this.fullscreen.exitFullscreen(); } else { this.fullscreen.requestFullscreen(document.documentElement); } }; handleFullscreenChange = () => { this.setState({ fullscreen : this.fullscreen.fullscreenElement !== null }); }; componentDidMount() { if (this.fullscreen.fullscreenEnabled) { this.fullscreen.addEventListener('fullscreenchange', this.handleFullscreenChange); } } componentWillUnmount() { if (this.fullscreen.fullscreenEnabled) { this.fullscreen.removeEventListener('fullscreenchange', this.handleFullscreenChange); } } render() { const { toolbarsVisible, me, screenProducer, onLogin, onShareScreen, onUnShareScreen, onNeedExtension, onLeaveMeeting, onLogout, onToggleHand } = this.props; let screenState; let screenTip; if (me.needExtension) { screenState = 'need-extension'; screenTip = 'Install screen sharing extension'; } else if (!me.canShareScreen) { screenState = 'unsupported'; screenTip = 'Screen sharing not supported'; } else if (screenProducer) { screenState = 'on'; screenTip = 'Stop screen sharing'; } else { screenState = 'off'; screenTip = 'Start screen sharing'; } return (