import React from 'react'; import PropTypes from 'prop-types'; import { Dialog, BareButton } from 'coral-ui'; import styles from './RejectUsernameDialog.css'; import cn from 'classnames'; import { RadioGroup, Radio } from 'react-mdl'; import Button from 'coral-ui/components/Button'; import { username as flagReason } from 'coral-framework/graphql/flagReasons'; import t from 'coral-framework/services/i18n'; const initialState = { reason: flagReason.offensive, message: '' }; class RejectUsernameDialog extends React.Component { state = initialState; componentWillReceiveProps(next) { if (this.props.open && !next.open) { this.setState(initialState); } } handleReasonChange = event => { this.setState({ reason: event.target.value }); }; handleMessageChange = event => { this.setState({ message: event.target.value }); }; handlePerform = () => { this.props.onPerform({ reason: this.state.reason, message: this.state.message, }); }; render() { const { open, onCancel } = this.props; const { reason, message } = this.state; return (
×

{t('reject_username_dialog.title')}: {this.props.username}

{t('reject_username_dialog.description')}

{t('reject_username_dialog.reason')} {t('flag_reasons.username.offensive')} {t('flag_reasons.username.nolike')} {t('flag_reasons.username.impersonating')} {t('flag_reasons.username.spam')} {t('flag_reasons.username.other')} {reason === flagReason.other && (
{t('reject_username_dialog.message')}