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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542
  1. /* eslint-disable lines-around-comment */
  2. import { withStyles } from '@material-ui/core/styles';
  3. import React, { Component } from 'react';
  4. import { WithTranslation } from 'react-i18next';
  5. import { batch } from 'react-redux';
  6. // @ts-ignore
  7. import keyboardShortcut from '../../../../../modules/keyboardshortcut/keyboardshortcut';
  8. import {
  9. ACTION_SHORTCUT_TRIGGERED,
  10. createShortcutEvent,
  11. createToolbarEvent,
  12. sendAnalytics
  13. // @ts-ignore
  14. } from '../../../analytics';
  15. // @ts-ignore
  16. import { ContextMenu, ContextMenuItemGroup } from '../../../base/components';
  17. // @ts-ignore
  18. import { getMultipleVideoSendingSupportFeatureFlag, getToolbarButtons } from '../../../base/config';
  19. // @ts-ignore
  20. import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
  21. // @ts-ignore
  22. import { openDialog, toggleDialog } from '../../../base/dialog';
  23. import { isIosMobileBrowser, isMobileBrowser } from '../../../base/environment/utils';
  24. import { translate } from '../../../base/i18n/functions';
  25. import JitsiMeetJS from '../../../base/lib-jitsi-meet';
  26. import {
  27. raiseHand
  28. } from '../../../base/participants/actions';
  29. import {
  30. getLocalParticipant,
  31. hasRaisedHand
  32. } from '../../../base/participants/functions';
  33. import { connect } from '../../../base/redux/functions';
  34. // @ts-ignore
  35. import { getLocalVideoTrack } from '../../../base/tracks';
  36. // @ts-ignore
  37. import { toggleChat } from '../../../chat';
  38. // @ts-ignore
  39. import { ChatButton } from '../../../chat/components';
  40. // @ts-ignore
  41. import { EmbedMeetingButton } from '../../../embed-meeting';
  42. // @ts-ignore
  43. import { SharedDocumentButton } from '../../../etherpad';
  44. // @ts-ignore
  45. import { FeedbackButton } from '../../../feedback';
  46. // @ts-ignore
  47. import { setGifMenuVisibility } from '../../../gifs/actions';
  48. // @ts-ignore
  49. import { isGifEnabled } from '../../../gifs/functions';
  50. // @ts-ignore
  51. import { InviteButton } from '../../../invite/components/add-people-dialog';
  52. // @ts-ignore
  53. import { isVpaasMeeting } from '../../../jaas/functions';
  54. // @ts-ignore
  55. import { KeyboardShortcutsButton } from '../../../keyboard-shortcuts';
  56. import { NoiseSuppressionButton } from '../../../noise-suppression/components';
  57. import {
  58. close as closeParticipantsPane,
  59. open as openParticipantsPane
  60. // @ts-ignore
  61. } from '../../../participants-pane/actions';
  62. // @ts-ignore
  63. import { ParticipantsPaneButton } from '../../../participants-pane/components/web';
  64. // @ts-ignore
  65. import { getParticipantsPaneOpen } from '../../../participants-pane/functions';
  66. import { addReactionToBuffer } from '../../../reactions/actions.any';
  67. import { toggleReactionsMenuVisibility } from '../../../reactions/actions.web';
  68. import ReactionsMenuButton from '../../../reactions/components/web/ReactionsMenuButton';
  69. import { REACTIONS } from '../../../reactions/constants';
  70. import { isReactionsEnabled } from '../../../reactions/functions.any';
  71. import {
  72. LiveStreamButton,
  73. RecordButton
  74. // @ts-ignore
  75. } from '../../../recording';
  76. // @ts-ignore
  77. import { isSalesforceEnabled } from '../../../salesforce/functions';
  78. import {
  79. isScreenAudioSupported,
  80. isScreenVideoShared,
  81. ShareAudioButton,
  82. startScreenShareFlow
  83. // @ts-ignore
  84. } from '../../../screen-share';
  85. // @ts-ignore
  86. import SecurityDialogButton from '../../../security/components/security-dialog/web/SecurityDialogButton';
  87. // @ts-ignore
  88. import { SettingsButton } from '../../../settings';
  89. // @ts-ignore
  90. import { SharedVideoButton } from '../../../shared-video/components';
  91. // @ts-ignore
  92. import { SpeakerStatsButton } from '../../../speaker-stats/components/web';
  93. import {
  94. ClosedCaptionButton
  95. // @ts-ignore
  96. } from '../../../subtitles';
  97. import {
  98. TileViewButton,
  99. shouldDisplayTileView,
  100. toggleTileView
  101. // @ts-ignore
  102. } from '../../../video-layout';
  103. // @ts-ignore
  104. import { VideoQualityDialog, VideoQualityButton } from '../../../video-quality/components';
  105. // @ts-ignore
  106. import { VideoBackgroundButton, toggleBackgroundEffect } from '../../../virtual-background';
  107. import { VIRTUAL_BACKGROUND_TYPE } from '../../../virtual-background/constants';
  108. import {
  109. setFullScreen,
  110. setHangupMenuVisible,
  111. setOverflowMenuVisible,
  112. setToolbarHovered,
  113. showToolbox
  114. // @ts-ignore
  115. } from '../../actions';
  116. import { THRESHOLDS, NOT_APPLICABLE, NOTIFY_CLICK_MODE } from '../../constants';
  117. // @ts-ignore
  118. import { isDesktopShareButtonDisabled, isToolboxVisible } from '../../functions';
  119. // @ts-ignore
  120. import DownloadButton from '../DownloadButton';
  121. // @ts-ignore
  122. import HangupButton from '../HangupButton';
  123. // @ts-ignore
  124. import HelpButton from '../HelpButton';
  125. // @ts-ignore
  126. import AudioSettingsButton from './AudioSettingsButton';
  127. // @ts-ignore
  128. import DockIframeButton from './DockIframeButton';
  129. import { EndConferenceButton } from './EndConferenceButton';
  130. // @ts-ignore
  131. import FullscreenButton from './FullscreenButton';
  132. import HangupMenuButton from './HangupMenuButton';
  133. import { LeaveConferenceButton } from './LeaveConferenceButton';
  134. // @ts-ignore
  135. import LinkToSalesforceButton from './LinkToSalesforceButton';
  136. // @ts-ignore
  137. import OverflowMenuButton from './OverflowMenuButton';
  138. // @ts-ignore
  139. import ProfileButton from './ProfileButton';
  140. // @ts-ignore
  141. import Separator from './Separator';
  142. // @ts-ignore
  143. import ShareDesktopButton from './ShareDesktopButton';
  144. // @ts-ignore
  145. import ToggleCameraButton from './ToggleCameraButton';
  146. // @ts-ignore
  147. import UndockIframeButton from './UndockIframeButton';
  148. // @ts-ignore
  149. import VideoSettingsButton from './VideoSettingsButton';
  150. /**
  151. * The type of the React {@code Component} props of {@link Toolbox}.
  152. */
  153. interface Props extends WithTranslation {
  154. /**
  155. * String showing if the virtual background type is desktop-share.
  156. */
  157. _backgroundType: String,
  158. /**
  159. * Toolbar buttons which have their click exposed through the API.
  160. */
  161. _buttonsWithNotifyClick: Array<string | {
  162. key: string;
  163. preventExecution: boolean;
  164. }>,
  165. /**
  166. * Whether or not the chat feature is currently displayed.
  167. */
  168. _chatOpen: boolean,
  169. /**
  170. * The width of the client.
  171. */
  172. _clientWidth: number,
  173. /**
  174. * The {@code JitsiConference} for the current conference.
  175. */
  176. _conference: Object,
  177. /**
  178. * Whether or not screensharing button is disabled.
  179. */
  180. _desktopSharingButtonDisabled: boolean,
  181. /**
  182. * Whether or not screensharing is initialized.
  183. */
  184. _desktopSharingEnabled: boolean,
  185. /**
  186. * Whether or not a dialog is displayed.
  187. */
  188. _dialog: boolean,
  189. /**
  190. * Whether or not the toolbox is disabled. It is for recorders.
  191. */
  192. _disabled: boolean,
  193. /**
  194. * Whether the end conference feature is supported.
  195. */
  196. _endConferenceSupported: boolean,
  197. /**
  198. * Whether or not call feedback can be sent.
  199. */
  200. _feedbackConfigured: boolean,
  201. /**
  202. * Whether or not the app is currently in full screen.
  203. */
  204. _fullScreen: boolean,
  205. /**
  206. * Whether or not the GIFs feature is enabled.
  207. */
  208. _gifsEnabled: boolean,
  209. /**
  210. * Whether the hangup menu is visible.
  211. */
  212. _hangupMenuVisible: boolean,
  213. /**
  214. * Whether the app has Salesforce integration.
  215. */
  216. _hasSalesforce: boolean,
  217. /**
  218. * Whether or not the app is running in an ios mobile browser.
  219. */
  220. _isIosMobile: boolean,
  221. /**
  222. * Whether or not the app is running in mobile browser.
  223. */
  224. _isMobile: boolean,
  225. /**
  226. * Whether or not the profile is disabled.
  227. */
  228. _isProfileDisabled: boolean,
  229. /**
  230. * Whether or not the current meeting belongs to a JaaS user.
  231. */
  232. _isVpaasMeeting: boolean,
  233. /**
  234. * The ID of the local participant.
  235. */
  236. _localParticipantID: String,
  237. /**
  238. * The JitsiLocalTrack to display.
  239. */
  240. _localVideo: Object,
  241. /**
  242. * Whether or not multi-stream send support is enabled.
  243. */
  244. _multiStreamModeEnabled: boolean,
  245. /**
  246. * Whether or not the overflow menu is displayed in a drawer drawer.
  247. */
  248. _overflowDrawer: boolean,
  249. /**
  250. * Whether or not the overflow menu is visible.
  251. */
  252. _overflowMenuVisible: boolean,
  253. /**
  254. * Whether or not the participants pane is open.
  255. */
  256. _participantsPaneOpen: boolean,
  257. /**
  258. * Whether or not the local participant's hand is raised.
  259. */
  260. _raisedHand: boolean,
  261. /**
  262. * Whether or not reactions feature is enabled.
  263. */
  264. _reactionsEnabled: boolean,
  265. /**
  266. * Whether or not the local participant is screenSharing.
  267. */
  268. _screenSharing: boolean,
  269. /**
  270. * Whether or not the local participant is sharing a YouTube video.
  271. */
  272. _sharingVideo: boolean,
  273. /**
  274. * Whether or not the tile view is enabled.
  275. */
  276. _tileViewEnabled: boolean,
  277. /**
  278. * The enabled buttons.
  279. */
  280. _toolbarButtons: Array<string>,
  281. /**
  282. * Returns the selected virtual source object.
  283. */
  284. _virtualSource: any,
  285. /**
  286. * Flag showing whether toolbar is visible.
  287. */
  288. _visible: boolean,
  289. /**
  290. * An object containing the CSS classes.
  291. */
  292. classes: any,
  293. /**
  294. * Invoked to active other features of the app.
  295. */
  296. dispatch: Function,
  297. /**
  298. * Explicitly passed array with the buttons which this Toolbox should display.
  299. */
  300. toolbarButtons: Array<string>,
  301. }
  302. declare let APP: any;
  303. const styles = () => {
  304. return {
  305. contextMenu: {
  306. position: 'relative',
  307. right: 'auto',
  308. maxHeight: 'inherit',
  309. margin: 0
  310. },
  311. hangupMenu: {
  312. position: 'relative',
  313. right: 'auto',
  314. display: 'flex',
  315. flexDirection: 'column',
  316. rowGap: '8px',
  317. margin: 0,
  318. padding: '16px'
  319. }
  320. };
  321. };
  322. /**
  323. * Implements the conference toolbox on React/Web.
  324. *
  325. * @augments Component
  326. */
  327. class Toolbox extends Component<Props> {
  328. /**
  329. * Initializes a new {@code Toolbox} instance.
  330. *
  331. * @param {Props} props - The read-only React {@code Component} props with
  332. * which the new instance is to be initialized.
  333. */
  334. constructor(props: Props) {
  335. super(props);
  336. // Bind event handlers so they are only bound once per instance.
  337. this._onMouseOut = this._onMouseOut.bind(this);
  338. this._onMouseOver = this._onMouseOver.bind(this);
  339. this._onSetHangupVisible = this._onSetHangupVisible.bind(this);
  340. this._onSetOverflowVisible = this._onSetOverflowVisible.bind(this);
  341. this._onTabIn = this._onTabIn.bind(this);
  342. this._onShortcutToggleChat = this._onShortcutToggleChat.bind(this);
  343. this._onShortcutToggleFullScreen = this._onShortcutToggleFullScreen.bind(this);
  344. this._onShortcutToggleParticipantsPane = this._onShortcutToggleParticipantsPane.bind(this);
  345. this._onShortcutToggleRaiseHand = this._onShortcutToggleRaiseHand.bind(this);
  346. this._onShortcutToggleScreenshare = this._onShortcutToggleScreenshare.bind(this);
  347. this._onShortcutToggleVideoQuality = this._onShortcutToggleVideoQuality.bind(this);
  348. this._onToolbarToggleParticipantsPane = this._onToolbarToggleParticipantsPane.bind(this);
  349. this._onToolbarOpenVideoQuality = this._onToolbarOpenVideoQuality.bind(this);
  350. this._onToolbarToggleChat = this._onToolbarToggleChat.bind(this);
  351. this._onToolbarToggleFullScreen = this._onToolbarToggleFullScreen.bind(this);
  352. this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);
  353. this._onToolbarToggleScreenshare = this._onToolbarToggleScreenshare.bind(this);
  354. this._onShortcutToggleTileView = this._onShortcutToggleTileView.bind(this);
  355. this._onEscKey = this._onEscKey.bind(this);
  356. }
  357. /**
  358. * Sets keyboard shortcuts for to trigger ToolbarButtons actions.
  359. *
  360. * @inheritdoc
  361. * @returns {void}
  362. */
  363. componentDidMount() {
  364. const { _toolbarButtons, t, dispatch, _reactionsEnabled, _gifsEnabled } = this.props;
  365. const KEYBOARD_SHORTCUTS = [
  366. isToolbarButtonEnabled('videoquality', _toolbarButtons) && {
  367. character: 'A',
  368. exec: this._onShortcutToggleVideoQuality,
  369. helpDescription: 'toolbar.callQuality'
  370. },
  371. isToolbarButtonEnabled('chat', _toolbarButtons) && {
  372. character: 'C',
  373. exec: this._onShortcutToggleChat,
  374. helpDescription: 'keyboardShortcuts.toggleChat'
  375. },
  376. isToolbarButtonEnabled('desktop', _toolbarButtons) && {
  377. character: 'D',
  378. exec: this._onShortcutToggleScreenshare,
  379. helpDescription: 'keyboardShortcuts.toggleScreensharing'
  380. },
  381. isToolbarButtonEnabled('participants-pane', _toolbarButtons) && {
  382. character: 'P',
  383. exec: this._onShortcutToggleParticipantsPane,
  384. helpDescription: 'keyboardShortcuts.toggleParticipantsPane'
  385. },
  386. isToolbarButtonEnabled('raisehand', _toolbarButtons) && {
  387. character: 'R',
  388. exec: this._onShortcutToggleRaiseHand,
  389. helpDescription: 'keyboardShortcuts.raiseHand'
  390. },
  391. isToolbarButtonEnabled('fullscreen', _toolbarButtons) && {
  392. character: 'S',
  393. exec: this._onShortcutToggleFullScreen,
  394. helpDescription: 'keyboardShortcuts.fullScreen'
  395. },
  396. isToolbarButtonEnabled('tileview', _toolbarButtons) && {
  397. character: 'W',
  398. exec: this._onShortcutToggleTileView,
  399. helpDescription: 'toolbar.tileViewToggle'
  400. }
  401. ];
  402. KEYBOARD_SHORTCUTS.forEach(shortcut => {
  403. if (typeof shortcut === 'object') {
  404. APP.keyboardshortcut.registerShortcut(
  405. shortcut.character,
  406. null,
  407. shortcut.exec,
  408. shortcut.helpDescription);
  409. }
  410. });
  411. if (_reactionsEnabled) {
  412. const REACTION_SHORTCUTS = Object.keys(REACTIONS).map(key => {
  413. const onShortcutSendReaction = () => {
  414. dispatch(addReactionToBuffer(key));
  415. sendAnalytics(createShortcutEvent(
  416. `reaction.${key}`
  417. ));
  418. };
  419. return {
  420. character: REACTIONS[key].shortcutChar,
  421. exec: onShortcutSendReaction,
  422. helpDescription: t(`toolbar.reaction${key.charAt(0).toUpperCase()}${key.slice(1)}`),
  423. altKey: true
  424. };
  425. });
  426. REACTION_SHORTCUTS.forEach(shortcut => {
  427. APP.keyboardshortcut.registerShortcut(
  428. shortcut.character,
  429. null,
  430. shortcut.exec,
  431. shortcut.helpDescription,
  432. shortcut.altKey);
  433. });
  434. if (_gifsEnabled) {
  435. const onGifShortcut = () => {
  436. batch(() => {
  437. dispatch(toggleReactionsMenuVisibility());
  438. dispatch(setGifMenuVisibility(true));
  439. });
  440. };
  441. APP.keyboardshortcut.registerShortcut(
  442. 'G',
  443. null,
  444. onGifShortcut,
  445. t('keyboardShortcuts.giphyMenu')
  446. );
  447. }
  448. }
  449. }
  450. /**
  451. * Update the visibility of the {@code OverflowMenuButton}.
  452. *
  453. * @inheritdoc
  454. */
  455. componentDidUpdate(prevProps: Props) {
  456. const { _dialog, _visible, dispatch } = this.props;
  457. if (prevProps._overflowMenuVisible
  458. && !prevProps._dialog
  459. && _dialog) {
  460. this._onSetOverflowVisible(false);
  461. dispatch(setToolbarHovered(false));
  462. }
  463. if (prevProps._hangupMenuVisible
  464. && prevProps._visible
  465. && !_visible) {
  466. this._onSetHangupVisible(false);
  467. dispatch(setToolbarHovered(false));
  468. }
  469. }
  470. /**
  471. * Removes keyboard shortcuts registered by this component.
  472. *
  473. * @inheritdoc
  474. * @returns {void}
  475. */
  476. componentWillUnmount() {
  477. [ 'A', 'C', 'D', 'R', 'S' ].forEach(letter =>
  478. APP.keyboardshortcut.unregisterShortcut(letter));
  479. if (this.props._reactionsEnabled) {
  480. Object.keys(REACTIONS).map(key => REACTIONS[key].shortcutChar)
  481. .forEach(letter =>
  482. APP.keyboardshortcut.unregisterShortcut(letter, true));
  483. }
  484. }
  485. /**
  486. * Implements React's {@link Component#render()}.
  487. *
  488. * @inheritdoc
  489. * @returns {ReactElement}
  490. */
  491. render() {
  492. if (this.props._disabled) {
  493. return null;
  494. }
  495. const { _chatOpen, _visible, _toolbarButtons } = this.props;
  496. const rootClassNames = `new-toolbox ${_visible ? 'visible' : ''} ${
  497. _toolbarButtons.length ? '' : 'no-buttons'} ${_chatOpen ? 'shift-right' : ''}`;
  498. return (
  499. <div
  500. className = { rootClassNames }
  501. id = 'new-toolbox'>
  502. { this._renderToolboxContent() }
  503. </div>
  504. );
  505. }
  506. /**
  507. * Key handler for overflow/hangup menus.
  508. *
  509. * @param {KeyboardEvent} e - Esc key click to close the popup.
  510. * @returns {void}
  511. */
  512. _onEscKey(e: React.KeyboardEvent) {
  513. if (e.key === 'Escape') {
  514. e.stopPropagation();
  515. this._closeHangupMenuIfOpen();
  516. this._closeOverflowMenuIfOpen();
  517. }
  518. }
  519. /**
  520. * Closes the hangup menu if opened.
  521. *
  522. * @private
  523. * @returns {void}
  524. */
  525. _closeHangupMenuIfOpen() {
  526. const { dispatch, _hangupMenuVisible } = this.props;
  527. _hangupMenuVisible && dispatch(setHangupMenuVisible(false));
  528. }
  529. /**
  530. * Closes the overflow menu if opened.
  531. *
  532. * @private
  533. * @returns {void}
  534. */
  535. _closeOverflowMenuIfOpen() {
  536. const { dispatch, _overflowMenuVisible } = this.props;
  537. _overflowMenuVisible && dispatch(setOverflowMenuVisible(false));
  538. }
  539. /**
  540. * Dispatches an action to open the video quality dialog.
  541. *
  542. * @private
  543. * @returns {void}
  544. */
  545. _doOpenVideoQuality() {
  546. this.props.dispatch(openDialog(VideoQualityDialog));
  547. }
  548. /**
  549. * Dispatches an action to toggle the display of chat.
  550. *
  551. * @private
  552. * @returns {void}
  553. */
  554. _doToggleChat() {
  555. this.props.dispatch(toggleChat());
  556. }
  557. /**
  558. * Dispatches an action to toggle screensharing.
  559. *
  560. * @private
  561. * @returns {void}
  562. */
  563. _doToggleFullScreen() {
  564. const fullScreen = !this.props._fullScreen;
  565. this.props.dispatch(setFullScreen(fullScreen));
  566. }
  567. /**
  568. * Dispatches an action to toggle the local participant's raised hand state.
  569. *
  570. * @private
  571. * @returns {void}
  572. */
  573. _doToggleRaiseHand() {
  574. const { _raisedHand } = this.props;
  575. this.props.dispatch(raiseHand(!_raisedHand));
  576. }
  577. /**
  578. * Dispatches an action to toggle screensharing.
  579. *
  580. * @private
  581. * @param {boolean} enabled - The state to toggle screen sharing to.
  582. * @param {boolean} audioOnly - Only share system audio.
  583. * @returns {void}
  584. */
  585. _doToggleScreenshare() {
  586. const {
  587. _backgroundType,
  588. _desktopSharingButtonDisabled,
  589. _desktopSharingEnabled,
  590. _localVideo,
  591. _screenSharing,
  592. _virtualSource,
  593. dispatch
  594. } = this.props;
  595. if (_backgroundType === VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE) {
  596. const noneOptions = {
  597. enabled: false,
  598. backgroundType: VIRTUAL_BACKGROUND_TYPE.NONE,
  599. selectedThumbnail: VIRTUAL_BACKGROUND_TYPE.NONE,
  600. backgroundEffectEnabled: false
  601. };
  602. _virtualSource.dispose();
  603. dispatch(toggleBackgroundEffect(noneOptions, _localVideo));
  604. return;
  605. }
  606. if (_desktopSharingEnabled && !_desktopSharingButtonDisabled) {
  607. dispatch(startScreenShareFlow(!_screenSharing));
  608. }
  609. }
  610. /**
  611. * Dispatches an action to toggle the video quality dialog.
  612. *
  613. * @private
  614. * @returns {void}
  615. */
  616. _doToggleVideoQuality() {
  617. this.props.dispatch(toggleDialog(VideoQualityDialog));
  618. }
  619. /**
  620. * Dispaches an action to toggle tile view.
  621. *
  622. * @private
  623. * @returns {void}
  624. */
  625. _doToggleTileView() {
  626. this.props.dispatch(toggleTileView());
  627. }
  628. /**
  629. * Returns all buttons that could be rendered.
  630. *
  631. * @param {Object} state - The redux state.
  632. * @returns {Object} The button maps mainMenuButtons and overflowMenuButtons.
  633. */
  634. _getAllButtons() {
  635. const {
  636. _feedbackConfigured,
  637. _isIosMobile,
  638. _isMobile,
  639. _hasSalesforce,
  640. _multiStreamModeEnabled,
  641. _screenSharing
  642. } = this.props;
  643. const microphone = {
  644. key: 'microphone',
  645. Content: AudioSettingsButton,
  646. group: 0
  647. };
  648. const camera = {
  649. key: 'camera',
  650. Content: VideoSettingsButton,
  651. group: 0
  652. };
  653. const profile = this._isProfileVisible() && {
  654. key: 'profile',
  655. Content: ProfileButton,
  656. group: 1
  657. };
  658. const chat = {
  659. key: 'chat',
  660. Content: ChatButton,
  661. handleClick: this._onToolbarToggleChat,
  662. group: 2
  663. };
  664. const desktop = this._showDesktopSharingButton() && {
  665. key: 'desktop',
  666. Content: ShareDesktopButton,
  667. handleClick: this._onToolbarToggleScreenshare,
  668. group: 2
  669. };
  670. const raisehand = {
  671. key: 'raisehand',
  672. Content: ReactionsMenuButton,
  673. handleClick: this._onToolbarToggleRaiseHand,
  674. group: 2
  675. };
  676. const participants = {
  677. key: 'participants-pane',
  678. Content: ParticipantsPaneButton,
  679. handleClick: this._onToolbarToggleParticipantsPane,
  680. group: 2
  681. };
  682. const invite = {
  683. key: 'invite',
  684. Content: InviteButton,
  685. group: 2
  686. };
  687. const tileview = {
  688. key: 'tileview',
  689. Content: TileViewButton,
  690. group: 2
  691. };
  692. const toggleCamera = {
  693. key: 'toggle-camera',
  694. Content: ToggleCameraButton,
  695. group: 2
  696. };
  697. const videoQuality = {
  698. key: 'videoquality',
  699. Content: VideoQualityButton,
  700. handleClick: this._onToolbarOpenVideoQuality,
  701. group: 2
  702. };
  703. const fullscreen = !_isIosMobile && {
  704. key: 'fullscreen',
  705. Content: FullscreenButton,
  706. handleClick: this._onToolbarToggleFullScreen,
  707. group: 2
  708. };
  709. const security = {
  710. key: 'security',
  711. alias: 'info',
  712. Content: SecurityDialogButton,
  713. group: 2
  714. };
  715. const cc = {
  716. key: 'closedcaptions',
  717. Content: ClosedCaptionButton,
  718. group: 2
  719. };
  720. const recording = {
  721. key: 'recording',
  722. Content: RecordButton,
  723. group: 2
  724. };
  725. const livestreaming = {
  726. key: 'livestreaming',
  727. Content: LiveStreamButton,
  728. group: 2
  729. };
  730. const linkToSalesforce = _hasSalesforce && {
  731. key: 'linktosalesforce',
  732. Content: LinkToSalesforceButton,
  733. group: 2
  734. };
  735. const shareVideo = {
  736. key: 'sharedvideo',
  737. Content: SharedVideoButton,
  738. group: 3
  739. };
  740. const shareAudio = this._showAudioSharingButton() && {
  741. key: 'shareaudio',
  742. Content: ShareAudioButton,
  743. group: 3
  744. };
  745. const noiseSuppression = {
  746. key: 'noisesuppression',
  747. Content: NoiseSuppressionButton,
  748. group: 3
  749. };
  750. const etherpad = {
  751. key: 'etherpad',
  752. Content: SharedDocumentButton,
  753. group: 3
  754. };
  755. const virtualBackground = (_multiStreamModeEnabled || !_screenSharing) && {
  756. key: 'select-background',
  757. Content: VideoBackgroundButton,
  758. group: 3
  759. };
  760. const dockIframe = {
  761. key: 'dock-iframe',
  762. Content: DockIframeButton,
  763. group: 3
  764. };
  765. const undockIframe = {
  766. key: 'undock-iframe',
  767. Content: UndockIframeButton,
  768. group: 3
  769. };
  770. const speakerStats = {
  771. key: 'stats',
  772. Content: SpeakerStatsButton,
  773. group: 3
  774. };
  775. const settings = {
  776. key: 'settings',
  777. Content: SettingsButton,
  778. group: 4
  779. };
  780. const shortcuts = !_isMobile && keyboardShortcut.getEnabled() && {
  781. key: 'shortcuts',
  782. Content: KeyboardShortcutsButton,
  783. group: 4
  784. };
  785. const embed = this._isEmbedMeetingVisible() && {
  786. key: 'embedmeeting',
  787. Content: EmbedMeetingButton,
  788. group: 4
  789. };
  790. const feedback = _feedbackConfigured && {
  791. key: 'feedback',
  792. Content: FeedbackButton,
  793. group: 4
  794. };
  795. const download = {
  796. key: 'download',
  797. Content: DownloadButton,
  798. group: 4
  799. };
  800. const help = {
  801. key: 'help',
  802. Content: HelpButton,
  803. group: 4
  804. };
  805. return {
  806. microphone,
  807. camera,
  808. profile,
  809. desktop,
  810. chat,
  811. raisehand,
  812. participants,
  813. invite,
  814. tileview,
  815. toggleCamera,
  816. videoQuality,
  817. fullscreen,
  818. security,
  819. cc,
  820. recording,
  821. livestreaming,
  822. linkToSalesforce,
  823. shareVideo,
  824. shareAudio,
  825. noiseSuppression,
  826. etherpad,
  827. virtualBackground,
  828. dockIframe,
  829. undockIframe,
  830. speakerStats,
  831. settings,
  832. shortcuts,
  833. embed,
  834. feedback,
  835. download,
  836. help
  837. };
  838. }
  839. /**
  840. * Returns the notify mode of the given toolbox button.
  841. *
  842. * @param {string} btnName - The toolbar button's name.
  843. * @returns {string|undefined} - The button's notify mode.
  844. */
  845. _getButtonNotifyMode(btnName: string) {
  846. const notify = this.props._buttonsWithNotifyClick?.find(
  847. btn =>
  848. (typeof btn === 'string' && btn === btnName)
  849. || (typeof btn === 'object' && btn.key === btnName)
  850. );
  851. if (notify) {
  852. return typeof notify === 'string' || notify.preventExecution
  853. ? NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
  854. : NOTIFY_CLICK_MODE.ONLY_NOTIFY;
  855. }
  856. }
  857. /**
  858. * Sets the notify click mode for the buttons.
  859. *
  860. * @param {Object} buttons - The list of toolbar buttons.
  861. * @returns {void}
  862. */
  863. _setButtonsNotifyClickMode(buttons: Object) {
  864. if (typeof APP === 'undefined' || !this.props._buttonsWithNotifyClick?.length) {
  865. return;
  866. }
  867. Object.values(buttons).forEach((button: any) => {
  868. if (typeof button === 'object') {
  869. button.notifyMode = this._getButtonNotifyMode(button.key);
  870. }
  871. });
  872. }
  873. /**
  874. * Returns all buttons that need to be rendered.
  875. *
  876. * @param {Object} state - The redux state.
  877. * @returns {Object} The visible buttons arrays .
  878. */
  879. _getVisibleButtons() {
  880. const {
  881. _clientWidth,
  882. _toolbarButtons
  883. } = this.props;
  884. const buttons = this._getAllButtons();
  885. this._setButtonsNotifyClickMode(buttons);
  886. const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
  887. const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
  888. || THRESHOLDS[THRESHOLDS.length - 1];
  889. let sliceIndex = order.length + 2;
  890. const keys = Object.keys(buttons);
  891. const filtered = [
  892. ...order.map(key => buttons[key as keyof typeof buttons]),
  893. ...Object.values(buttons).filter((button, index) => !order.includes(keys[index]))
  894. ].filter(Boolean).filter(({ key, alias = NOT_APPLICABLE }) =>
  895. isToolbarButtonEnabled(key, _toolbarButtons) || isToolbarButtonEnabled(alias, _toolbarButtons));
  896. if (isHangupVisible) {
  897. sliceIndex -= 1;
  898. }
  899. // This implies that the overflow button will be displayed, so save some space for it.
  900. if (sliceIndex < filtered.length) {
  901. sliceIndex -= 1;
  902. }
  903. return {
  904. mainMenuButtons: filtered.slice(0, sliceIndex),
  905. overflowMenuButtons: filtered.slice(sliceIndex)
  906. };
  907. }
  908. /**
  909. * Dispatches an action signaling the toolbar is not being hovered.
  910. *
  911. * @private
  912. * @returns {void}
  913. */
  914. _onMouseOut() {
  915. const { _overflowMenuVisible, dispatch } = this.props;
  916. !_overflowMenuVisible && dispatch(setToolbarHovered(false));
  917. }
  918. /**
  919. * Dispatches an action signaling the toolbar is being hovered.
  920. *
  921. * @private
  922. * @returns {void}
  923. */
  924. _onMouseOver() {
  925. this.props.dispatch(setToolbarHovered(true));
  926. }
  927. /**
  928. * Sets the visibility of the hangup menu.
  929. *
  930. * @param {boolean} visible - Whether or not the hangup menu should be
  931. * displayed.
  932. * @private
  933. * @returns {void}
  934. */
  935. _onSetHangupVisible(visible: boolean) {
  936. this.props.dispatch(setHangupMenuVisible(visible));
  937. this.props.dispatch(setToolbarHovered(visible));
  938. }
  939. /**
  940. * Sets the visibility of the overflow menu.
  941. *
  942. * @param {boolean} visible - Whether or not the overflow menu should be
  943. * displayed.
  944. * @private
  945. * @returns {void}
  946. */
  947. _onSetOverflowVisible(visible: boolean) {
  948. this.props.dispatch(setOverflowMenuVisible(visible));
  949. this.props.dispatch(setToolbarHovered(visible));
  950. }
  951. /**
  952. * Creates an analytics keyboard shortcut event and dispatches an action for
  953. * toggling the display of chat.
  954. *
  955. * @private
  956. * @returns {void}
  957. */
  958. _onShortcutToggleChat() {
  959. sendAnalytics(createShortcutEvent(
  960. 'toggle.chat',
  961. {
  962. enable: !this.props._chatOpen
  963. }));
  964. // Checks if there was any text selected by the user.
  965. // Used for when we press simultaneously keys for copying
  966. // text messages from the chat board
  967. if (window.getSelection()?.toString() !== '') {
  968. return false;
  969. }
  970. this._doToggleChat();
  971. }
  972. /**
  973. * Creates an analytics keyboard shortcut event and dispatches an action for
  974. * toggling the display of the participants pane.
  975. *
  976. * @private
  977. * @returns {void}
  978. */
  979. _onShortcutToggleParticipantsPane() {
  980. sendAnalytics(createShortcutEvent(
  981. 'toggle.participants-pane',
  982. {
  983. enable: !this.props._participantsPaneOpen
  984. }));
  985. this._onToolbarToggleParticipantsPane();
  986. }
  987. /**
  988. * Creates an analytics keyboard shortcut event and dispatches an action for
  989. * toggling the display of Video Quality.
  990. *
  991. * @private
  992. * @returns {void}
  993. */
  994. _onShortcutToggleVideoQuality() {
  995. sendAnalytics(createShortcutEvent('video.quality'));
  996. this._doToggleVideoQuality();
  997. }
  998. /**
  999. * Dispatches an action for toggling the tile view.
  1000. *
  1001. * @private
  1002. * @returns {void}
  1003. */
  1004. _onShortcutToggleTileView() {
  1005. sendAnalytics(createShortcutEvent(
  1006. 'toggle.tileview',
  1007. {
  1008. enable: !this.props._tileViewEnabled
  1009. }));
  1010. this._doToggleTileView();
  1011. }
  1012. /**
  1013. * Creates an analytics keyboard shortcut event and dispatches an action for
  1014. * toggling full screen mode.
  1015. *
  1016. * @private
  1017. * @returns {void}
  1018. */
  1019. _onShortcutToggleFullScreen() {
  1020. sendAnalytics(createShortcutEvent(
  1021. 'toggle.fullscreen',
  1022. {
  1023. enable: !this.props._fullScreen
  1024. }));
  1025. this._doToggleFullScreen();
  1026. }
  1027. /**
  1028. * Creates an analytics keyboard shortcut event and dispatches an action for
  1029. * toggling raise hand.
  1030. *
  1031. * @private
  1032. * @returns {void}
  1033. */
  1034. _onShortcutToggleRaiseHand() {
  1035. sendAnalytics(createShortcutEvent(
  1036. 'toggle.raise.hand',
  1037. ACTION_SHORTCUT_TRIGGERED,
  1038. { enable: !this.props._raisedHand }));
  1039. this._doToggleRaiseHand();
  1040. }
  1041. /**
  1042. * Creates an analytics keyboard shortcut event and dispatches an action for
  1043. * toggling screensharing.
  1044. *
  1045. * @private
  1046. * @returns {void}
  1047. */
  1048. _onShortcutToggleScreenshare() {
  1049. // Ignore the shortcut if the button is disabled.
  1050. if (this.props._desktopSharingButtonDisabled) {
  1051. return;
  1052. }
  1053. sendAnalytics(createShortcutEvent(
  1054. 'toggle.screen.sharing',
  1055. ACTION_SHORTCUT_TRIGGERED,
  1056. {
  1057. enable: !this.props._screenSharing
  1058. }));
  1059. this._doToggleScreenshare();
  1060. }
  1061. /**
  1062. * Toggle the toolbar visibility when tabbing into it.
  1063. *
  1064. * @returns {void}
  1065. */
  1066. _onTabIn() {
  1067. if (!this.props._visible) {
  1068. this.props.dispatch(showToolbox());
  1069. }
  1070. }
  1071. /**
  1072. * Dispatches an action for toggling the participants pane.
  1073. *
  1074. * @private
  1075. * @returns {void}
  1076. */
  1077. _onToolbarToggleParticipantsPane() {
  1078. const { dispatch, _participantsPaneOpen } = this.props;
  1079. if (_participantsPaneOpen) {
  1080. dispatch(closeParticipantsPane());
  1081. } else {
  1082. dispatch(openParticipantsPane());
  1083. }
  1084. }
  1085. /**
  1086. * Creates an analytics toolbar event and dispatches an action for toggling
  1087. * open the video quality dialog.
  1088. *
  1089. * @private
  1090. * @returns {void}
  1091. */
  1092. _onToolbarOpenVideoQuality() {
  1093. sendAnalytics(createToolbarEvent('video.quality'));
  1094. this._doOpenVideoQuality();
  1095. }
  1096. /**
  1097. * Creates an analytics toolbar event and dispatches an action for toggling
  1098. * the display of chat.
  1099. *
  1100. * @private
  1101. * @returns {void}
  1102. */
  1103. _onToolbarToggleChat() {
  1104. sendAnalytics(createToolbarEvent(
  1105. 'toggle.chat',
  1106. {
  1107. enable: !this.props._chatOpen
  1108. }));
  1109. this._closeOverflowMenuIfOpen();
  1110. this._doToggleChat();
  1111. }
  1112. /**
  1113. * Creates an analytics toolbar event and dispatches an action for toggling
  1114. * full screen mode.
  1115. *
  1116. * @private
  1117. * @returns {void}
  1118. */
  1119. _onToolbarToggleFullScreen() {
  1120. sendAnalytics(createToolbarEvent(
  1121. 'toggle.fullscreen',
  1122. {
  1123. enable: !this.props._fullScreen
  1124. }));
  1125. this._closeOverflowMenuIfOpen();
  1126. this._doToggleFullScreen();
  1127. }
  1128. /**
  1129. * Creates an analytics toolbar event and dispatches an action for toggling
  1130. * raise hand.
  1131. *
  1132. * @private
  1133. * @returns {void}
  1134. */
  1135. _onToolbarToggleRaiseHand() {
  1136. sendAnalytics(createToolbarEvent(
  1137. 'raise.hand',
  1138. { enable: !this.props._raisedHand }));
  1139. this._doToggleRaiseHand();
  1140. }
  1141. /**
  1142. * Creates an analytics toolbar event and dispatches an action for toggling
  1143. * screensharing.
  1144. *
  1145. * @private
  1146. * @returns {void}
  1147. */
  1148. _onToolbarToggleScreenshare() {
  1149. sendAnalytics(createToolbarEvent(
  1150. 'toggle.screen.sharing',
  1151. ACTION_SHORTCUT_TRIGGERED,
  1152. { enable: !this.props._screenSharing }));
  1153. this._closeOverflowMenuIfOpen();
  1154. this._doToggleScreenshare();
  1155. }
  1156. /**
  1157. * Returns true if the audio sharing button should be visible and
  1158. * false otherwise.
  1159. *
  1160. * @returns {boolean}
  1161. */
  1162. _showAudioSharingButton() {
  1163. const {
  1164. _desktopSharingEnabled
  1165. } = this.props;
  1166. return _desktopSharingEnabled && isScreenAudioSupported();
  1167. }
  1168. /**
  1169. * Returns true if the desktop sharing button should be visible and
  1170. * false otherwise.
  1171. *
  1172. * @returns {boolean}
  1173. */
  1174. _showDesktopSharingButton() {
  1175. return this.props._desktopSharingEnabled;
  1176. }
  1177. /**
  1178. * Returns true if the embed meeting button is visible and false otherwise.
  1179. *
  1180. * @returns {boolean}
  1181. */
  1182. _isEmbedMeetingVisible() {
  1183. return !this.props._isVpaasMeeting
  1184. && !this.props._isMobile;
  1185. }
  1186. /**
  1187. * Returns true if the profile button is visible and false otherwise.
  1188. *
  1189. * @returns {boolean}
  1190. */
  1191. _isProfileVisible() {
  1192. return !this.props._isProfileDisabled;
  1193. }
  1194. /**
  1195. * Renders the toolbox content.
  1196. *
  1197. * @returns {ReactElement}
  1198. */
  1199. _renderToolboxContent() {
  1200. const {
  1201. _endConferenceSupported,
  1202. _hangupMenuVisible,
  1203. _isMobile,
  1204. _overflowDrawer,
  1205. _overflowMenuVisible,
  1206. _reactionsEnabled,
  1207. _toolbarButtons,
  1208. classes,
  1209. t
  1210. } = this.props;
  1211. const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
  1212. const containerClassName = `toolbox-content${_isMobile ? ' toolbox-content-mobile' : ''}`;
  1213. const { mainMenuButtons, overflowMenuButtons } = this._getVisibleButtons();
  1214. return (
  1215. <div className = { containerClassName }>
  1216. <div
  1217. className = 'toolbox-content-wrapper'
  1218. onFocus = { this._onTabIn }
  1219. { ...(_isMobile ? {} : {
  1220. onMouseOut: this._onMouseOut,
  1221. onMouseOver: this._onMouseOver
  1222. }) }>
  1223. <div className = 'toolbox-content-items'>
  1224. {mainMenuButtons.map(({ Content, key, ...rest }) => Content !== Separator && (
  1225. <Content
  1226. { ...rest }
  1227. buttonKey = { key }
  1228. key = { key } />))}
  1229. {Boolean(overflowMenuButtons.length) && (
  1230. <OverflowMenuButton
  1231. ariaControls = 'overflow-menu'
  1232. isOpen = { _overflowMenuVisible }
  1233. key = 'overflow-menu'
  1234. onVisibilityChange = { this._onSetOverflowVisible }
  1235. showMobileReactions = {
  1236. _reactionsEnabled && overflowMenuButtons.find(({ key }) => key === 'raisehand')
  1237. }>
  1238. <ContextMenu
  1239. accessibilityLabel = { t(toolbarAccLabel) }
  1240. className = { classes.contextMenu }
  1241. hidden = { false }
  1242. inDrawer = { _overflowDrawer }
  1243. onKeyDown = { this._onEscKey }>
  1244. {overflowMenuButtons.reduce((acc, val) => {
  1245. if (acc.length) {
  1246. const prev = acc[acc.length - 1];
  1247. const group = prev[prev.length - 1].group;
  1248. if (group === val.group) {
  1249. prev.push(val);
  1250. } else {
  1251. acc.push([ val ]);
  1252. }
  1253. } else {
  1254. acc.push([ val ]);
  1255. }
  1256. return acc;
  1257. }, []).map((buttonGroup: any) => (
  1258. <ContextMenuItemGroup key = { `group-${buttonGroup[0].group}` }>
  1259. {buttonGroup.map(({ key, Content, ...rest }: any) => (
  1260. key !== 'raisehand' || !_reactionsEnabled)
  1261. && <Content
  1262. { ...rest }
  1263. buttonKey = { key }
  1264. contextMenu = { true }
  1265. key = { key }
  1266. showLabel = { true } />)}
  1267. </ContextMenuItemGroup>))}
  1268. </ContextMenu>
  1269. </OverflowMenuButton>
  1270. )}
  1271. { isToolbarButtonEnabled('hangup', _toolbarButtons) && (
  1272. _endConferenceSupported
  1273. ? <HangupMenuButton
  1274. ariaControls = 'hangup-menu'
  1275. isOpen = { _hangupMenuVisible }
  1276. key = 'hangup-menu'
  1277. onVisibilityChange = { this._onSetHangupVisible }>
  1278. <ContextMenu
  1279. accessibilityLabel = { t(toolbarAccLabel) }
  1280. className = { classes.hangupMenu }
  1281. hidden = { false }
  1282. inDrawer = { _overflowDrawer }
  1283. onKeyDown = { this._onEscKey }>
  1284. <EndConferenceButton />
  1285. <LeaveConferenceButton />
  1286. </ContextMenu>
  1287. </HangupMenuButton>
  1288. : <HangupButton
  1289. buttonKey = 'hangup'
  1290. customClass = 'hangup-button'
  1291. key = 'hangup-button'
  1292. notifyMode = { this._getButtonNotifyMode('hangup') }
  1293. visible = { isToolbarButtonEnabled('hangup', _toolbarButtons) } />
  1294. )}
  1295. </div>
  1296. </div>
  1297. </div>
  1298. );
  1299. }
  1300. }
  1301. /**
  1302. * Maps (parts of) the redux state to {@link Toolbox}'s React {@code Component}
  1303. * props.
  1304. *
  1305. * @param {Object} state - The redux store/state.
  1306. * @param {Object} ownProps - The props explicitly passed.
  1307. * @private
  1308. * @returns {{}}
  1309. */
  1310. function _mapStateToProps(state: any, ownProps: Partial<Props>) {
  1311. const { conference } = state['features/base/conference'];
  1312. const endConferenceSupported = conference?.isEndConferenceSupported();
  1313. const {
  1314. buttonsWithNotifyClick,
  1315. callStatsID,
  1316. disableProfile,
  1317. iAmRecorder,
  1318. iAmSipGateway
  1319. } = state['features/base/config'];
  1320. const {
  1321. fullScreen,
  1322. hangupMenuVisible,
  1323. overflowMenuVisible,
  1324. overflowDrawer
  1325. } = state['features/toolbox'];
  1326. const localParticipant = getLocalParticipant(state);
  1327. const localVideo = getLocalVideoTrack(state['features/base/tracks']);
  1328. const { clientWidth } = state['features/base/responsive-ui'];
  1329. const toolbarButtons = ownProps.toolbarButtons || getToolbarButtons(state);
  1330. return {
  1331. _backgroundType: state['features/virtual-background'].backgroundType,
  1332. _buttonsWithNotifyClick: buttonsWithNotifyClick,
  1333. _chatOpen: state['features/chat'].isOpen,
  1334. _clientWidth: clientWidth,
  1335. _conference: conference,
  1336. _desktopSharingEnabled: JitsiMeetJS.isDesktopSharingEnabled(),
  1337. _desktopSharingButtonDisabled: isDesktopShareButtonDisabled(state),
  1338. _dialog: Boolean(state['features/base/dialog'].component),
  1339. _disabled: Boolean(iAmRecorder || iAmSipGateway),
  1340. _endConferenceSupported: Boolean(endConferenceSupported),
  1341. _feedbackConfigured: Boolean(callStatsID),
  1342. _fullScreen: fullScreen,
  1343. _gifsEnabled: isGifEnabled(state),
  1344. _isProfileDisabled: Boolean(disableProfile),
  1345. _isIosMobile: isIosMobileBrowser(),
  1346. _isMobile: isMobileBrowser(),
  1347. _isVpaasMeeting: isVpaasMeeting(state),
  1348. _hasSalesforce: isSalesforceEnabled(state),
  1349. _hangupMenuVisible: hangupMenuVisible,
  1350. _localParticipantID: localParticipant?.id,
  1351. _localVideo: localVideo,
  1352. _multiStreamModeEnabled: getMultipleVideoSendingSupportFeatureFlag(state),
  1353. _overflowMenuVisible: overflowMenuVisible,
  1354. _overflowDrawer: overflowDrawer,
  1355. _participantsPaneOpen: getParticipantsPaneOpen(state),
  1356. _raisedHand: hasRaisedHand(localParticipant),
  1357. _reactionsEnabled: isReactionsEnabled(state),
  1358. _screenSharing: isScreenVideoShared(state),
  1359. _tileViewEnabled: shouldDisplayTileView(state),
  1360. _toolbarButtons: toolbarButtons,
  1361. _virtualSource: state['features/virtual-background'].virtualSource,
  1362. _visible: isToolboxVisible(state)
  1363. };
  1364. }
  1365. // @ts-ignore
  1366. export default translate(connect(_mapStateToProps)(withStyles(styles)(Toolbox)));