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.

OverflowMenu.js 2.6KB

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