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

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