| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314 | 
							- // @flow
 - 
 - import React, { Component } from 'react';
 - 
 - import {
 -     ACTION_SHORTCUT_TRIGGERED,
 -     createShortcutEvent,
 -     createToolbarEvent,
 -     sendAnalytics
 - } from '../../../analytics';
 - import { openDialog, toggleDialog } from '../../../base/dialog';
 - import { translate } from '../../../base/i18n';
 - import {
 -     IconChat,
 -     IconExitFullScreen,
 -     IconFeedback,
 -     IconFullScreen,
 -     IconInvite,
 -     IconOpenInNew,
 -     IconPresentation,
 -     IconRaisedHand,
 -     IconRec,
 -     IconShareDesktop,
 -     IconShareVideo
 - } from '../../../base/icons';
 - import {
 -     getLocalParticipant,
 -     getParticipants,
 -     participantUpdated
 - } from '../../../base/participants';
 - import { connect } from '../../../base/redux';
 - import { OverflowMenuItem } from '../../../base/toolbox';
 - import { getLocalVideoTrack, toggleScreensharing } from '../../../base/tracks';
 - import { VideoBlurButton } from '../../../blur';
 - import { ChatCounter, toggleChat } from '../../../chat';
 - import { SharedDocumentButton } from '../../../etherpad';
 - import { openFeedbackDialog } from '../../../feedback';
 - import {
 -     beginAddPeople,
 -     InfoDialogButton,
 -     isAddPeopleEnabled,
 -     isDialOutEnabled
 - } from '../../../invite';
 - import { openKeyboardShortcutsDialog } from '../../../keyboard-shortcuts';
 - import {
 -     LocalRecordingButton,
 -     LocalRecordingInfoDialog
 - } from '../../../local-recording';
 - import {
 -     LiveStreamButton,
 -     RecordButton
 - } from '../../../recording';
 - import {
 -     SETTINGS_TABS,
 -     SettingsButton,
 -     openSettingsDialog
 - } from '../../../settings';
 - import { toggleSharedVideo } from '../../../shared-video';
 - import { SpeakerStats } from '../../../speaker-stats';
 - import { TileViewButton } from '../../../video-layout';
 - import {
 -     OverflowMenuVideoQualityItem,
 -     VideoQualityDialog
 - } from '../../../video-quality';
 - 
 - import {
 -     setFullScreen,
 -     setOverflowMenuVisible,
 -     setToolbarHovered
 - } from '../../actions';
 - import AudioMuteButton from '../AudioMuteButton';
 - import DownloadButton from '../DownloadButton';
 - import { isToolboxVisible } from '../../functions';
 - import HangupButton from '../HangupButton';
 - import HelpButton from '../HelpButton';
 - import OverflowMenuButton from './OverflowMenuButton';
 - import OverflowMenuProfileItem from './OverflowMenuProfileItem';
 - import ToolbarButton from './ToolbarButton';
 - import VideoMuteButton from '../VideoMuteButton';
 - import {
 -     ClosedCaptionButton
 - } from '../../../subtitles';
 - 
 - /**
 -  * The type of the React {@code Component} props of {@link Toolbox}.
 -  */
 - type Props = {
 - 
 -     /**
 -      * Whether or not the chat feature is currently displayed.
 -      */
 -     _chatOpen: boolean,
 - 
 -     /**
 -      * The {@code JitsiConference} for the current conference.
 -      */
 -     _conference: Object,
 - 
 -     /**
 -      * The tooltip key to use when screensharing is disabled. Or undefined
 -      * if non to be shown and the button to be hidden.
 -      */
 -     _desktopSharingDisabledTooltipKey: boolean,
 - 
 -     /**
 -      * Whether or not screensharing is initialized.
 -      */
 -     _desktopSharingEnabled: boolean,
 - 
 -     /**
 -      * Whether or not a dialog is displayed.
 -      */
 -     _dialog: boolean,
 - 
 -     /**
 -      * Whether or not call feedback can be sent.
 -      */
 -     _feedbackConfigured: boolean,
 - 
 -     /**
 -      * Whether or not the app is currently in full screen.
 -      */
 -     _fullScreen: boolean,
 - 
 -     /**
 -      * Whether or not invite should be hidden, regardless of feature
 -      * availability.
 -      */
 -     _hideInviteButton: boolean,
 - 
 -     /**
 -      * Whether or not the current user is logged in through a JWT.
 -      */
 -     _isGuest: boolean,
 - 
 -     /**
 -      * The ID of the local participant.
 -      */
 -     _localParticipantID: String,
 - 
 -     /**
 -      * The subsection of Redux state for local recording
 -      */
 -     _localRecState: Object,
 - 
 -     /**
 -      * Whether or not the overflow menu is visible.
 -      */
 -     _overflowMenuVisible: boolean,
 - 
 -     /**
 -      * Whether or not the local participant's hand is raised.
 -      */
 -     _raisedHand: boolean,
 - 
 -     /**
 -      * Whether or not the local participant is screensharing.
 -      */
 -     _screensharing: boolean,
 - 
 -     /**
 -      * Whether or not the local participant is sharing a YouTube video.
 -      */
 -     _sharingVideo: boolean,
 - 
 -     /**
 -      * Flag showing whether toolbar is visible.
 -      */
 -     _visible: boolean,
 - 
 -     /**
 -      * Set with the buttons which this Toolbox should display.
 -      */
 -     _visibleButtons: Set<string>,
 - 
 -     /**
 -      * Invoked to active other features of the app.
 -      */
 -     dispatch: Function,
 - 
 -     /**
 -      * Invoked to obtain translated strings.
 -      */
 -     t: Function
 - };
 - 
 - /**
 -  * The type of the React {@code Component} state of {@link Toolbox}.
 -  */
 - type State = {
 - 
 -     /**
 -      * The width of the browser's window.
 -      */
 -     windowWidth: number
 - };
 - 
 - declare var APP: Object;
 - declare var interfaceConfig: Object;
 - 
 - /**
 -  * Implements the conference toolbox on React/Web.
 -  *
 -  * @extends Component
 -  */
 - class Toolbox extends Component<Props, State> {
 -     /**
 -      * Initializes a new {@code Toolbox} instance.
 -      *
 -      * @param {Props} props - The read-only React {@code Component} props with
 -      * which the new instance is to be initialized.
 -      */
 -     constructor(props: Props) {
 -         super(props);
 - 
 -         // Bind event handlers so they are only bound once per instance.
 -         this._onMouseOut = this._onMouseOut.bind(this);
 -         this._onMouseOver = this._onMouseOver.bind(this);
 -         this._onResize = this._onResize.bind(this);
 -         this._onSetOverflowVisible = this._onSetOverflowVisible.bind(this);
 - 
 -         this._onShortcutToggleChat = this._onShortcutToggleChat.bind(this);
 -         this._onShortcutToggleFullScreen = this._onShortcutToggleFullScreen.bind(this);
 -         this._onShortcutToggleRaiseHand = this._onShortcutToggleRaiseHand.bind(this);
 -         this._onShortcutToggleScreenshare = this._onShortcutToggleScreenshare.bind(this);
 -         this._onShortcutToggleVideoQuality = this._onShortcutToggleVideoQuality.bind(this);
 -         this._onToolbarOpenFeedback = this._onToolbarOpenFeedback.bind(this);
 -         this._onToolbarOpenInvite = this._onToolbarOpenInvite.bind(this);
 -         this._onToolbarOpenKeyboardShortcuts = this._onToolbarOpenKeyboardShortcuts.bind(this);
 -         this._onToolbarOpenSpeakerStats = this._onToolbarOpenSpeakerStats.bind(this);
 -         this._onToolbarOpenVideoQuality = this._onToolbarOpenVideoQuality.bind(this);
 -         this._onToolbarToggleChat = this._onToolbarToggleChat.bind(this);
 -         this._onToolbarToggleFullScreen = this._onToolbarToggleFullScreen.bind(this);
 -         this._onToolbarToggleProfile = this._onToolbarToggleProfile.bind(this);
 -         this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);
 -         this._onToolbarToggleScreenshare = this._onToolbarToggleScreenshare.bind(this);
 -         this._onToolbarToggleSharedVideo = this._onToolbarToggleSharedVideo.bind(this);
 -         this._onToolbarOpenLocalRecordingInfoDialog = this._onToolbarOpenLocalRecordingInfoDialog.bind(this);
 - 
 -         this.state = {
 -             windowWidth: window.innerWidth
 -         };
 -     }
 - 
 -     /**
 -      * Sets keyboard shortcuts for to trigger ToolbarButtons actions.
 -      *
 -      * @inheritdoc
 -      * @returns {void}
 -      */
 -     componentDidMount() {
 -         const KEYBOARD_SHORTCUTS = [
 -             this._shouldShowButton('videoquality') && {
 -                 character: 'A',
 -                 exec: this._onShortcutToggleVideoQuality,
 -                 helpDescription: 'keyboardShortcuts.videoQuality'
 -             },
 -             this._shouldShowButton('chat') && {
 -                 character: 'C',
 -                 exec: this._onShortcutToggleChat,
 -                 helpDescription: 'keyboardShortcuts.toggleChat'
 -             },
 -             this._shouldShowButton('desktop') && {
 -                 character: 'D',
 -                 exec: this._onShortcutToggleScreenshare,
 -                 helpDescription: 'keyboardShortcuts.toggleScreensharing'
 -             },
 -             this._shouldShowButton('raisehand') && {
 -                 character: 'R',
 -                 exec: this._onShortcutToggleRaiseHand,
 -                 helpDescription: 'keyboardShortcuts.raiseHand'
 -             },
 -             this._shouldShowButton('fullscreen') && {
 -                 character: 'S',
 -                 exec: this._onShortcutToggleFullScreen,
 -                 helpDescription: 'keyboardShortcuts.fullScreen'
 -             }
 -         ];
 - 
 -         KEYBOARD_SHORTCUTS.forEach(shortcut => {
 -             if (typeof shortcut === 'object') {
 -                 APP.keyboardshortcut.registerShortcut(
 -                     shortcut.character,
 -                     null,
 -                     shortcut.exec,
 -                     shortcut.helpDescription);
 -             }
 -         });
 - 
 -         window.addEventListener('resize', this._onResize);
 -     }
 - 
 -     /**
 -      * Update the visibility of the {@code OverflowMenuButton}.
 -      *
 -      * @inheritdoc
 -      */
 -     componentDidUpdate(prevProps) {
 -         // Ensure the dialog is closed when the toolbox becomes hidden.
 -         if (prevProps._overflowMenuVisible && !this.props._visible) {
 -             this._onSetOverflowVisible(false);
 -         }
 - 
 -         if (prevProps._overflowMenuVisible
 -             && !prevProps._dialog
 -             && this.props._dialog) {
 -             this._onSetOverflowVisible(false);
 -             this.props.dispatch(setToolbarHovered(false));
 -         }
 -     }
 - 
 -     /**
 -      * Removes keyboard shortcuts registered by this component.
 -      *
 -      * @inheritdoc
 -      * @returns {void}
 -      */
 -     componentWillUnmount() {
 -         [ 'A', 'C', 'D', 'R', 'S' ].forEach(letter =>
 -             APP.keyboardshortcut.unregisterShortcut(letter));
 - 
 -         window.removeEventListener('resize', this._onResize);
 -     }
 - 
 -     /**
 -      * Implements React's {@link Component#render()}.
 -      *
 -      * @inheritdoc
 -      * @returns {ReactElement}
 -      */
 -     render() {
 -         const { _visible, _visibleButtons } = this.props;
 -         const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
 -             _visibleButtons.size ? '' : 'no-buttons'}`;
 - 
 -         return (
 -             <div
 -                 className = { rootClassNames }
 -                 id = 'new-toolbox'
 -                 onMouseOut = { this._onMouseOut }
 -                 onMouseOver = { this._onMouseOver }>
 -                 <div className = 'toolbox-background' />
 -                 { this._renderToolboxContent() }
 -             </div>
 -         );
 -     }
 - 
 -     /**
 -      * Callback invoked to display {@code FeedbackDialog}.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doOpenFeedback() {
 -         const { _conference } = this.props;
 - 
 -         this.props.dispatch(openFeedbackDialog(_conference));
 -     }
 - 
 -     /**
 -      * Dispatches an action to display {@code KeyboardShortcuts}.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doOpenKeyboardShorcuts() {
 -         this.props.dispatch(openKeyboardShortcutsDialog());
 -     }
 - 
 -     /**
 -      * Callback invoked to display {@code SpeakerStats}.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doOpenSpeakerStats() {
 -         this.props.dispatch(openDialog(SpeakerStats, {
 -             conference: this.props._conference
 -         }));
 -     }
 - 
 -     /**
 -      * Dispatches an action to open the video quality dialog.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doOpenVideoQuality() {
 -         this.props.dispatch(openDialog(VideoQualityDialog));
 -     }
 - 
 -     /**
 -      * Dispatches an action to toggle the display of chat.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleChat() {
 -         this.props.dispatch(toggleChat());
 -     }
 - 
 -     /**
 -      * Dispatches an action to toggle screensharing.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleFullScreen() {
 -         const fullScreen = !this.props._fullScreen;
 - 
 -         this.props.dispatch(setFullScreen(fullScreen));
 -     }
 - 
 -     /**
 -      * Dispatches an action to show or hide the profile edit panel.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleProfile() {
 -         this.props.dispatch(openSettingsDialog(SETTINGS_TABS.PROFILE));
 -     }
 - 
 -     /**
 -      * Dispatches an action to toggle the local participant's raised hand state.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleRaiseHand() {
 -         const { _localParticipantID, _raisedHand } = this.props;
 - 
 -         this.props.dispatch(participantUpdated({
 -             // XXX Only the local participant is allowed to update without
 -             // stating the JitsiConference instance (i.e. participant property
 -             // `conference` for a remote participant) because the local
 -             // participant is uniquely identified by the very fact that there is
 -             // only one local participant.
 - 
 -             id: _localParticipantID,
 -             local: true,
 -             raisedHand: !_raisedHand
 -         }));
 -     }
 - 
 -     /**
 -      * Dispatches an action to toggle screensharing.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleScreenshare() {
 -         if (this.props._desktopSharingEnabled) {
 -             this.props.dispatch(toggleScreensharing());
 -         }
 -     }
 - 
 -     /**
 -      * Dispatches an action to toggle YouTube video sharing.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleSharedVideo() {
 -         this.props.dispatch(toggleSharedVideo());
 -     }
 - 
 -     /**
 -      * Dispatches an action to toggle the video quality dialog.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _doToggleVideoQuality() {
 -         this.props.dispatch(toggleDialog(VideoQualityDialog));
 -     }
 - 
 -     _onMouseOut: () => void;
 - 
 -     /**
 -      * Dispatches an action signaling the toolbar is not being hovered.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onMouseOut() {
 -         this.props.dispatch(setToolbarHovered(false));
 -     }
 - 
 -     _onMouseOver: () => void;
 - 
 -     /**
 -      * Dispatches an action signaling the toolbar is being hovered.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onMouseOver() {
 -         this.props.dispatch(setToolbarHovered(true));
 -     }
 - 
 -     _onResize: () => void;
 - 
 -     /**
 -      * A window resize handler used to calculate the number of buttons we can
 -      * fit in the toolbar.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onResize() {
 -         const width = window.innerWidth;
 - 
 -         if (this.state.windowWidth !== width) {
 -             this.setState({ windowWidth: width });
 -         }
 -     }
 - 
 - 
 -     _onSetOverflowVisible: (boolean) => void;
 - 
 -     /**
 -      * Sets the visibility of the overflow menu.
 -      *
 -      * @param {boolean} visible - Whether or not the overflow menu should be
 -      * displayed.
 -      * @private
 -      * @returns {void}
 -      */
 -     _onSetOverflowVisible(visible) {
 -         this.props.dispatch(setOverflowMenuVisible(visible));
 -     }
 - 
 -     _onShortcutToggleChat: () => void;
 - 
 -     /**
 -      * Creates an analytics keyboard shortcut event and dispatches an action for
 -      * toggling the display of chat.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onShortcutToggleChat() {
 -         sendAnalytics(createShortcutEvent(
 -             'toggle.chat',
 -             {
 -                 enable: !this.props._chatOpen
 -             }));
 - 
 -         this._doToggleChat();
 -     }
 - 
 -     _onShortcutToggleVideoQuality: () => void;
 - 
 -     /**
 -     * Creates an analytics keyboard shortcut event and dispatches an action for
 -     * toggling the display of Video Quality.
 -     *
 -     * @private
 -     * @returns {void}
 -     */
 -     _onShortcutToggleVideoQuality() {
 -         sendAnalytics(createShortcutEvent('video.quality'));
 - 
 -         this._doToggleVideoQuality();
 -     }
 - 
 -     _onShortcutToggleFullScreen: () => void;
 - 
 -     /**
 -      * Creates an analytics keyboard shortcut event and dispatches an action for
 -      * toggling full screen mode.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onShortcutToggleFullScreen() {
 -         sendAnalytics(createShortcutEvent(
 -             'toggle.fullscreen',
 -             {
 -                 enable: !this.props._fullScreen
 -             }));
 - 
 -         this._doToggleFullScreen();
 -     }
 - 
 -     _onShortcutToggleRaiseHand: () => void;
 - 
 -     /**
 -      * Creates an analytics keyboard shortcut event and dispatches an action for
 -      * toggling raise hand.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onShortcutToggleRaiseHand() {
 -         sendAnalytics(createShortcutEvent(
 -             'toggle.raise.hand',
 -             ACTION_SHORTCUT_TRIGGERED,
 -             { enable: !this.props._raisedHand }));
 - 
 -         this._doToggleRaiseHand();
 -     }
 - 
 -     _onShortcutToggleScreenshare: () => void;
 - 
 -     /**
 -      * Creates an analytics keyboard shortcut event and dispatches an action for
 -      * toggling screensharing.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onShortcutToggleScreenshare() {
 -         sendAnalytics(createToolbarEvent(
 -             'screen.sharing',
 -             {
 -                 enable: !this.props._screensharing
 -             }));
 - 
 -         this._doToggleScreenshare();
 -     }
 - 
 -     _onToolbarOpenFeedback: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * display of feedback.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarOpenFeedback() {
 -         sendAnalytics(createToolbarEvent('feedback'));
 - 
 -         this._doOpenFeedback();
 -     }
 - 
 -     _onToolbarOpenInvite: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for opening
 -      * the modal for inviting people directly into the conference.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarOpenInvite() {
 -         sendAnalytics(createToolbarEvent('invite'));
 -         this.props.dispatch(beginAddPeople());
 -     }
 - 
 -     _onToolbarOpenKeyboardShortcuts: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for opening
 -      * the modal for showing available keyboard shortcuts.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarOpenKeyboardShortcuts() {
 -         sendAnalytics(createToolbarEvent('shortcuts'));
 - 
 -         this._doOpenKeyboardShorcuts();
 -     }
 - 
 -     _onToolbarOpenSpeakerStats: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for opening
 -      * the speaker stats modal.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarOpenSpeakerStats() {
 -         sendAnalytics(createToolbarEvent('speaker.stats'));
 - 
 -         this._doOpenSpeakerStats();
 -     }
 - 
 -     _onToolbarOpenVideoQuality: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * open the video quality dialog.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarOpenVideoQuality() {
 -         sendAnalytics(createToolbarEvent('video.quality'));
 - 
 -         this._doOpenVideoQuality();
 -     }
 - 
 -     _onToolbarToggleChat: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * the display of chat.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarToggleChat() {
 -         sendAnalytics(createToolbarEvent(
 -             'toggle.chat',
 -             {
 -                 enable: !this.props._chatOpen
 -             }));
 - 
 -         this._doToggleChat();
 -     }
 - 
 -     _onToolbarToggleFullScreen: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * full screen mode.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarToggleFullScreen() {
 -         sendAnalytics(createToolbarEvent(
 -             'toggle.fullscreen',
 -                 {
 -                     enable: !this.props._fullScreen
 -                 }));
 - 
 -         this._doToggleFullScreen();
 -     }
 - 
 -     _onToolbarToggleProfile: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for showing
 -      * or hiding the profile edit panel.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarToggleProfile() {
 -         sendAnalytics(createToolbarEvent('profile'));
 - 
 -         this._doToggleProfile();
 -     }
 - 
 -     _onToolbarToggleRaiseHand: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * raise hand.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarToggleRaiseHand() {
 -         sendAnalytics(createToolbarEvent(
 -             'raise.hand',
 -             { enable: !this.props._raisedHand }));
 - 
 -         this._doToggleRaiseHand();
 -     }
 - 
 -     _onToolbarToggleScreenshare: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * screensharing.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarToggleScreenshare() {
 -         if (!this.props._desktopSharingEnabled) {
 -             return;
 -         }
 - 
 -         sendAnalytics(createShortcutEvent(
 -             'toggle.screen.sharing',
 -             ACTION_SHORTCUT_TRIGGERED,
 -             { enable: !this.props._screensharing }));
 - 
 -         this._doToggleScreenshare();
 -     }
 - 
 -     _onToolbarToggleSharedVideo: () => void;
 - 
 -     /**
 -      * Creates an analytics toolbar event and dispatches an action for toggling
 -      * the sharing of a YouTube video.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarToggleSharedVideo() {
 -         sendAnalytics(createToolbarEvent('shared.video.toggled',
 -             {
 -                 enable: !this.props._sharingVideo
 -             }));
 - 
 -         this._doToggleSharedVideo();
 -     }
 - 
 -     _onToolbarOpenLocalRecordingInfoDialog: () => void;
 - 
 -     /**
 -      * Opens the {@code LocalRecordingInfoDialog}.
 -      *
 -      * @private
 -      * @returns {void}
 -      */
 -     _onToolbarOpenLocalRecordingInfoDialog() {
 -         sendAnalytics(createToolbarEvent('local.recording'));
 - 
 -         this.props.dispatch(openDialog(LocalRecordingInfoDialog));
 -     }
 - 
 -     /**
 -      * Returns true if the the desktop sharing button should be visible and
 -      * false otherwise.
 -      *
 -      * @returns {boolean}
 -      */
 -     _isDesktopSharingButtonVisible() {
 -         const {
 -             _desktopSharingEnabled,
 -             _desktopSharingDisabledTooltipKey
 -         } = this.props;
 - 
 -         return _desktopSharingEnabled || _desktopSharingDisabledTooltipKey;
 -     }
 - 
 -     /**
 -      * Renders a button for toggleing screen sharing.
 -      *
 -      * @private
 -      * @param {boolean} isInOverflowMenu - True if the button is moved to the
 -      * overflow menu.
 -      * @returns {ReactElement|null}
 -      */
 -     _renderDesktopSharingButton(isInOverflowMenu = false) {
 -         const {
 -             _desktopSharingEnabled,
 -             _desktopSharingDisabledTooltipKey,
 -             _screensharing,
 -             t
 -         } = this.props;
 - 
 -         if (!this._isDesktopSharingButtonVisible()) {
 -             return null;
 -         }
 - 
 -         if (isInOverflowMenu) {
 -             return (
 -                 <OverflowMenuItem
 -                     accessibilityLabel
 -                         = { t('toolbar.accessibilityLabel.shareYourScreen') }
 -                     disabled = { _desktopSharingEnabled }
 -                     icon = { IconShareDesktop }
 -                     iconId = 'share-desktop'
 -                     key = 'desktop'
 -                     onClick = { this._onToolbarToggleScreenshare }
 -                     text = {
 -                         t(`toolbar.${
 -                             _screensharing
 -                                 ? 'stopScreenSharing' : 'startScreenSharing'}`
 -                         )
 -                     } />
 -             );
 -         }
 - 
 -         const tooltip = t(
 -             _desktopSharingEnabled
 -                 ? 'dialog.shareYourScreen' : _desktopSharingDisabledTooltipKey);
 - 
 -         return (
 -             <ToolbarButton
 -                 accessibilityLabel
 -                     = { t('toolbar.accessibilityLabel.shareYourScreen') }
 -                 disabled = { !_desktopSharingEnabled }
 -                 icon = { IconShareDesktop }
 -                 onClick = { this._onToolbarToggleScreenshare }
 -                 toggled = { _screensharing }
 -                 tooltip = { tooltip } />
 -         );
 -     }
 - 
 -     /**
 -      * Returns true if the profile button is visible and false otherwise.
 -      *
 -      * @returns {boolean}
 -      */
 -     _isProfileVisible() {
 -         return this.props._isGuest && this._shouldShowButton('profile');
 -     }
 - 
 -     /**
 -      * Renders the list elements of the overflow menu.
 -      *
 -      * @private
 -      * @returns {Array<ReactElement>}
 -      */
 -     _renderOverflowMenuContent() {
 -         const {
 -             _feedbackConfigured,
 -             _fullScreen,
 -             _screensharing,
 -             _sharingVideo,
 -             t
 -         } = this.props;
 - 
 -         return [
 -             this._isProfileVisible()
 -                 && <OverflowMenuProfileItem
 -                     key = 'profile'
 -                     onClick = { this._onToolbarToggleProfile } />,
 -             this._shouldShowButton('videoquality')
 -                 && <OverflowMenuVideoQualityItem
 -                     key = 'videoquality'
 -                     onClick = { this._onToolbarOpenVideoQuality } />,
 -             this._shouldShowButton('fullscreen')
 -                 && <OverflowMenuItem
 -                     accessibilityLabel = { t('toolbar.accessibilityLabel.fullScreen') }
 -                     icon = { _fullScreen ? IconExitFullScreen : IconFullScreen }
 -                     key = 'fullscreen'
 -                     onClick = { this._onToolbarToggleFullScreen }
 -                     text = { _fullScreen ? t('toolbar.exitFullScreen') : t('toolbar.enterFullScreen') } />,
 -             <LiveStreamButton
 -                 key = 'livestreaming'
 -                 showLabel = { true } />,
 -             <RecordButton
 -                 key = 'record'
 -                 showLabel = { true } />,
 -             this._shouldShowButton('sharedvideo')
 -                 && <OverflowMenuItem
 -                     accessibilityLabel = { t('toolbar.accessibilityLabel.sharedvideo') }
 -                     icon = { IconShareVideo }
 -                     key = 'sharedvideo'
 -                     onClick = { this._onToolbarToggleSharedVideo }
 -                     text = { _sharingVideo ? t('toolbar.stopSharedVideo') : t('toolbar.sharedvideo') } />,
 -             this._shouldShowButton('etherpad')
 -                 && <SharedDocumentButton
 -                     key = 'etherpad'
 -                     showLabel = { true } />,
 -             <VideoBlurButton
 -                 key = 'videobackgroundblur'
 -                 showLabel = { true }
 -                 visible = { this._shouldShowButton('videobackgroundblur') && !_screensharing } />,
 -             <SettingsButton
 -                 key = 'settings'
 -                 showLabel = { true }
 -                 visible = { this._shouldShowButton('settings') } />,
 -             this._shouldShowButton('stats')
 -                 && <OverflowMenuItem
 -                     accessibilityLabel = { t('toolbar.accessibilityLabel.speakerStats') }
 -                     icon = { IconPresentation }
 -                     key = 'stats'
 -                     onClick = { this._onToolbarOpenSpeakerStats }
 -                     text = { t('toolbar.speakerStats') } />,
 -             this._shouldShowButton('feedback')
 -                 && _feedbackConfigured
 -                 && <OverflowMenuItem
 -                     accessibilityLabel = { t('toolbar.accessibilityLabel.feedback') }
 -                     icon = { IconFeedback }
 -                     key = 'feedback'
 -                     onClick = { this._onToolbarOpenFeedback }
 -                     text = { t('toolbar.feedback') } />,
 -             this._shouldShowButton('shortcuts')
 -                 && <OverflowMenuItem
 -                     accessibilityLabel = { t('toolbar.accessibilityLabel.shortcuts') }
 -                     icon = { IconOpenInNew }
 -                     key = 'shortcuts'
 -                     onClick = { this._onToolbarOpenKeyboardShortcuts }
 -                     text = { t('toolbar.shortcuts') } />,
 -             this._shouldShowButton('download')
 -                 && <DownloadButton
 -                     key = 'download'
 -                     showLabel = { true } />,
 -             this._shouldShowButton('help')
 -                 && <HelpButton
 -                     key = 'help'
 -                     showLabel = { true } />
 -         ];
 -     }
 - 
 -     /**
 -      * Renders a list of buttons that are moved to the overflow menu.
 -      *
 -      * @private
 -      * @param {Array<string>} movedButtons - The names of the buttons to be
 -      * moved.
 -      * @returns {Array<ReactElement>}
 -      */
 -     _renderMovedButtons(movedButtons) {
 -         const {
 -             _chatOpen,
 -             _raisedHand,
 -             t
 -         } = this.props;
 - 
 -         return movedButtons.map(buttonName => {
 -             switch (buttonName) {
 -             case 'desktop':
 -                 return this._renderDesktopSharingButton(true);
 -             case 'raisehand':
 -                 return (
 -                     <OverflowMenuItem
 -                         accessibilityLabel =
 -                             { t('toolbar.accessibilityLabel.raiseHand') }
 -                         icon = { IconRaisedHand }
 -                         key = 'raisedHand'
 -                         onClick = { this._onToolbarToggleRaiseHand }
 -                         text = {
 -                             t(`toolbar.${
 -                                 _raisedHand
 -                                     ? 'lowerYourHand' : 'raiseYourHand'}`
 -                             )
 -                         } />
 -                 );
 -             case 'chat':
 -                 return (
 -                     <OverflowMenuItem
 -                         accessibilityLabel =
 -                             { t('toolbar.accessibilityLabel.chat') }
 -                         icon = { IconChat }
 -                         key = 'chat'
 -                         onClick = { this._onToolbarToggleChat }
 -                         text = {
 -                             t(`toolbar.${
 -                                 _chatOpen ? 'closeChat' : 'openChat'}`
 -                             )
 -                         } />
 -                 );
 -             case 'closedcaptions':
 -                 return <ClosedCaptionButton showLabel = { true } />;
 -             case 'info':
 -                 return <InfoDialogButton showLabel = { true } />;
 -             case 'invite':
 -                 return (
 -                     <OverflowMenuItem
 -                         accessibilityLabel = { t('toolbar.accessibilityLabel.invite') }
 -                         icon = { IconInvite }
 -                         key = 'invite'
 -                         onClick = { this._onToolbarOpenInvite }
 -                         text = { t('toolbar.invite') } />
 -                 );
 -             case 'tileview':
 -                 return <TileViewButton showLabel = { true } />;
 -             case 'localrecording':
 -                 return (
 -                     <OverflowMenuItem
 -                         accessibilityLabel = { t('toolbar.accessibilityLabel.localRecording') }
 -                         icon = { IconRec }
 -                         key = 'localrecording'
 -                         onClick = { this._onToolbarOpenLocalRecordingInfoDialog }
 -                         text = { t('localRecording.dialogTitle') } />
 -                 );
 -             default:
 -                 return null;
 -             }
 -         });
 -     }
 - 
 -     /**
 -      * Renders the toolbox content.
 -      *
 -      * @returns {Array<ReactElement>}
 -      */
 -     _renderToolboxContent() {
 -         const {
 -             _chatOpen,
 -             _hideInviteButton,
 -             _overflowMenuVisible,
 -             _raisedHand,
 -             t
 -         } = this.props;
 -         const overflowMenuContent = this._renderOverflowMenuContent();
 -         const overflowHasItems = Boolean(overflowMenuContent.filter(child => child).length);
 -         const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
 -         const buttonsLeft = [];
 -         const buttonsRight = [];
 - 
 -         const maxNumberOfButtonsPerGroup = Math.floor(
 -             (
 -                 this.state.windowWidth
 -                     - 168 // the width of the central group by design
 -                     - 48 // the minimum space between the button groups
 -             )
 -             / 56 // the width + padding of a button
 -             / 2 // divide by the number of groups(left and right group)
 -         );
 - 
 -         if (this._shouldShowButton('desktop')
 -                 && this._isDesktopSharingButtonVisible()) {
 -             buttonsLeft.push('desktop');
 -         }
 -         if (this._shouldShowButton('raisehand')) {
 -             buttonsLeft.push('raisehand');
 -         }
 -         if (this._shouldShowButton('chat')) {
 -             buttonsLeft.push('chat');
 -         }
 -         if (this._shouldShowButton('closedcaptions')) {
 -             buttonsLeft.push('closedcaptions');
 -         }
 -         if (overflowHasItems) {
 -             buttonsRight.push('overflowmenu');
 -         }
 -         if (this._shouldShowButton('info')) {
 -             buttonsRight.push('info');
 -         }
 -         if (this._shouldShowButton('invite') && !_hideInviteButton) {
 -             buttonsRight.push('invite');
 -         }
 -         if (this._shouldShowButton('tileview')) {
 -             buttonsRight.push('tileview');
 -         }
 -         if (this._shouldShowButton('localrecording')) {
 -             buttonsRight.push('localrecording');
 -         }
 - 
 -         const movedButtons = [];
 - 
 -         if (buttonsLeft.length > maxNumberOfButtonsPerGroup) {
 -             movedButtons.push(...buttonsLeft.splice(
 -                 maxNumberOfButtonsPerGroup,
 -                 buttonsLeft.length - maxNumberOfButtonsPerGroup));
 -             if (buttonsRight.indexOf('overflowmenu') === -1) {
 -                 buttonsRight.unshift('overflowmenu');
 -             }
 -         }
 - 
 -         if (buttonsRight.length > maxNumberOfButtonsPerGroup) {
 -             if (buttonsRight.indexOf('overflowmenu') === -1) {
 -                 buttonsRight.unshift('overflowmenu');
 -             }
 - 
 -             let numberOfButtons = maxNumberOfButtonsPerGroup;
 - 
 -             // make sure the more button will be displayed when we move buttons.
 -             if (numberOfButtons === 0) {
 -                 numberOfButtons++;
 -             }
 - 
 -             movedButtons.push(...buttonsRight.splice(
 -                 numberOfButtons,
 -                 buttonsRight.length - numberOfButtons));
 - 
 -         }
 - 
 -         overflowMenuContent.splice(
 -             1, 0, ...this._renderMovedButtons(movedButtons));
 - 
 -         return (
 -             <div className = 'toolbox-content'>
 -                 <div className = 'button-group-left'>
 -                     { buttonsLeft.indexOf('desktop') !== -1
 -                         && this._renderDesktopSharingButton() }
 -                     { buttonsLeft.indexOf('raisehand') !== -1
 -                         && <ToolbarButton
 -                             accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }
 -                             icon = { IconRaisedHand }
 -                             onClick = { this._onToolbarToggleRaiseHand }
 -                             toggled = { _raisedHand }
 -                             tooltip = { t('toolbar.raiseHand') } /> }
 -                     { buttonsLeft.indexOf('chat') !== -1
 -                         && <div className = 'toolbar-button-with-badge'>
 -                             <ToolbarButton
 -                                 accessibilityLabel = { t('toolbar.accessibilityLabel.chat') }
 -                                 icon = { IconChat }
 -                                 onClick = { this._onToolbarToggleChat }
 -                                 toggled = { _chatOpen }
 -                                 tooltip = { t('toolbar.chat') } />
 -                             <ChatCounter />
 -                         </div> }
 -                     {
 -                         buttonsLeft.indexOf('closedcaptions') !== -1
 -                             && <ClosedCaptionButton />
 -                     }
 -                 </div>
 -                 <div className = 'button-group-center'>
 -                     <AudioMuteButton
 -                         visible = { this._shouldShowButton('microphone') } />
 -                     <HangupButton
 -                         visible = { this._shouldShowButton('hangup') } />
 -                     <VideoMuteButton
 -                         visible = { this._shouldShowButton('camera') } />
 -                 </div>
 -                 <div className = 'button-group-right'>
 -                     { buttonsRight.indexOf('localrecording') !== -1
 -                         && <LocalRecordingButton
 -                             onClick = {
 -                                 this._onToolbarOpenLocalRecordingInfoDialog
 -                             } />
 -                     }
 -                     { buttonsRight.indexOf('tileview') !== -1
 -                         && <TileViewButton /> }
 -                     { buttonsRight.indexOf('invite') !== -1
 -                         && <ToolbarButton
 -                             accessibilityLabel =
 -                                 { t('toolbar.accessibilityLabel.invite') }
 -                             icon = { IconInvite }
 -                             onClick = { this._onToolbarOpenInvite }
 -                             tooltip = { t('toolbar.invite') } /> }
 -                     {
 -                         buttonsRight.indexOf('info') !== -1
 -                             && <InfoDialogButton />
 -                     }
 -                     { buttonsRight.indexOf('overflowmenu') !== -1
 -                         && <OverflowMenuButton
 -                             isOpen = { _overflowMenuVisible }
 -                             onVisibilityChange = { this._onSetOverflowVisible }>
 -                             <ul
 -                                 aria-label = { t(toolbarAccLabel) }
 -                                 className = 'overflow-menu'>
 -                                 { overflowMenuContent }
 -                             </ul>
 -                         </OverflowMenuButton> }
 -                 </div>
 -             </div>);
 -     }
 - 
 -     _shouldShowButton: (string) => boolean;
 - 
 -     /**
 -      * Returns if a button name has been explicitly configured to be displayed.
 -      *
 -      * @param {string} buttonName - The name of the button, as expected in
 -      * {@link interfaceConfig}.
 -      * @private
 -      * @returns {boolean} True if the button should be displayed.
 -      */
 -     _shouldShowButton(buttonName) {
 -         return this.props._visibleButtons.has(buttonName);
 -     }
 - }
 - 
 - /**
 -  * Maps (parts of) the redux state to {@link Toolbox}'s React {@code Component}
 -  * props.
 -  *
 -  * @param {Object} state - The redux store/state.
 -  * @private
 -  * @returns {{}}
 -  */
 - function _mapStateToProps(state) {
 -     const { conference } = state['features/base/conference'];
 -     let { desktopSharingEnabled } = state['features/base/conference'];
 -     const {
 -         callStatsID,
 -         iAmRecorder
 -     } = state['features/base/config'];
 -     const sharedVideoStatus = state['features/shared-video'].status;
 -     const {
 -         fullScreen,
 -         overflowMenuVisible
 -     } = state['features/toolbox'];
 -     const localParticipant = getLocalParticipant(state);
 -     const localRecordingStates = state['features/local-recording'];
 -     const localVideo = getLocalVideoTrack(state['features/base/tracks']);
 -     const addPeopleEnabled = isAddPeopleEnabled(state);
 -     const dialOutEnabled = isDialOutEnabled(state);
 - 
 -     let desktopSharingDisabledTooltipKey;
 - 
 -     if (state['features/base/config'].enableFeaturesBasedOnToken) {
 -         // we enable desktop sharing if any participant already have this
 -         // feature enabled
 -         desktopSharingEnabled = getParticipants(state)
 -             .find(({ features = {} }) =>
 -                 String(features['screen-sharing']) === 'true') !== undefined;
 - 
 -         // we want to show button and tooltip
 -         if (state['features/base/jwt'].isGuest) {
 -             desktopSharingDisabledTooltipKey
 -                 = 'dialog.shareYourScreenDisabledForGuest';
 -         } else {
 -             desktopSharingDisabledTooltipKey
 -                 = 'dialog.shareYourScreenDisabled';
 -         }
 -     }
 - 
 -     return {
 -         _chatOpen: state['features/chat'].isOpen,
 -         _conference: conference,
 -         _desktopSharingEnabled: desktopSharingEnabled,
 -         _desktopSharingDisabledTooltipKey: desktopSharingDisabledTooltipKey,
 -         _dialog: Boolean(state['features/base/dialog'].component),
 -         _feedbackConfigured: Boolean(callStatsID),
 -         _hideInviteButton:
 -             iAmRecorder || (!addPeopleEnabled && !dialOutEnabled),
 -         _isGuest: state['features/base/jwt'].isGuest,
 -         _fullScreen: fullScreen,
 -         _localParticipantID: localParticipant.id,
 -         _localRecState: localRecordingStates,
 -         _overflowMenuVisible: overflowMenuVisible,
 -         _raisedHand: localParticipant.raisedHand,
 -         _screensharing: localVideo && localVideo.videoType === 'desktop',
 -         _sharingVideo: sharedVideoStatus === 'playing'
 -             || sharedVideoStatus === 'start'
 -             || sharedVideoStatus === 'pause',
 -         _visible: isToolboxVisible(state),
 - 
 -         // XXX: We are not currently using state here, but in the future, when
 -         // interfaceConfig is part of redux we will.
 -         _visibleButtons: new Set(interfaceConfig.TOOLBAR_BUTTONS)
 -     };
 - }
 - 
 - export default translate(connect(_mapStateToProps)(Toolbox));
 
 
  |