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

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