123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- // @flow
-
- import { PureComponent } from 'react';
-
- import { getFieldValue } from '../../base/react';
- import { toggleLobbyMode } from '../actions';
-
- export type Props = {
-
- /**
- * The Redux Dispatch function.
- */
- dispatch: Function,
-
- /**
- * Function to be used to translate i18n labels.
- */
- t: Function
- };
-
- type State = {
-
- /**
- * The password value entered into the field.
- */
- password: string
- };
-
- /**
- * Abstract class to encapsulate the platform common code of the {@code EnableLobbyModeDialog}.
- */
- export default class AbstractEnableLobbyModeDialog<P: Props = Props> extends PureComponent<P, State> {
- /**
- * Instantiates a new component.
- *
- * @inheritdoc
- */
- constructor(props: P) {
- super(props);
-
- this.state = {
- password: ''
- };
-
- this._onEnableLobbyMode = this._onEnableLobbyMode.bind(this);
- this._onChangePassword = this._onChangePassword.bind(this);
- }
-
- _onChangePassword: Object => void;
-
- /**
- * Callback to be invoked when the user changes the password.
- *
- * @param {SyntheticEvent} event - The SyntheticEvent instance of the change.
- * @returns {void}
- */
- _onChangePassword(event) {
- this.setState({
- password: getFieldValue(event)
- });
- }
-
- _onEnableLobbyMode: () => void;
-
- /**
- * Callback to be invoked when the user initiates the lobby mode enable flow.
- *
- * @returns {void}
- */
- _onEnableLobbyMode() {
- this.props.dispatch(toggleLobbyMode(true, this.state.password));
-
- return true;
- }
- }
|