2020-04-15 13:13:43 +00:00
|
|
|
// @flow
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
import React, { PureComponent } from 'react';
|
2020-04-15 13:13:43 +00:00
|
|
|
|
|
|
|
import { ConfirmDialog } from '../../../base/dialog';
|
|
|
|
import { translate } from '../../../base/i18n';
|
|
|
|
import { connect } from '../../../base/redux';
|
2020-05-20 08:25:31 +00:00
|
|
|
import { toggleLobbyMode } from '../../actions';
|
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Redux Dispatch function.
|
|
|
|
*/
|
|
|
|
dispatch: Function
|
|
|
|
};
|
2020-04-15 13:13:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a dialog that lets the user disable the lobby mode.
|
|
|
|
*/
|
2020-05-20 08:25:31 +00:00
|
|
|
class DisableLobbyModeDialog extends PureComponent<Props> {
|
|
|
|
/**
|
|
|
|
* Instantiates a new component.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this._onDisableLobbyMode = this._onDisableLobbyMode.bind(this);
|
|
|
|
}
|
|
|
|
|
2020-04-15 13:13:43 +00:00
|
|
|
/**
|
|
|
|
* Implements {@code PureComponent#render}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<ConfirmDialog
|
|
|
|
contentKey = 'lobby.disableDialogContent'
|
|
|
|
onSubmit = { this._onDisableLobbyMode } />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onDisableLobbyMode: () => void;
|
2020-05-20 08:25:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to be invoked when the user initiates the lobby mode disable flow.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDisableLobbyMode() {
|
|
|
|
this.props.dispatch(toggleLobbyMode(false));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2020-04-15 13:13:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect()(DisableLobbyModeDialog));
|