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 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // @flow
  2. import React from 'react';
  3. import { SafeAreaView, View } from 'react-native';
  4. import { ColorSchemeRegistry } from '../../../base/color-scheme';
  5. import { connect } from '../../../base/redux';
  6. import { StyleType } from '../../../base/styles';
  7. import { ChatButton } from '../../../chat';
  8. import { InviteButton } from '../../../invite';
  9. import { TileViewButton } from '../../../video-layout';
  10. import { isToolboxVisible, getMovableButtons } from '../../functions.native';
  11. import AudioMuteButton from '../AudioMuteButton';
  12. import HangupButton from '../HangupButton';
  13. import VideoMuteButton from '../VideoMuteButton';
  14. import OverflowMenuButton from './OverflowMenuButton';
  15. import RaiseHandButton from './RaiseHandButton';
  16. import ToggleCameraButton from './ToggleCameraButton';
  17. import styles from './styles';
  18. /**
  19. * The type of {@link Toolbox}'s React {@code Component} props.
  20. */
  21. type Props = {
  22. /**
  23. * The color-schemed stylesheet of the feature.
  24. */
  25. _styles: StyleType,
  26. /**
  27. * The indicator which determines whether the toolbox is visible.
  28. */
  29. _visible: boolean,
  30. /**
  31. * The width of the screen.
  32. */
  33. _width: number,
  34. /**
  35. * The redux {@code dispatch} function.
  36. */
  37. dispatch: Function
  38. };
  39. /**
  40. * Implements the conference Toolbox on React Native.
  41. *
  42. * @param {Object} props - The props of the component.
  43. * @returns {React$Element}.
  44. */
  45. function Toolbox(props: Props) {
  46. if (!props._visible) {
  47. return null;
  48. }
  49. const { _styles, _width } = props;
  50. const { buttonStylesBorderless, hangupButtonStyles, toggledButtonStyles } = _styles;
  51. const additionalButtons = getMovableButtons(_width);
  52. const backgroundToggledStyle = {
  53. ...toggledButtonStyles,
  54. style: [
  55. toggledButtonStyles.style,
  56. _styles.backgroundToggle
  57. ]
  58. };
  59. return (
  60. <View
  61. pointerEvents = 'box-none'
  62. style = { styles.toolboxContainer }>
  63. <SafeAreaView
  64. accessibilityRole = 'toolbar'
  65. pointerEvents = 'box-none'
  66. style = { styles.toolbox }>
  67. <AudioMuteButton
  68. styles = { buttonStylesBorderless }
  69. toggledStyles = { toggledButtonStyles } />
  70. <VideoMuteButton
  71. styles = { buttonStylesBorderless }
  72. toggledStyles = { toggledButtonStyles } />
  73. { additionalButtons.has('chat')
  74. && <ChatButton
  75. styles = { buttonStylesBorderless }
  76. toggledStyles = { backgroundToggledStyle } />}
  77. { additionalButtons.has('raisehand')
  78. && <RaiseHandButton
  79. styles = { buttonStylesBorderless }
  80. toggledStyles = { backgroundToggledStyle } />}
  81. {additionalButtons.has('tileview') && <TileViewButton styles = { buttonStylesBorderless } />}
  82. {additionalButtons.has('invite') && <InviteButton styles = { buttonStylesBorderless } />}
  83. {additionalButtons.has('togglecamera')
  84. && <ToggleCameraButton
  85. styles = { buttonStylesBorderless }
  86. toggledStyles = { backgroundToggledStyle } />}
  87. <OverflowMenuButton
  88. styles = { buttonStylesBorderless }
  89. toggledStyles = { toggledButtonStyles } />
  90. <HangupButton
  91. styles = { hangupButtonStyles } />
  92. </SafeAreaView>
  93. </View>
  94. );
  95. }
  96. /**
  97. * Maps parts of the redux state to {@link Toolbox} (React {@code Component})
  98. * props.
  99. *
  100. * @param {Object} state - The redux state of which parts are to be mapped to
  101. * {@code Toolbox} props.
  102. * @private
  103. * @returns {Props}
  104. */
  105. function _mapStateToProps(state: Object): Object {
  106. return {
  107. _styles: ColorSchemeRegistry.get(state, 'Toolbox'),
  108. _visible: isToolboxVisible(state),
  109. _width: state['features/base/responsive-ui'].clientWidth
  110. };
  111. }
  112. export default connect(_mapStateToProps)(Toolbox);