您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OverflowMenu.js 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { BottomSheet, hideDialog } from '../../../base/dialog';
  5. import { AudioRouteButton } from '../../../mobile/audio-mode';
  6. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  7. import { LiveStreamButton, RecordButton } from '../../../recording';
  8. import { RoomLockButton } from '../../../room-lock';
  9. import { ClosedCaptionButton } from '../../../subtitles';
  10. import { TileViewButton } from '../../../video-layout';
  11. import AudioOnlyButton from './AudioOnlyButton';
  12. import { overflowMenuItemStyles } from './styles';
  13. import ToggleCameraButton from './ToggleCameraButton';
  14. /**
  15. * The type of the React {@code Component} props of {@link OverflowMenu}.
  16. */
  17. type Props = {
  18. /**
  19. * Used for hiding the dialog when the selection was completed.
  20. */
  21. dispatch: Function,
  22. };
  23. /**
  24. * The exported React {@code Component}. We need it to execute
  25. * {@link hideDialog}.
  26. *
  27. * XXX It does not break our coding style rule to not utilize globals for state,
  28. * because it is merely another name for {@code export}'s {@code default}.
  29. */
  30. let OverflowMenu_; // eslint-disable-line prefer-const
  31. /**
  32. * Implements a React {@code Component} with some extra actions in addition to
  33. * those in the toolbar.
  34. */
  35. class OverflowMenu extends Component<Props> {
  36. /**
  37. * Initializes a new {@code OverflowMenu} instance.
  38. *
  39. * @inheritdoc
  40. */
  41. constructor(props: Props) {
  42. super(props);
  43. // Bind event handlers so they are only bound once per instance.
  44. this._onCancel = this._onCancel.bind(this);
  45. }
  46. /**
  47. * Implements React's {@link Component#render()}.
  48. *
  49. * @inheritdoc
  50. * @returns {ReactElement}
  51. */
  52. render() {
  53. const buttonProps = {
  54. afterClick: this._onCancel,
  55. showLabel: true,
  56. styles: overflowMenuItemStyles
  57. };
  58. return (
  59. <BottomSheet onCancel = { this._onCancel }>
  60. <AudioRouteButton { ...buttonProps } />
  61. <ToggleCameraButton { ...buttonProps } />
  62. <AudioOnlyButton { ...buttonProps } />
  63. <RoomLockButton { ...buttonProps } />
  64. <ClosedCaptionButton { ...buttonProps } />
  65. <RecordButton { ...buttonProps } />
  66. <LiveStreamButton { ...buttonProps } />
  67. <TileViewButton { ...buttonProps } />
  68. <PictureInPictureButton { ...buttonProps } />
  69. </BottomSheet>
  70. );
  71. }
  72. _onCancel: () => void;
  73. /**
  74. * Hides this {@code OverflowMenu}.
  75. *
  76. * @private
  77. * @returns {void}
  78. */
  79. _onCancel() {
  80. this.props.dispatch(hideDialog(OverflowMenu_));
  81. }
  82. }
  83. OverflowMenu_ = connect()(OverflowMenu);
  84. export default OverflowMenu_;