2023-07-13 12:27:34 +03:00
|
|
|
import React, { Component } from 'react';
|
2023-03-21 09:47:52 +02:00
|
|
|
import { connect } from 'react-redux';
|
2019-01-13 20:34:38 +01:00
|
|
|
|
2023-03-31 14:04:33 +03:00
|
|
|
import InputDialog from '../../../base/dialog/components/native/InputDialog';
|
2023-07-13 12:27:34 +03:00
|
|
|
import { onSetDisplayName } from '../../functions';
|
|
|
|
|
import { IProps } from '../../types';
|
2019-01-13 20:34:38 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements a component to render a display name prompt.
|
|
|
|
|
*/
|
2023-07-13 12:27:34 +03:00
|
|
|
class DisplayNamePrompt extends Component<IProps> {
|
|
|
|
|
_onSetDisplayName: (displayName: string) => boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a new {@code DisplayNamePrompt} instance.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
|
* instance is to be initialized.
|
|
|
|
|
*/
|
|
|
|
|
constructor(props: IProps) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
// Bind event handlers so they are only bound once for every instance.
|
|
|
|
|
this._onSetDisplayName = onSetDisplayName(props.dispatch, props.onPostSubmit);
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-13 20:34:38 +01:00
|
|
|
/**
|
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
|
*
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
*/
|
2025-03-12 10:19:11 -05:00
|
|
|
override render() {
|
2019-01-13 20:34:38 +01:00
|
|
|
return (
|
|
|
|
|
<InputDialog
|
2022-02-04 12:20:47 +02:00
|
|
|
descriptionKey = 'dialog.enterDisplayName'
|
2023-09-29 16:17:35 +03:00
|
|
|
disableCancel = { true }
|
2022-02-04 12:20:47 +02:00
|
|
|
onSubmit = { this._onSetDisplayName }
|
2023-09-29 16:17:35 +03:00
|
|
|
titleKey = 'dialog.displayNameRequired'
|
|
|
|
|
validateInput = { this.props.validateInput } />
|
2019-01-13 20:34:38 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect()(DisplayNamePrompt);
|