import React from 'react'; import cn from 'classnames'; import PropTypes from 'prop-types'; import { Dialog } from 'coral-ui'; import styles from './BanUserDialog.css'; import Button from 'coral-ui/components/Button'; import t from 'coral-framework/services/i18n'; const initialState = { step: 0, message: '' }; class BanUserDialog extends React.Component { state = initialState; componentWillReceiveProps(next) { if (this.props.open && !next.open) { this.setState(initialState); } } handleMessageChange = e => { const { target: { value: message } } = e; this.setState({ message }); }; goToStep1 = () => { this.setState({ step: 1, message: t('bandialog.email_message_ban', this.props.username), }); }; handlePerform = () => { this.props.onPerform({ message: this.state.message, }); }; renderStep0() { const { onCancel, username, info } = this.props; return (

{t('bandialog.ban_user')}

{t('bandialog.are_you_sure', username)}

{info}

); } renderStep1() { const { onCancel } = this.props; const { message } = this.state; return (

{t('bandialog.notify_ban_headline')}

{t('bandialog.notify_ban_description')}

{t('bandialog.write_a_message')}