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 45KB

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