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.4KB

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