You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Toolbox.js 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434
  1. // @flow
  2. import React, { Component } from 'react';
  3. import keyboardShortcut from '../../../../../modules/keyboardshortcut/keyboardshortcut';
  4. import {
  5. ACTION_SHORTCUT_TRIGGERED,
  6. createShortcutEvent,
  7. createToolbarEvent,
  8. sendAnalytics
  9. } from '../../../analytics';
  10. import { getToolbarButtons } from '../../../base/config';
  11. import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
  12. import { openDialog, toggleDialog } from '../../../base/dialog';
  13. import { isMobileBrowser } from '../../../base/environment/utils';
  14. import { translate } from '../../../base/i18n';
  15. import {
  16. IconChat,
  17. IconCodeBlock,
  18. IconDeviceDocument,
  19. IconExitFullScreen,
  20. IconFeedback,
  21. IconFullScreen,
  22. IconParticipants,
  23. IconPresentation,
  24. IconRaisedHand,
  25. IconRec,
  26. IconShareDesktop
  27. } from '../../../base/icons';
  28. import JitsiMeetJS from '../../../base/lib-jitsi-meet';
  29. import {
  30. getLocalParticipant,
  31. getParticipants,
  32. raiseHand
  33. } from '../../../base/participants';
  34. import { connect } from '../../../base/redux';
  35. import { OverflowMenuItem } from '../../../base/toolbox/components';
  36. import { getLocalVideoTrack } from '../../../base/tracks';
  37. import { isVpaasMeeting } from '../../../billing-counter/functions';
  38. import { ChatCounter, toggleChat } from '../../../chat';
  39. import { EmbedMeetingDialog } from '../../../embed-meeting';
  40. import { SharedDocumentButton } from '../../../etherpad';
  41. import { openFeedbackDialog } from '../../../feedback';
  42. import { openKeyboardShortcutsDialog } from '../../../keyboard-shortcuts';
  43. import { LocalRecordingInfoDialog } from '../../../local-recording';
  44. import {
  45. close as closeParticipantsPane,
  46. open as openParticipantsPane
  47. } from '../../../participants-pane/actions';
  48. import { getParticipantsPaneOpen } from '../../../participants-pane/functions';
  49. import {
  50. LiveStreamButton,
  51. RecordButton
  52. } from '../../../recording';
  53. import {
  54. isScreenAudioSupported,
  55. isScreenVideoShared,
  56. ShareAudioButton,
  57. startScreenShareFlow
  58. } from '../../../screen-share/';
  59. import SecurityDialogButton from '../../../security/components/security-dialog/SecurityDialogButton';
  60. import {
  61. SETTINGS_TABS,
  62. SettingsButton,
  63. openSettingsDialog
  64. } from '../../../settings';
  65. import { SharedVideoButton } from '../../../shared-video/components';
  66. import { SpeakerStats } from '../../../speaker-stats';
  67. import {
  68. ClosedCaptionButton
  69. } from '../../../subtitles';
  70. import {
  71. TileViewButton,
  72. shouldDisplayTileView,
  73. toggleTileView
  74. } from '../../../video-layout';
  75. import {
  76. OverflowMenuVideoQualityItem,
  77. VideoQualityDialog
  78. } from '../../../video-quality';
  79. import { VideoBackgroundButton } from '../../../virtual-background';
  80. import { toggleBackgroundEffect } from '../../../virtual-background/actions';
  81. import { VIRTUAL_BACKGROUND_TYPE } from '../../../virtual-background/constants';
  82. import { checkBlurSupport } from '../../../virtual-background/functions';
  83. import {
  84. setFullScreen,
  85. setOverflowMenuVisible,
  86. setToolbarHovered,
  87. showToolbox
  88. } from '../../actions';
  89. import { getToolbarAdditionalButtons, isToolboxVisible } from '../../functions';
  90. import DownloadButton from '../DownloadButton';
  91. import HangupButton from '../HangupButton';
  92. import HelpButton from '../HelpButton';
  93. import MuteEveryoneButton from '../MuteEveryoneButton';
  94. import MuteEveryonesVideoButton from '../MuteEveryonesVideoButton';
  95. import AudioSettingsButton from './AudioSettingsButton';
  96. import OverflowMenuButton from './OverflowMenuButton';
  97. import OverflowMenuProfileItem from './OverflowMenuProfileItem';
  98. import ToggleCameraButton from './ToggleCameraButton';
  99. import ToolbarButton from './ToolbarButton';
  100. import VideoSettingsButton from './VideoSettingsButton';
  101. /**
  102. * The type of the React {@code Component} props of {@link Toolbox}.
  103. */
  104. type Props = {
  105. /**
  106. * String showing if the virtual background type is desktop-share.
  107. */
  108. _backgroundType: String,
  109. /**
  110. * Whether or not the chat feature is currently displayed.
  111. */
  112. _chatOpen: boolean,
  113. /**
  114. * The width of the client.
  115. */
  116. _clientWidth: number,
  117. /**
  118. * The {@code JitsiConference} for the current conference.
  119. */
  120. _conference: Object,
  121. /**
  122. * The tooltip key to use when screensharing is disabled. Or undefined
  123. * if non to be shown and the button to be hidden.
  124. */
  125. _desktopSharingDisabledTooltipKey: boolean,
  126. /**
  127. * Whether or not screensharing is initialized.
  128. */
  129. _desktopSharingEnabled: boolean,
  130. /**
  131. * Whether or not a dialog is displayed.
  132. */
  133. _dialog: boolean,
  134. /**
  135. * Whether or not call feedback can be sent.
  136. */
  137. _feedbackConfigured: boolean,
  138. /**
  139. * Whether or not the app is currently in full screen.
  140. */
  141. _fullScreen: boolean,
  142. /**
  143. * Whether or not the app is running in mobile browser.
  144. */
  145. _isMobile: boolean,
  146. /**
  147. * Whether or not the profile is disabled.
  148. */
  149. _isProfileDisabled: boolean,
  150. /**
  151. * Whether or not the tile view is enabled.
  152. */
  153. _tileViewEnabled: boolean,
  154. /**
  155. * Whether or not the current meeting belongs to a JaaS user.
  156. */
  157. _isVpaasMeeting: boolean,
  158. /**
  159. * The ID of the local participant.
  160. */
  161. _localParticipantID: String,
  162. /**
  163. * The subsection of Redux state for local recording
  164. */
  165. _localRecState: Object,
  166. /**
  167. * The value for how the conference is locked (or undefined if not locked)
  168. * as defined by room-lock constants.
  169. */
  170. _locked: boolean,
  171. /**
  172. * The JitsiLocalTrack to display.
  173. */
  174. _localVideo: Object,
  175. /**
  176. * Whether or not the overflow menu is visible.
  177. */
  178. _overflowMenuVisible: boolean,
  179. /**
  180. * Whether or not the participants pane is open.
  181. */
  182. _participantsPaneOpen: boolean,
  183. /**
  184. * Whether or not the local participant's hand is raised.
  185. */
  186. _raisedHand: boolean,
  187. /**
  188. * Whether or not the local participant is screensharing.
  189. */
  190. _screensharing: boolean,
  191. /**
  192. * Whether or not the local participant is sharing a YouTube video.
  193. */
  194. _sharingVideo: boolean,
  195. /**
  196. * Flag showing whether toolbar is visible.
  197. */
  198. _visible: boolean,
  199. /**
  200. * Array with the buttons which this Toolbox should display.
  201. */
  202. _visibleButtons: Array<string>,
  203. /**
  204. * Handler to check if a button is enabled.
  205. */
  206. _shouldShowButton: Function,
  207. /**
  208. * Returns the selected virtual source object.
  209. */
  210. _virtualSource: Object,
  211. /**
  212. * Invoked to active other features of the app.
  213. */
  214. dispatch: Function,
  215. /**
  216. * Invoked to obtain translated strings.
  217. */
  218. t: Function
  219. };
  220. declare var APP: Object;
  221. /**
  222. * Implements the conference toolbox on React/Web.
  223. *
  224. * @extends Component
  225. */
  226. class Toolbox extends Component<Props> {
  227. /**
  228. * Initializes a new {@code Toolbox} instance.
  229. *
  230. * @param {Props} props - The read-only React {@code Component} props with
  231. * which the new instance is to be initialized.
  232. */
  233. constructor(props: Props) {
  234. super(props);
  235. // Bind event handlers so they are only bound once per instance.
  236. this._onMouseOut = this._onMouseOut.bind(this);
  237. this._onMouseOver = this._onMouseOver.bind(this);
  238. this._onSetOverflowVisible = this._onSetOverflowVisible.bind(this);
  239. this._onTabIn = this._onTabIn.bind(this);
  240. this._onShortcutToggleChat = this._onShortcutToggleChat.bind(this);
  241. this._onShortcutToggleFullScreen = this._onShortcutToggleFullScreen.bind(this);
  242. this._onShortcutToggleParticipantsPane = this._onShortcutToggleParticipantsPane.bind(this);
  243. this._onShortcutToggleRaiseHand = this._onShortcutToggleRaiseHand.bind(this);
  244. this._onShortcutToggleScreenshare = this._onShortcutToggleScreenshare.bind(this);
  245. this._onShortcutToggleVideoQuality = this._onShortcutToggleVideoQuality.bind(this);
  246. this._onToolbarOpenFeedback = this._onToolbarOpenFeedback.bind(this);
  247. this._onToolbarToggleParticipantsPane = this._onToolbarToggleParticipantsPane.bind(this);
  248. this._onToolbarOpenKeyboardShortcuts = this._onToolbarOpenKeyboardShortcuts.bind(this);
  249. this._onToolbarOpenSpeakerStats = this._onToolbarOpenSpeakerStats.bind(this);
  250. this._onToolbarOpenEmbedMeeting = this._onToolbarOpenEmbedMeeting.bind(this);
  251. this._onToolbarOpenVideoQuality = this._onToolbarOpenVideoQuality.bind(this);
  252. this._onToolbarToggleChat = this._onToolbarToggleChat.bind(this);
  253. this._onToolbarToggleFullScreen = this._onToolbarToggleFullScreen.bind(this);
  254. this._onToolbarToggleProfile = this._onToolbarToggleProfile.bind(this);
  255. this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);
  256. this._onToolbarToggleScreenshare = this._onToolbarToggleScreenshare.bind(this);
  257. this._onToolbarOpenLocalRecordingInfoDialog = this._onToolbarOpenLocalRecordingInfoDialog.bind(this);
  258. this._onShortcutToggleTileView = this._onShortcutToggleTileView.bind(this);
  259. this._onEscKey = this._onEscKey.bind(this);
  260. }
  261. /**
  262. * Sets keyboard shortcuts for to trigger ToolbarButtons actions.
  263. *
  264. * @inheritdoc
  265. * @returns {void}
  266. */
  267. componentDidMount() {
  268. const KEYBOARD_SHORTCUTS = [
  269. this.props._shouldShowButton('videoquality') && {
  270. character: 'A',
  271. exec: this._onShortcutToggleVideoQuality,
  272. helpDescription: 'toolbar.callQuality'
  273. },
  274. this.props._shouldShowButton('chat') && {
  275. character: 'C',
  276. exec: this._onShortcutToggleChat,
  277. helpDescription: 'keyboardShortcuts.toggleChat'
  278. },
  279. this.props._shouldShowButton('desktop') && {
  280. character: 'D',
  281. exec: this._onShortcutToggleScreenshare,
  282. helpDescription: 'keyboardShortcuts.toggleScreensharing'
  283. },
  284. this.props._shouldShowButton('participants-pane') && {
  285. character: 'P',
  286. exec: this._onShortcutToggleParticipantsPane,
  287. helpDescription: 'keyboardShortcuts.toggleParticipantsPane'
  288. },
  289. this.props._shouldShowButton('raisehand') && {
  290. character: 'R',
  291. exec: this._onShortcutToggleRaiseHand,
  292. helpDescription: 'keyboardShortcuts.raiseHand'
  293. },
  294. this.props._shouldShowButton('fullscreen') && {
  295. character: 'S',
  296. exec: this._onShortcutToggleFullScreen,
  297. helpDescription: 'keyboardShortcuts.fullScreen'
  298. },
  299. this.props._shouldShowButton('tileview') && {
  300. character: 'W',
  301. exec: this._onShortcutToggleTileView,
  302. helpDescription: 'toolbar.tileViewToggle'
  303. }
  304. ];
  305. KEYBOARD_SHORTCUTS.forEach(shortcut => {
  306. if (typeof shortcut === 'object') {
  307. APP.keyboardshortcut.registerShortcut(
  308. shortcut.character,
  309. null,
  310. shortcut.exec,
  311. shortcut.helpDescription);
  312. }
  313. });
  314. }
  315. /**
  316. * Update the visibility of the {@code OverflowMenuButton}.
  317. *
  318. * @inheritdoc
  319. */
  320. componentDidUpdate(prevProps) {
  321. // Ensure the dialog is closed when the toolbox becomes hidden.
  322. if (prevProps._overflowMenuVisible && !this.props._visible) {
  323. this._onSetOverflowVisible(false);
  324. }
  325. if (prevProps._overflowMenuVisible
  326. && !prevProps._dialog
  327. && this.props._dialog) {
  328. this._onSetOverflowVisible(false);
  329. this.props.dispatch(setToolbarHovered(false));
  330. }
  331. }
  332. /**
  333. * Removes keyboard shortcuts registered by this component.
  334. *
  335. * @inheritdoc
  336. * @returns {void}
  337. */
  338. componentWillUnmount() {
  339. [ 'A', 'C', 'D', 'R', 'S' ].forEach(letter =>
  340. APP.keyboardshortcut.unregisterShortcut(letter));
  341. }
  342. /**
  343. * Implements React's {@link Component#render()}.
  344. *
  345. * @inheritdoc
  346. * @returns {ReactElement}
  347. */
  348. render() {
  349. const { _chatOpen, _visible, _visibleButtons } = this.props;
  350. const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
  351. _visibleButtons.length ? '' : 'no-buttons'} ${_chatOpen ? 'shift-right' : ''}`;
  352. return (
  353. <div
  354. className = { rootClassNames }
  355. id = 'new-toolbox'>
  356. { this._renderToolboxContent() }
  357. </div>
  358. );
  359. }
  360. _onEscKey: (KeyboardEvent) => void;
  361. /**
  362. * Key handler for overflow menu.
  363. *
  364. * @param {KeyboardEvent} e - Esc key click to close the popup.
  365. * @returns {void}
  366. */
  367. _onEscKey(e) {
  368. if (e.key === 'Escape') {
  369. e.stopPropagation();
  370. this._closeOverflowMenuIfOpen();
  371. }
  372. }
  373. /**
  374. * Closes the overflow menu if opened.
  375. *
  376. * @private
  377. * @returns {void}
  378. */
  379. _closeOverflowMenuIfOpen() {
  380. const { dispatch, _overflowMenuVisible } = this.props;
  381. _overflowMenuVisible && dispatch(setOverflowMenuVisible(false));
  382. }
  383. /**
  384. * Callback invoked to display {@code FeedbackDialog}.
  385. *
  386. * @private
  387. * @returns {void}
  388. */
  389. _doOpenFeedback() {
  390. const { _conference } = this.props;
  391. this.props.dispatch(openFeedbackDialog(_conference));
  392. }
  393. /**
  394. * Callback invoked to display {@code FeedbackDialog}.
  395. *
  396. * @private
  397. * @returns {void}
  398. */
  399. _doOpenEmbedMeeting() {
  400. this.props.dispatch(openDialog(EmbedMeetingDialog));
  401. }
  402. /**
  403. * Dispatches an action to display {@code KeyboardShortcuts}.
  404. *
  405. * @private
  406. * @returns {void}
  407. */
  408. _doOpenKeyboardShorcuts() {
  409. this.props.dispatch(openKeyboardShortcutsDialog());
  410. }
  411. /**
  412. * Callback invoked to display {@code SpeakerStats}.
  413. *
  414. * @private
  415. * @returns {void}
  416. */
  417. _doOpenSpeakerStats() {
  418. this.props.dispatch(openDialog(SpeakerStats, {
  419. conference: this.props._conference
  420. }));
  421. }
  422. /**
  423. * Dispatches an action to open the video quality dialog.
  424. *
  425. * @private
  426. * @returns {void}
  427. */
  428. _doOpenVideoQuality() {
  429. this.props.dispatch(openDialog(VideoQualityDialog));
  430. }
  431. /**
  432. * Dispatches an action to toggle the display of chat.
  433. *
  434. * @private
  435. * @returns {void}
  436. */
  437. _doToggleChat() {
  438. this.props.dispatch(toggleChat());
  439. }
  440. /**
  441. * Dispatches an action to toggle screensharing.
  442. *
  443. * @private
  444. * @returns {void}
  445. */
  446. _doToggleFullScreen() {
  447. const fullScreen = !this.props._fullScreen;
  448. this.props.dispatch(setFullScreen(fullScreen));
  449. }
  450. /**
  451. * Dispatches an action to show or hide the profile edit panel.
  452. *
  453. * @private
  454. * @returns {void}
  455. */
  456. _doToggleProfile() {
  457. this.props.dispatch(openSettingsDialog(SETTINGS_TABS.PROFILE));
  458. }
  459. /**
  460. * Dispatches an action to toggle the local participant's raised hand state.
  461. *
  462. * @private
  463. * @returns {void}
  464. */
  465. _doToggleRaiseHand() {
  466. const { _localParticipantID, _raisedHand } = this.props;
  467. const newRaisedStatus = !_raisedHand;
  468. this.props.dispatch(raiseHand(newRaisedStatus));
  469. APP.API.notifyRaiseHandUpdated(_localParticipantID, newRaisedStatus);
  470. }
  471. /**
  472. * Dispatches an action to toggle screensharing.
  473. *
  474. * @private
  475. * @param {boolean} enabled - The state to toggle screen sharing to.
  476. * @param {boolean} audioOnly - Only share system audio.
  477. * @returns {void}
  478. */
  479. _doToggleScreenshare() {
  480. if (this.props._desktopSharingEnabled) {
  481. this.props.dispatch(startScreenShareFlow());
  482. }
  483. }
  484. /**
  485. * Dispatches an action to toggle the video quality dialog.
  486. *
  487. * @private
  488. * @returns {void}
  489. */
  490. _doToggleVideoQuality() {
  491. this.props.dispatch(toggleDialog(VideoQualityDialog));
  492. }
  493. /**
  494. * Dispaches an action to toggle tile view.
  495. *
  496. * @private
  497. * @returns {void}
  498. */
  499. _doToggleTileView() {
  500. this.props.dispatch(toggleTileView());
  501. }
  502. _onMouseOut: () => void;
  503. /**
  504. * Dispatches an action signaling the toolbar is not being hovered.
  505. *
  506. * @private
  507. * @returns {void}
  508. */
  509. _onMouseOut() {
  510. this.props.dispatch(setToolbarHovered(false));
  511. }
  512. _onMouseOver: () => void;
  513. /**
  514. * Dispatches an action signaling the toolbar is being hovered.
  515. *
  516. * @private
  517. * @returns {void}
  518. */
  519. _onMouseOver() {
  520. this.props.dispatch(setToolbarHovered(true));
  521. }
  522. _onSetOverflowVisible: (boolean) => void;
  523. /**
  524. * Sets the visibility of the overflow menu.
  525. *
  526. * @param {boolean} visible - Whether or not the overflow menu should be
  527. * displayed.
  528. * @private
  529. * @returns {void}
  530. */
  531. _onSetOverflowVisible(visible) {
  532. this.props.dispatch(setOverflowMenuVisible(visible));
  533. }
  534. _onShortcutToggleChat: () => void;
  535. /**
  536. * Creates an analytics keyboard shortcut event and dispatches an action for
  537. * toggling the display of chat.
  538. *
  539. * @private
  540. * @returns {void}
  541. */
  542. _onShortcutToggleChat() {
  543. sendAnalytics(createShortcutEvent(
  544. 'toggle.chat',
  545. {
  546. enable: !this.props._chatOpen
  547. }));
  548. // Checks if there was any text selected by the user.
  549. // Used for when we press simultaneously keys for copying
  550. // text messages from the chat board
  551. if (window.getSelection().toString() !== '') {
  552. return false;
  553. }
  554. this._doToggleChat();
  555. }
  556. _onShortcutToggleParticipantsPane: () => void;
  557. /**
  558. * Creates an analytics keyboard shortcut event and dispatches an action for
  559. * toggling the display of the participants pane.
  560. *
  561. * @private
  562. * @returns {void}
  563. */
  564. _onShortcutToggleParticipantsPane() {
  565. sendAnalytics(createShortcutEvent(
  566. 'toggle.participants-pane',
  567. {
  568. enable: !this.props._participantsPaneOpen
  569. }));
  570. this._onToolbarToggleParticipantsPane();
  571. }
  572. _onShortcutToggleVideoQuality: () => void;
  573. /**
  574. * Creates an analytics keyboard shortcut event and dispatches an action for
  575. * toggling the display of Video Quality.
  576. *
  577. * @private
  578. * @returns {void}
  579. */
  580. _onShortcutToggleVideoQuality() {
  581. sendAnalytics(createShortcutEvent('video.quality'));
  582. this._doToggleVideoQuality();
  583. }
  584. _onShortcutToggleTileView: () => void;
  585. /**
  586. * Dispatches an action for toggling the tile view.
  587. *
  588. * @private
  589. * @returns {void}
  590. */
  591. _onShortcutToggleTileView() {
  592. sendAnalytics(createShortcutEvent(
  593. 'toggle.tileview',
  594. {
  595. enable: !this.props._tileViewEnabled
  596. }));
  597. this._doToggleTileView();
  598. }
  599. _onShortcutToggleFullScreen: () => void;
  600. /**
  601. * Creates an analytics keyboard shortcut event and dispatches an action for
  602. * toggling full screen mode.
  603. *
  604. * @private
  605. * @returns {void}
  606. */
  607. _onShortcutToggleFullScreen() {
  608. sendAnalytics(createShortcutEvent(
  609. 'toggle.fullscreen',
  610. {
  611. enable: !this.props._fullScreen
  612. }));
  613. this._doToggleFullScreen();
  614. }
  615. _onShortcutToggleRaiseHand: () => void;
  616. /**
  617. * Creates an analytics keyboard shortcut event and dispatches an action for
  618. * toggling raise hand.
  619. *
  620. * @private
  621. * @returns {void}
  622. */
  623. _onShortcutToggleRaiseHand() {
  624. sendAnalytics(createShortcutEvent(
  625. 'toggle.raise.hand',
  626. ACTION_SHORTCUT_TRIGGERED,
  627. { enable: !this.props._raisedHand }));
  628. this._doToggleRaiseHand();
  629. }
  630. _onShortcutToggleScreenshare: () => void;
  631. /**
  632. * Creates an analytics keyboard shortcut event and dispatches an action for
  633. * toggling screensharing.
  634. *
  635. * @private
  636. * @returns {void}
  637. */
  638. _onShortcutToggleScreenshare() {
  639. sendAnalytics(createToolbarEvent(
  640. 'screen.sharing',
  641. {
  642. enable: !this.props._screensharing
  643. }));
  644. this._doToggleScreenshare();
  645. }
  646. _onTabIn: () => void;
  647. /**
  648. * Toggle the toolbar visibility when tabbing into it.
  649. *
  650. * @returns {void}
  651. */
  652. _onTabIn() {
  653. if (!this.props._visible) {
  654. this.props.dispatch(showToolbox());
  655. }
  656. }
  657. _onToolbarOpenFeedback: () => void;
  658. /**
  659. * Creates an analytics toolbar event and dispatches an action for toggling
  660. * display of feedback.
  661. *
  662. * @private
  663. * @returns {void}
  664. */
  665. _onToolbarOpenFeedback() {
  666. sendAnalytics(createToolbarEvent('feedback'));
  667. this._doOpenFeedback();
  668. }
  669. _onToolbarToggleParticipantsPane: () => void;
  670. /**
  671. * Dispatches an action for toggling the participants pane.
  672. *
  673. * @private
  674. * @returns {void}
  675. */
  676. _onToolbarToggleParticipantsPane() {
  677. const { dispatch, _participantsPaneOpen } = this.props;
  678. if (_participantsPaneOpen) {
  679. dispatch(closeParticipantsPane());
  680. } else {
  681. dispatch(openParticipantsPane());
  682. }
  683. }
  684. _onToolbarOpenKeyboardShortcuts: () => void;
  685. /**
  686. * Creates an analytics toolbar event and dispatches an action for opening
  687. * the modal for showing available keyboard shortcuts.
  688. *
  689. * @private
  690. * @returns {void}
  691. */
  692. _onToolbarOpenKeyboardShortcuts() {
  693. sendAnalytics(createToolbarEvent('shortcuts'));
  694. this._doOpenKeyboardShorcuts();
  695. }
  696. _onToolbarOpenEmbedMeeting: () => void;
  697. /**
  698. * Creates an analytics toolbar event and dispatches an action for opening
  699. * the embed meeting modal.
  700. *
  701. * @private
  702. * @returns {void}
  703. */
  704. _onToolbarOpenEmbedMeeting() {
  705. sendAnalytics(createToolbarEvent('embed.meeting'));
  706. this._doOpenEmbedMeeting();
  707. }
  708. _onToolbarOpenSpeakerStats: () => void;
  709. /**
  710. * Creates an analytics toolbar event and dispatches an action for opening
  711. * the speaker stats modal.
  712. *
  713. * @private
  714. * @returns {void}
  715. */
  716. _onToolbarOpenSpeakerStats() {
  717. sendAnalytics(createToolbarEvent('speaker.stats'));
  718. this._doOpenSpeakerStats();
  719. }
  720. _onToolbarOpenVideoQuality: () => void;
  721. /**
  722. * Creates an analytics toolbar event and dispatches an action for toggling
  723. * open the video quality dialog.
  724. *
  725. * @private
  726. * @returns {void}
  727. */
  728. _onToolbarOpenVideoQuality() {
  729. sendAnalytics(createToolbarEvent('video.quality'));
  730. this._doOpenVideoQuality();
  731. }
  732. _onToolbarToggleChat: () => void;
  733. /**
  734. * Creates an analytics toolbar event and dispatches an action for toggling
  735. * the display of chat.
  736. *
  737. * @private
  738. * @returns {void}
  739. */
  740. _onToolbarToggleChat() {
  741. sendAnalytics(createToolbarEvent(
  742. 'toggle.chat',
  743. {
  744. enable: !this.props._chatOpen
  745. }));
  746. this._closeOverflowMenuIfOpen();
  747. this._doToggleChat();
  748. }
  749. _onToolbarToggleFullScreen: () => void;
  750. /**
  751. * Creates an analytics toolbar event and dispatches an action for toggling
  752. * full screen mode.
  753. *
  754. * @private
  755. * @returns {void}
  756. */
  757. _onToolbarToggleFullScreen() {
  758. sendAnalytics(createToolbarEvent(
  759. 'toggle.fullscreen',
  760. {
  761. enable: !this.props._fullScreen
  762. }));
  763. this._closeOverflowMenuIfOpen();
  764. this._doToggleFullScreen();
  765. }
  766. _onToolbarToggleProfile: () => void;
  767. /**
  768. * Creates an analytics toolbar event and dispatches an action for showing
  769. * or hiding the profile edit panel.
  770. *
  771. * @private
  772. * @returns {void}
  773. */
  774. _onToolbarToggleProfile() {
  775. sendAnalytics(createToolbarEvent('profile'));
  776. this._doToggleProfile();
  777. }
  778. _onToolbarToggleRaiseHand: () => void;
  779. /**
  780. * Creates an analytics toolbar event and dispatches an action for toggling
  781. * raise hand.
  782. *
  783. * @private
  784. * @returns {void}
  785. */
  786. _onToolbarToggleRaiseHand() {
  787. sendAnalytics(createToolbarEvent(
  788. 'raise.hand',
  789. { enable: !this.props._raisedHand }));
  790. this._doToggleRaiseHand();
  791. }
  792. _onToolbarToggleScreenshare: () => void;
  793. /**
  794. * Creates an analytics toolbar event and dispatches an action for toggling
  795. * screensharing.
  796. *
  797. * @private
  798. * @returns {void}
  799. */
  800. _onToolbarToggleScreenshare() {
  801. if (this.props._backgroundType === VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE) {
  802. const noneOptions = {
  803. enabled: false,
  804. backgroundType: VIRTUAL_BACKGROUND_TYPE.NONE,
  805. selectedThumbnail: VIRTUAL_BACKGROUND_TYPE.NONE,
  806. backgroundEffectEnabled: false
  807. };
  808. this.props._virtualSource.dispose();
  809. this.props.dispatch(toggleBackgroundEffect(noneOptions, this.props._localVideo));
  810. return;
  811. }
  812. if (!this.props._desktopSharingEnabled) {
  813. return;
  814. }
  815. sendAnalytics(createShortcutEvent(
  816. 'toggle.screen.sharing',
  817. ACTION_SHORTCUT_TRIGGERED,
  818. { enable: !this.props._screensharing }));
  819. this._closeOverflowMenuIfOpen();
  820. this._doToggleScreenshare();
  821. }
  822. _onToolbarOpenLocalRecordingInfoDialog: () => void;
  823. /**
  824. * Opens the {@code LocalRecordingInfoDialog}.
  825. *
  826. * @private
  827. * @returns {void}
  828. */
  829. _onToolbarOpenLocalRecordingInfoDialog() {
  830. sendAnalytics(createToolbarEvent('local.recording'));
  831. this.props.dispatch(openDialog(LocalRecordingInfoDialog));
  832. }
  833. /**
  834. * Returns true if the desktop sharing button should be visible and
  835. * false otherwise.
  836. *
  837. * @returns {boolean}
  838. */
  839. _showDesktopSharingButton() {
  840. const {
  841. _desktopSharingEnabled,
  842. _desktopSharingDisabledTooltipKey
  843. } = this.props;
  844. return (
  845. (_desktopSharingEnabled
  846. || _desktopSharingDisabledTooltipKey)
  847. && this.props._shouldShowButton('desktop')
  848. );
  849. }
  850. /**
  851. * Returns true if the embed meeting button is visible and false otherwise.
  852. *
  853. * @returns {boolean}
  854. */
  855. _isEmbedMeetingVisible() {
  856. return !this.props._isVpaasMeeting
  857. && !this.props._isMobile
  858. && this.props._shouldShowButton('embedmeeting');
  859. }
  860. /**
  861. * Returns true if the profile button is visible and false otherwise.
  862. *
  863. * @returns {boolean}
  864. */
  865. _isProfileVisible() {
  866. return !this.props._isProfileDisabled && this.props._shouldShowButton('profile');
  867. }
  868. /**
  869. * Renders the list elements of the overflow menu.
  870. *
  871. * @private
  872. * @param {Array<React$Element>} additionalButtons - Additional buttons to be displayed.
  873. * @returns {Array<React$Element>}
  874. */
  875. _renderOverflowMenuContent(additionalButtons: Array<React$Element<any>>) {
  876. const {
  877. _desktopSharingEnabled,
  878. _feedbackConfigured,
  879. _fullScreen,
  880. _isMobile,
  881. _screensharing,
  882. t
  883. } = this.props;
  884. const group1 = [
  885. ...additionalButtons,
  886. this.props._shouldShowButton('toggle-camera')
  887. && <ToggleCameraButton
  888. key = 'toggle-camera'
  889. showLabel = { true } />,
  890. this.props._shouldShowButton('videoquality')
  891. && <OverflowMenuVideoQualityItem
  892. key = 'videoquality'
  893. onClick = { this._onToolbarOpenVideoQuality } />,
  894. this.props._shouldShowButton('fullscreen')
  895. && !_isMobile
  896. && <OverflowMenuItem
  897. accessibilityLabel = { t('toolbar.accessibilityLabel.fullScreen') }
  898. icon = { _fullScreen ? IconExitFullScreen : IconFullScreen }
  899. key = 'fullscreen'
  900. onClick = { this._onToolbarToggleFullScreen }
  901. text = { _fullScreen ? t('toolbar.exitFullScreen') : t('toolbar.enterFullScreen') } />,
  902. (this.props._shouldShowButton('security') || this.props._shouldShowButton('info'))
  903. && <SecurityDialogButton
  904. key = 'security'
  905. showLabel = { true } />,
  906. this.props._shouldShowButton('closedcaptions')
  907. && <ClosedCaptionButton
  908. key = 'closed-captions'
  909. showLabel = { true } />,
  910. this.props._shouldShowButton('recording')
  911. && <RecordButton
  912. key = 'record'
  913. showLabel = { true } />,
  914. this.props._shouldShowButton('localrecording')
  915. && <OverflowMenuItem
  916. accessibilityLabel = { t('toolbar.accessibilityLabel.localRecording') }
  917. icon = { IconRec }
  918. key = 'localrecording'
  919. onClick = { this._onToolbarOpenLocalRecordingInfoDialog }
  920. text = { t('localRecording.dialogTitle') } />,
  921. this.props._shouldShowButton('mute-everyone')
  922. && <MuteEveryoneButton
  923. key = 'mute-everyone'
  924. showLabel = { true } />,
  925. this.props._shouldShowButton('mute-video-everyone')
  926. && <MuteEveryonesVideoButton
  927. key = 'mute-video-everyone'
  928. showLabel = { true } />,
  929. this.props._shouldShowButton('livestreaming')
  930. && <LiveStreamButton
  931. key = 'livestreaming'
  932. showLabel = { true } />
  933. ];
  934. const group2 = [
  935. this.props._shouldShowButton('sharedvideo')
  936. && <SharedVideoButton
  937. key = 'sharedvideo'
  938. showLabel = { true } />,
  939. this.props._shouldShowButton('shareaudio')
  940. && _desktopSharingEnabled
  941. && isScreenAudioSupported()
  942. && <ShareAudioButton
  943. key = 'shareaudio'
  944. showLabel = { true } />,
  945. this.props._shouldShowButton('etherpad')
  946. && <SharedDocumentButton
  947. key = 'etherpad'
  948. showLabel = { true } />,
  949. (this.props._shouldShowButton('select-background') || this.props._shouldShowButton('videobackgroundblur'))
  950. && <VideoBackgroundButton
  951. key = { 'select-background' }
  952. showLabel = { true }
  953. visible = { !_screensharing && checkBlurSupport() } />,
  954. this.props._shouldShowButton('stats')
  955. && <OverflowMenuItem
  956. accessibilityLabel = { t('toolbar.accessibilityLabel.speakerStats') }
  957. icon = { IconPresentation }
  958. key = 'stats'
  959. onClick = { this._onToolbarOpenSpeakerStats }
  960. text = { t('toolbar.speakerStats') } />
  961. ];
  962. return [
  963. this._isProfileVisible()
  964. && <OverflowMenuProfileItem
  965. key = 'profile'
  966. onClick = { this._onToolbarToggleProfile } />,
  967. this._isProfileVisible()
  968. && <hr
  969. className = 'overflow-menu-hr'
  970. key = 'hr1' />,
  971. ...group1,
  972. group1.some(Boolean)
  973. && <hr
  974. className = 'overflow-menu-hr'
  975. key = 'hr2' />,
  976. ...group2,
  977. group2.some(Boolean)
  978. && <hr
  979. className = 'overflow-menu-hr'
  980. key = 'hr3' />,
  981. this.props._shouldShowButton('settings')
  982. && <SettingsButton
  983. key = 'settings'
  984. showLabel = { true } />,
  985. this.props._shouldShowButton('shortcuts')
  986. && !_isMobile
  987. && keyboardShortcut.getEnabled()
  988. && <OverflowMenuItem
  989. accessibilityLabel = { t('toolbar.accessibilityLabel.shortcuts') }
  990. icon = { IconDeviceDocument }
  991. key = 'shortcuts'
  992. onClick = { this._onToolbarOpenKeyboardShortcuts }
  993. text = { t('toolbar.shortcuts') } />,
  994. this._isEmbedMeetingVisible()
  995. && <OverflowMenuItem
  996. accessibilityLabel = { t('toolbar.accessibilityLabel.embedMeeting') }
  997. icon = { IconCodeBlock }
  998. key = 'embed'
  999. onClick = { this._onToolbarOpenEmbedMeeting }
  1000. text = { t('toolbar.embedMeeting') } />,
  1001. this.props._shouldShowButton('feedback')
  1002. && _feedbackConfigured
  1003. && <OverflowMenuItem
  1004. accessibilityLabel = { t('toolbar.accessibilityLabel.feedback') }
  1005. icon = { IconFeedback }
  1006. key = 'feedback'
  1007. onClick = { this._onToolbarOpenFeedback }
  1008. text = { t('toolbar.feedback') } />,
  1009. this.props._shouldShowButton('download')
  1010. && <DownloadButton
  1011. key = 'download'
  1012. showLabel = { true } />,
  1013. this.props._shouldShowButton('help')
  1014. && <HelpButton
  1015. key = 'help'
  1016. showLabel = { true } />
  1017. ];
  1018. }
  1019. /**
  1020. * Returns the buttons to be displayed in main or the overflow menu.
  1021. *
  1022. * @param {Set} buttons - A set containing the buttons to be displayed
  1023. * in the toolbar beside the main audio/video & hanugup.
  1024. * @returns {Object}
  1025. */
  1026. _getAdditionalButtons(buttons) {
  1027. const {
  1028. _chatOpen,
  1029. _desktopSharingEnabled,
  1030. _desktopSharingDisabledTooltipKey,
  1031. _screensharing,
  1032. t
  1033. } = this.props;
  1034. const overflowMenuAdditionalButtons = [];
  1035. const mainMenuAdditionalButtons = [];
  1036. if (this._showDesktopSharingButton()) {
  1037. buttons.has('desktop')
  1038. ? mainMenuAdditionalButtons.push(<ToolbarButton
  1039. accessibilityLabel = { t('toolbar.accessibilityLabel.shareYourScreen') }
  1040. disabled = { !_desktopSharingEnabled }
  1041. icon = { IconShareDesktop }
  1042. key = 'desktop'
  1043. onClick = { this._onToolbarToggleScreenshare }
  1044. toggled = { _screensharing }
  1045. tooltip = { t(_desktopSharingEnabled
  1046. ? 'dialog.shareYourScreen' : _desktopSharingDisabledTooltipKey) } />)
  1047. : overflowMenuAdditionalButtons.push(<OverflowMenuItem
  1048. accessibilityLabel = { t('toolbar.accessibilityLabel.shareYourScreen') }
  1049. icon = { IconShareDesktop }
  1050. iconId = 'share-desktop'
  1051. key = 'desktop'
  1052. onClick = { this._onToolbarToggleScreenshare }
  1053. text = { t(`toolbar.${_screensharing ? 'stopScreenSharing' : 'startScreenSharing'}`) } />);
  1054. }
  1055. if (this.props._shouldShowButton('chat')) {
  1056. buttons.has('chat')
  1057. ? mainMenuAdditionalButtons.push(<div
  1058. className = 'toolbar-button-with-badge'
  1059. key = 'chatcontainer'>
  1060. <ToolbarButton
  1061. accessibilityLabel = { t('toolbar.accessibilityLabel.chat') }
  1062. icon = { IconChat }
  1063. key = 'chat'
  1064. onClick = { this._onToolbarToggleChat }
  1065. toggled = { _chatOpen }
  1066. tooltip = { t('toolbar.chat') } />
  1067. <ChatCounter />
  1068. </div>) : overflowMenuAdditionalButtons.push(<OverflowMenuItem
  1069. accessibilityLabel = { t('toolbar.accessibilityLabel.chat') }
  1070. icon = { IconChat }
  1071. key = 'chat'
  1072. onClick = { this._onToolbarToggleChat }
  1073. text = { t(`toolbar.${_chatOpen ? 'closeChat' : 'openChat'}`) } />);
  1074. }
  1075. if (this.props._shouldShowButton('raisehand')) {
  1076. const raisedHand = this.props._raisedHand || false;
  1077. buttons.has('raisehand')
  1078. ? mainMenuAdditionalButtons.push(<ToolbarButton
  1079. accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }
  1080. icon = { IconRaisedHand }
  1081. key = 'raisehand'
  1082. onClick = { this._onToolbarToggleRaiseHand }
  1083. toggled = { raisedHand }
  1084. tooltip = { t(`toolbar.${raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`) } />)
  1085. : overflowMenuAdditionalButtons.push(<OverflowMenuItem
  1086. accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }
  1087. icon = { IconRaisedHand }
  1088. key = 'raisehand'
  1089. onClick = { this._onToolbarToggleRaiseHand }
  1090. text = { t(`toolbar.${raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`) } />);
  1091. }
  1092. if (this.props._shouldShowButton('participants-pane') || this.props._shouldShowButton('invite')) {
  1093. buttons.has('participants-pane')
  1094. ? mainMenuAdditionalButtons.push(
  1095. <ToolbarButton
  1096. accessibilityLabel = { t('toolbar.accessibilityLabel.participants') }
  1097. icon = { IconParticipants }
  1098. key = 'participants'
  1099. onClick = { this._onToolbarToggleParticipantsPane }
  1100. toggled = { this.props._participantsPaneOpen }
  1101. tooltip = { t('toolbar.participants') } />)
  1102. : overflowMenuAdditionalButtons.push(
  1103. <OverflowMenuItem
  1104. accessibilityLabel = { t('toolbar.accessibilityLabel.participants') }
  1105. icon = { IconParticipants }
  1106. key = 'participants-pane'
  1107. onClick = { this._onToolbarToggleParticipantsPane }
  1108. text = { t('toolbar.participants') } />
  1109. );
  1110. }
  1111. if (this.props._shouldShowButton('tileview')) {
  1112. buttons.has('tileview')
  1113. ? mainMenuAdditionalButtons.push(
  1114. <TileViewButton
  1115. key = 'tileview'
  1116. showLabel = { false } />)
  1117. : overflowMenuAdditionalButtons.push(
  1118. <TileViewButton
  1119. key = 'tileview'
  1120. showLabel = { true } />);
  1121. }
  1122. return {
  1123. mainMenuAdditionalButtons,
  1124. overflowMenuAdditionalButtons
  1125. };
  1126. }
  1127. /**
  1128. * Renders the Audio controlling button.
  1129. *
  1130. * @returns {ReactElement}
  1131. */
  1132. _renderAudioButton() {
  1133. return this.props._shouldShowButton('microphone')
  1134. ? <AudioSettingsButton
  1135. key = 'asb'
  1136. visible = { true } />
  1137. : null;
  1138. }
  1139. /**
  1140. * Renders the Video controlling button.
  1141. *
  1142. * @returns {ReactElement}
  1143. */
  1144. _renderVideoButton() {
  1145. return this.props._shouldShowButton('camera')
  1146. ? <VideoSettingsButton
  1147. key = 'vsb'
  1148. visible = { true } />
  1149. : null;
  1150. }
  1151. /**
  1152. * Renders the toolbox content.
  1153. *
  1154. * @returns {ReactElement}
  1155. */
  1156. _renderToolboxContent() {
  1157. const {
  1158. _clientWidth,
  1159. _isMobile,
  1160. _overflowMenuVisible,
  1161. t
  1162. } = this.props;
  1163. const buttonSet = getToolbarAdditionalButtons(_clientWidth, _isMobile);
  1164. const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
  1165. const showOverflowMenuButton = buttonSet.has('overflow');
  1166. const containerClassName = `toolbox-content${_isMobile ? ' toolbox-content-mobile' : ''}`;
  1167. let overflowMenuAdditionalButtons = [];
  1168. let mainMenuAdditionalButtons = [];
  1169. if (showOverflowMenuButton) {
  1170. ({ overflowMenuAdditionalButtons, mainMenuAdditionalButtons } = this._getAdditionalButtons(buttonSet));
  1171. }
  1172. return (
  1173. <div className = { containerClassName }>
  1174. <div
  1175. className = 'toolbox-content-wrapper'
  1176. onFocus = { this._onTabIn }
  1177. onMouseOut = { this._onMouseOut }
  1178. onMouseOver = { this._onMouseOver }>
  1179. <div className = 'toolbox-content-items'>
  1180. { this._renderAudioButton() }
  1181. { this._renderVideoButton() }
  1182. { mainMenuAdditionalButtons }
  1183. { showOverflowMenuButton && <OverflowMenuButton
  1184. ariaControls = 'overflow-menu'
  1185. isOpen = { _overflowMenuVisible }
  1186. key = 'overflow-menu'
  1187. onVisibilityChange = { this._onSetOverflowVisible }>
  1188. <ul
  1189. aria-label = { t(toolbarAccLabel) }
  1190. className = 'overflow-menu'
  1191. id = 'overflow-menu'
  1192. onKeyDown = { this._onEscKey }
  1193. role = 'menu'>
  1194. { this._renderOverflowMenuContent(overflowMenuAdditionalButtons) }
  1195. </ul>
  1196. </OverflowMenuButton>}
  1197. <HangupButton
  1198. customClass = 'hangup-button'
  1199. key = 'hangup-button'
  1200. visible = { this.props._shouldShowButton('hangup') } />
  1201. </div>
  1202. </div>
  1203. </div>
  1204. );
  1205. }
  1206. }
  1207. /**
  1208. * Maps (parts of) the redux state to {@link Toolbox}'s React {@code Component}
  1209. * props.
  1210. *
  1211. * @param {Object} state - The redux store/state.
  1212. * @private
  1213. * @returns {{}}
  1214. */
  1215. function _mapStateToProps(state) {
  1216. const { conference, locked } = state['features/base/conference'];
  1217. let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
  1218. const {
  1219. callStatsID,
  1220. enableFeaturesBasedOnToken
  1221. } = state['features/base/config'];
  1222. const {
  1223. fullScreen,
  1224. overflowMenuVisible
  1225. } = state['features/toolbox'];
  1226. const localParticipant = getLocalParticipant(state);
  1227. const localRecordingStates = state['features/local-recording'];
  1228. const localVideo = getLocalVideoTrack(state['features/base/tracks']);
  1229. const { clientWidth } = state['features/base/responsive-ui'];
  1230. let desktopSharingDisabledTooltipKey;
  1231. if (enableFeaturesBasedOnToken) {
  1232. // we enable desktop sharing if any participant already have this
  1233. // feature enabled
  1234. desktopSharingEnabled = getParticipants(state)
  1235. .find(({ features = {} }) =>
  1236. String(features['screen-sharing']) === 'true') !== undefined;
  1237. desktopSharingDisabledTooltipKey = 'dialog.shareYourScreenDisabled';
  1238. }
  1239. return {
  1240. _chatOpen: state['features/chat'].isOpen,
  1241. _clientWidth: clientWidth,
  1242. _conference: conference,
  1243. _desktopSharingEnabled: desktopSharingEnabled,
  1244. _backgroundType: state['features/virtual-background'].backgroundType,
  1245. _virtualSource: state['features/virtual-background'].virtualSource,
  1246. _desktopSharingDisabledTooltipKey: desktopSharingDisabledTooltipKey,
  1247. _dialog: Boolean(state['features/base/dialog'].component),
  1248. _feedbackConfigured: Boolean(callStatsID),
  1249. _isProfileDisabled: Boolean(state['features/base/config'].disableProfile),
  1250. _isMobile: isMobileBrowser(),
  1251. _isVpaasMeeting: isVpaasMeeting(state),
  1252. _fullScreen: fullScreen,
  1253. _tileViewEnabled: shouldDisplayTileView(state),
  1254. _localParticipantID: localParticipant.id,
  1255. _localVideo: localVideo,
  1256. _localRecState: localRecordingStates,
  1257. _locked: locked,
  1258. _overflowMenuVisible: overflowMenuVisible,
  1259. _participantsPaneOpen: getParticipantsPaneOpen(state),
  1260. _raisedHand: localParticipant.raisedHand,
  1261. _screensharing: isScreenVideoShared(state),
  1262. _shouldShowButton: buttonName => isToolbarButtonEnabled(buttonName)(state),
  1263. _visible: isToolboxVisible(state),
  1264. _visibleButtons: getToolbarButtons(state)
  1265. };
  1266. }
  1267. export default translate(connect(_mapStateToProps)(Toolbox));