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.

DisableLobbyModeDialog.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // @flow
  2. import React, { PureComponent } from 'react';
  3. import { ConfirmDialog } from '../../../base/dialog';
  4. import { translate } from '../../../base/i18n';
  5. import { connect } from '../../../base/redux';
  6. import { toggleLobbyMode } from '../../actions';
  7. export type Props = {
  8. /**
  9. * The Redux Dispatch function.
  10. */
  11. dispatch: Function
  12. };
  13. /**
  14. * Implements a dialog that lets the user disable the lobby mode.
  15. */
  16. class DisableLobbyModeDialog extends PureComponent<Props> {
  17. /**
  18. * Instantiates a new component.
  19. *
  20. * @inheritdoc
  21. */
  22. constructor(props) {
  23. super(props);
  24. this._onDisableLobbyMode = this._onDisableLobbyMode.bind(this);
  25. }
  26. /**
  27. * Implements {@code PureComponent#render}.
  28. *
  29. * @inheritdoc
  30. */
  31. render() {
  32. return (
  33. <ConfirmDialog
  34. contentKey = 'lobby.disableDialogContent'
  35. onSubmit = { this._onDisableLobbyMode } />
  36. );
  37. }
  38. _onDisableLobbyMode: () => void;
  39. /**
  40. * Callback to be invoked when the user initiates the lobby mode disable flow.
  41. *
  42. * @returns {void}
  43. */
  44. _onDisableLobbyMode() {
  45. this.props.dispatch(toggleLobbyMode(false));
  46. return true;
  47. }
  48. }
  49. export default translate(connect()(DisableLobbyModeDialog));