Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ToolboxFilmstrip.web.js 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { createToolbarEvent, sendAnalytics } from '../../analytics';
  5. import { translate } from '../../base/i18n';
  6. import { openDeviceSelectionDialog } from '../../device-selection';
  7. import ToolbarButtonV2 from './ToolbarButtonV2';
  8. import { AudioMuteButton, HangupButton, VideoMuteButton } from './buttons';
  9. declare var interfaceConfig: Object;
  10. /**
  11. * Implements the conference toolbox on React/Web for filmstrip only mode.
  12. *
  13. * @extends Component
  14. */
  15. class ToolboxFilmstrip extends Component<*> {
  16. _visibleButtons: Object;
  17. /**
  18. * Initializes a new {@code ToolboxFilmstrip} instance.
  19. *
  20. * @param {Props} props - The read-only React {@code Component} props with
  21. * which the new instance is to be initialized.
  22. */
  23. constructor(props) {
  24. super(props);
  25. this._visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
  26. // Bind event handlers so they are only bound once per instance.
  27. this._onToolbarOpenSettings = this._onToolbarOpenSettings.bind(this);
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. const { t } = this.props;
  37. return (
  38. <div className = 'filmstrip-toolbox'>
  39. { this._shouldShowButton('microphone')
  40. && <AudioMuteButton tooltipPosition = 'left' /> }
  41. { this._shouldShowButton('camera')
  42. && <VideoMuteButton tooltipPosition = 'left' /> }
  43. { this._shouldShowButton('fodeviceselection')
  44. && <ToolbarButtonV2
  45. iconName = 'icon-settings'
  46. onClick = { this._onToolbarOpenSettings }
  47. tooltip = { t('toolbar.Settings') }
  48. tooltipPosition = 'left' /> }
  49. { this._shouldShowButton('hangup')
  50. && <HangupButton tooltipPosition = 'left' /> }
  51. </div>
  52. );
  53. }
  54. _onToolbarOpenSettings: () => void;
  55. /**
  56. * Creates an analytics toolbar event for and dispatches an action to open
  57. * the device selection popup dialog.
  58. *
  59. * @private
  60. * @returns {void}
  61. */
  62. _onToolbarOpenSettings() {
  63. sendAnalytics(createToolbarEvent('filmstrip.only.device.selection'));
  64. this.props.dispatch(openDeviceSelectionDialog());
  65. }
  66. _shouldShowButton: (string) => boolean;
  67. /**
  68. * Returns if a button name has been explicitly configured to be displayed.
  69. *
  70. * @param {string} buttonName - The name of the button, as expected in
  71. * {@link intefaceConfig}.
  72. * @private
  73. * @returns {boolean} True if the button should be displayed.
  74. */
  75. _shouldShowButton(buttonName) {
  76. return this._visibleButtons.has(buttonName);
  77. }
  78. }
  79. export default translate(connect()(ToolboxFilmstrip));