diff --git a/packages/app/src/app/pages/common/Modals/FeedbackModal/Feedback.js b/packages/app/src/app/pages/common/Modals/FeedbackModal/Feedback.js deleted file mode 100644 index aa4b7b48b17..00000000000 --- a/packages/app/src/app/pages/common/Modals/FeedbackModal/Feedback.js +++ /dev/null @@ -1,153 +0,0 @@ -import * as React from 'react'; -import { inject, observer } from 'app/componentConnectors'; -import Margin from '@codesandbox/common/lib/components/spacing/Margin'; -import { Button } from '@codesandbox/common/lib/components/Button'; - -import AutosizeTextArea from '@codesandbox/common/lib/components/AutosizeTextArea'; -import Input from '@codesandbox/common/lib/components/Input'; -import pushToAirtable from 'app/store/utils/pushToAirtable'; - -import { EmojiButton } from './elements'; - -class Feedback extends React.Component { - state = { - feedback: '', - email: (this.props.user || {}).email, - emoji: null, - loading: false, - }; - - onChange = e => { - this.setState({ [e.target.name]: e.target.value }); - }; - - onSubmit = evt => { - const { id, user, signals } = this.props; - const { feedback, emoji, email } = this.state; - evt.preventDefault(); - - this.setState({ loading: true }, () => { - pushToAirtable({ - sandboxId: id, - feedback, - emoji, - username: (user || {}).username, - email, - }) - .then(() => { - this.setState( - { - feedback: '', - emoji: null, - loading: false, - }, - () => { - signals.modalClosed(); - - signals.notificationAdded({ - message: `Thanks for your feedback!`, - type: 'success', - }); - } - ); - }) - .catch(e => { - signals.notificationAdded({ - message: `Something went wrong while sending feedback: ${ - e.message - }`, - type: 'error', - }); - - this.setState({ loading: false }); - }); - }); - }; - - setHappy = () => { - this.setState({ emoji: 'happy' }); - }; - - setSad = () => { - this.setState({ emoji: 'sad' }); - }; - - render() { - const { feedback, emoji, email } = this.state; - return ( -
- ); - } -} - -export default inject('signals')(observer(Feedback)); diff --git a/packages/app/src/app/pages/common/Modals/FeedbackModal/Feedback.tsx b/packages/app/src/app/pages/common/Modals/FeedbackModal/Feedback.tsx new file mode 100644 index 00000000000..e084d4c1add --- /dev/null +++ b/packages/app/src/app/pages/common/Modals/FeedbackModal/Feedback.tsx @@ -0,0 +1,132 @@ +import * as React from 'react'; +import { useOvermind } from 'app/overmind'; +import Margin from '@codesandbox/common/lib/components/spacing/Margin'; +import { Button } from '@codesandbox/common/lib/components/Button'; +import { CurrentUser } from '@codesandbox/common/lib/types'; + +import AutosizeTextArea from '@codesandbox/common/lib/components/AutosizeTextArea'; +import Input from '@codesandbox/common/lib/components/Input'; +import pushToAirtable from 'app/store/utils/pushToAirtable'; + +import { EmojiButton } from './elements'; + +interface ICollectionInfoProps { + id: string; + user: CurrentUser; +} + +const Feedback: React.FC