Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Toolbox.js 5.1KB

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