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

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