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.

Toolbar.web.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import {
  5. AudioMuteButton,
  6. HangupButton,
  7. SettingsButton,
  8. VideoMuteButton
  9. } from '../../toolbox';
  10. declare var interfaceConfig: Object;
  11. /**
  12. * The type of the React {@code Component} props of {@link Toolbar}.
  13. */
  14. type Props = {
  15. /**
  16. * The set of buttons which should be visible in this {@code Toolbar}.
  17. */
  18. _visibleButtons: Set<string>
  19. };
  20. /**
  21. * Implements the conference toolbar on React/Web for filmstrip-only mode.
  22. *
  23. * @extends Component
  24. */
  25. class Toolbar extends Component<Props> {
  26. /**
  27. * Implements React's {@link Component#render()}.
  28. *
  29. * @inheritdoc
  30. * @returns {ReactElement}
  31. */
  32. render() {
  33. return (
  34. <div
  35. className = 'filmstrip-toolbox'
  36. id = 'new-toolbox'>
  37. <AudioMuteButton
  38. tooltipPosition = 'left'
  39. visible = { this._shouldShowButton('microphone') } />
  40. <HangupButton
  41. tooltipPosition = 'left'
  42. visible = { this._shouldShowButton('hangup') } />
  43. <VideoMuteButton
  44. tooltipPosition = 'left'
  45. visible = { this._shouldShowButton('camera') } />
  46. <SettingsButton
  47. tooltipPosition = 'left'
  48. visible = { this._shouldShowButton('fodeviceselection') } />
  49. </div>
  50. );
  51. }
  52. _shouldShowButton: (string) => boolean;
  53. /**
  54. * Returns if a button name has been explicitly configured to be displayed.
  55. *
  56. * @param {string} buttonName - The name of the button, as expected in
  57. * {@link intefaceConfig}.
  58. * @private
  59. * @returns {boolean} True if the button should be displayed, false
  60. * otherwise.
  61. */
  62. _shouldShowButton(buttonName) {
  63. return this.props._visibleButtons.has(buttonName);
  64. }
  65. }
  66. /**
  67. * Maps (parts of) the redux state to the associated props for this component.
  68. *
  69. * @param {Object} state - The Redux state.
  70. * @private
  71. * @returns {{
  72. * _visibleButtons: Set<string>
  73. * }}
  74. */
  75. function _mapStateToProps(state): Object { // eslint-disable-line no-unused-vars
  76. // XXX: We are not currently using state here, but in the future, when
  77. // interfaceConfig is part of redux we will.
  78. return {
  79. _visibleButtons: new Set(interfaceConfig.TOOLBAR_BUTTONS)
  80. };
  81. }
  82. export default connect(_mapStateToProps)(Toolbar);