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 { withRoomContext } from '../../RoomContext'; 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 { roomClient, toolbarsVisible, me, screenProducer, locked } = this.props; let screenState; let screenTip; let lockState = 'unlocked'; 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'; } if (locked) { lockState = 'locked'; } return (