Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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