import React from 'react'; import { connect } from 'react-redux'; import clsx from 'clsx'; import { FormattedMessage as Message, defineMessages } from 'react-intl'; import { Input, TextArea, Button, Form, FormModel, Dropdown } from 'app/components/ui/form'; import feedback from 'app/services/api/feedback'; import icons from 'app/components/ui/icons.scss'; import popupStyles from 'app/components/ui/popup/popup.scss'; import { RootState } from 'app/reducers'; import logger from 'app/services/logger'; import { User } from 'app/components/user'; import styles from './contactForm.scss'; const CONTACT_CATEGORIES = { // TODO: сюда позже проставить реальные id категорий с backend 0: , 1: , 2: , 3: , 4: , }; const labels = defineMessages({ subject: 'Subject', email: 'E‑mail', message: 'Message', whichQuestion: 'What are you interested in?', send: 'Send', close: 'Close', }); export class ContactForm extends React.Component< { onClose: () => void; user: User; }, { isLoading: boolean; isSuccessfullySent: boolean; lastEmail: string | null; } > { static defaultProps = { onClose() {}, }; state = { isLoading: false, isSuccessfullySent: false, lastEmail: null, }; form = new FormModel(); render() { const { isSuccessfullySent } = this.state || {}; const { onClose } = this.props; return (

{isSuccessfullySent ? this.renderSuccess() : this.renderForm()}
); } renderForm() { const { form } = this; const { user } = this.props; const { isLoading } = this.state; return (