import React from 'react'; import PropTypes from 'prop-types'; import cn from 'classnames'; import styles from './ChangeUsernameDialog.css'; import InputField from './InputField'; import { Button, Dialog } from 'plugin-api/beta/client/components/ui'; import { t } from 'plugin-api/beta/client/services'; class ChangeUsernameDialog extends React.Component { state = { showError: false, }; showError = () => { this.setState({ showError: true, }); }; confirmChanges = async () => { if (this.formHasError()) { this.showError(); } else { // await this.props.saveChanges this.props.closeDialog(); } }; formHasError = () => this.props.formData.confirmNewUsername !== this.props.formData.newUsername; render() { return ( ×

{t('talk-plugin-auth.change_username.confirm_username_change')}

{t('talk-plugin-auth.change_username.description')}

{t('talk-plugin-auth.change_username.old_username')}:{' '} {this.props.username} {t('talk-plugin-auth.change_username.new_username')}:{' '} {this.props.formData.newUsername}
{t('talk-plugin-auth.change_username.bottom_note')}
); } } ChangeUsernameDialog.propTypes = { closeDialog: PropTypes.func, showDialog: PropTypes.bool, onChange: PropTypes.func, username: PropTypes.string, formData: PropTypes.object, }; export default ChangeUsernameDialog;