You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Toolbox.js 43KB

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