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.

OverflowMenu.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // @flow
  2. import React, { PureComponent } from 'react';
  3. import { Divider } from 'react-native-paper';
  4. import { connect } from 'react-redux';
  5. import { hideSheet } from '../../../base/dialog/actions';
  6. import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
  7. import { bottomSheetStyles } from '../../../base/dialog/components/native/styles';
  8. import SettingsButton from '../../../base/settings/components/native/SettingsButton';
  9. import SharedDocumentButton from '../../../etherpad/components/SharedDocumentButton.native';
  10. import ReactionMenu from '../../../reactions/components/native/ReactionMenu';
  11. import { isReactionsEnabled } from '../../../reactions/functions.any';
  12. import LiveStreamButton from '../../../recording/components/LiveStream/native/LiveStreamButton';
  13. import RecordButton from '../../../recording/components/Recording/native/RecordButton';
  14. import SecurityDialogButton
  15. from '../../../security/components/security-dialog/native/SecurityDialogButton';
  16. import SharedVideoButton from '../../../shared-video/components/native/SharedVideoButton';
  17. import SpeakerStatsButton from '../../../speaker-stats/components/native/SpeakerStatsButton';
  18. import { isSpeakerStatsDisabled } from '../../../speaker-stats/functions';
  19. import ClosedCaptionButton from '../../../subtitles/components/native/ClosedCaptionButton';
  20. import TileViewButton from '../../../video-layout/components/TileViewButton';
  21. import styles from '../../../video-menu/components/native/styles';
  22. import { getMovableButtons } from '../../functions.native';
  23. import AudioOnlyButton from './AudioOnlyButton';
  24. import LinkToSalesforceButton from './LinkToSalesforceButton';
  25. import OpenCarmodeButton from './OpenCarmodeButton';
  26. import RaiseHandButton from './RaiseHandButton';
  27. import ScreenSharingButton from './ScreenSharingButton';
  28. /**
  29. * The type of the React {@code Component} props of {@link OverflowMenu}.
  30. */
  31. type Props = {
  32. /**
  33. * True if the overflow menu is currently visible, false otherwise.
  34. */
  35. _isOpen: boolean,
  36. /**
  37. * Whether the recoding button should be enabled or not.
  38. */
  39. _recordingEnabled: boolean,
  40. /**
  41. * The width of the screen.
  42. */
  43. _width: number,
  44. /**
  45. * Whether or not the reactions feature is enabled.
  46. */
  47. _reactionsEnabled: boolean,
  48. /**
  49. * Used for hiding the dialog when the selection was completed.
  50. */
  51. dispatch: Function,
  52. /**
  53. * Whether or not speaker stats is disable.
  54. */
  55. _isSpeakerStatsDisabled: boolean
  56. };
  57. type State = {
  58. /**
  59. * True if the bottom scheet is scrolled to the top.
  60. */
  61. scrolledToTop: boolean
  62. }
  63. /**
  64. * Implements a React {@code Component} with some extra actions in addition to
  65. * those in the toolbar.
  66. */
  67. class OverflowMenu extends PureComponent<Props, State> {
  68. /**
  69. * Initializes a new {@code OverflowMenu} instance.
  70. *
  71. * @inheritdoc
  72. */
  73. constructor(props: Props) {
  74. super(props);
  75. this.state = {
  76. scrolledToTop: true
  77. };
  78. // Bind event handlers so they are only bound once per instance.
  79. this._onCancel = this._onCancel.bind(this);
  80. this._renderReactionMenu = this._renderReactionMenu.bind(this);
  81. }
  82. /**
  83. * Implements React's {@link Component#render()}.
  84. *
  85. * @inheritdoc
  86. * @returns {ReactElement}
  87. */
  88. render() {
  89. const {
  90. _isSpeakerStatsDisabled,
  91. _reactionsEnabled,
  92. _width
  93. } = this.props;
  94. const toolbarButtons = getMovableButtons(_width);
  95. const buttonProps = {
  96. afterClick: this._onCancel,
  97. showLabel: true,
  98. styles: bottomSheetStyles.buttons
  99. };
  100. const topButtonProps = {
  101. afterClick: this._onCancel,
  102. showLabel: true,
  103. styles: {
  104. ...bottomSheetStyles.buttons,
  105. style: {
  106. ...bottomSheetStyles.buttons.style,
  107. borderTopLeftRadius: 16,
  108. borderTopRightRadius: 16
  109. }
  110. }
  111. };
  112. return (
  113. <BottomSheet
  114. renderFooter = { _reactionsEnabled && !toolbarButtons.has('raisehand')
  115. ? this._renderReactionMenu
  116. : null }>
  117. <OpenCarmodeButton { ...topButtonProps } />
  118. <AudioOnlyButton { ...buttonProps } />
  119. {!_reactionsEnabled && !toolbarButtons.has('raisehand') && <RaiseHandButton { ...buttonProps } />}
  120. <Divider style = { styles.divider } />
  121. <SecurityDialogButton { ...buttonProps } />
  122. <RecordButton { ...buttonProps } />
  123. <LiveStreamButton { ...buttonProps } />
  124. <LinkToSalesforceButton { ...buttonProps } />
  125. <Divider style = { styles.divider } />
  126. <SharedVideoButton { ...buttonProps } />
  127. {!toolbarButtons.has('screensharing') && <ScreenSharingButton { ...buttonProps } />}
  128. {!_isSpeakerStatsDisabled && <SpeakerStatsButton { ...buttonProps } />}
  129. {!toolbarButtons.has('tileview') && <TileViewButton { ...buttonProps } />}
  130. <Divider style = { styles.divider } />
  131. <ClosedCaptionButton { ...buttonProps } />
  132. <SharedDocumentButton { ...buttonProps } />
  133. <SettingsButton { ...buttonProps } />
  134. </BottomSheet>
  135. );
  136. }
  137. /**
  138. * Hides this {@code OverflowMenu}.
  139. *
  140. * @private
  141. * @returns {void}
  142. */
  143. _onCancel() {
  144. this.props.dispatch(hideSheet());
  145. }
  146. /**
  147. * Functoin to render the reaction menu as the footer of the bottom sheet.
  148. *
  149. * @returns {React$Element}
  150. */
  151. _renderReactionMenu() {
  152. return (<ReactionMenu
  153. onCancel = { this._onCancel }
  154. overflowMenu = { true } />);
  155. }
  156. }
  157. /**
  158. * Function that maps parts of Redux state tree into component props.
  159. *
  160. * @param {Object} state - Redux state.
  161. * @private
  162. * @returns {Props}
  163. */
  164. function _mapStateToProps(state) {
  165. return {
  166. _isSpeakerStatsDisabled: isSpeakerStatsDisabled(state),
  167. _reactionsEnabled: isReactionsEnabled(state),
  168. _width: state['features/base/responsive-ui'].clientWidth
  169. };
  170. }
  171. export default connect(_mapStateToProps)(OverflowMenu);