From b6a6348990c70751eb2a927159097bd586017fc7 Mon Sep 17 00:00:00 2001 From: mcbouslog Date: Fri, 15 Mar 2019 00:19:16 -0500 Subject: [PATCH 01/15] Init add feedback modal --- .../components/Feedback/FeedbackModal.js | 76 +++++++++++++++++++ .../components/Feedback/FeedbackModal.spec.js | 16 ++++ .../Classifier/components/Feedback/index.js | 1 + .../components/Feedback/locales/en.json | 6 ++ .../components/DefaultLayout/DefaultLayout.js | 2 + .../TaskArea/components/Tasks/Tasks.js | 2 - .../lib-classifier/src/store/FeedbackStore.js | 29 ++++++- .../src/store/FeedbackStore.spec.js | 16 +++- .../lib-classifier/src/store/SubjectStore.js | 9 ++- 9 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 packages/lib-classifier/src/components/Classifier/components/Feedback/FeedbackModal.js create mode 100644 packages/lib-classifier/src/components/Classifier/components/Feedback/FeedbackModal.spec.js create mode 100644 packages/lib-classifier/src/components/Classifier/components/Feedback/index.js create mode 100644 packages/lib-classifier/src/components/Classifier/components/Feedback/locales/en.json diff --git a/packages/lib-classifier/src/components/Classifier/components/Feedback/FeedbackModal.js b/packages/lib-classifier/src/components/Classifier/components/Feedback/FeedbackModal.js new file mode 100644 index 0000000000..5480dab9be --- /dev/null +++ b/packages/lib-classifier/src/components/Classifier/components/Feedback/FeedbackModal.js @@ -0,0 +1,76 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { inject, observer } from 'mobx-react' +import { Button, Box } from 'grommet' +import { Modal } from '@zooniverse/react-components' +import counterpart from 'counterpart' +import en from './locales/en' + +import SubjectViewer from '../SubjectViewer' + +counterpart.registerTranslations('en', en) + +function storeMapper(stores) { + const { + hideFeedback, + messages, + showModal + } = stores.classifierStore.feedback + return { + hideFeedback, + messages, + showModal + } +} + +@inject(storeMapper) +@observer +class FeedbackModal extends React.Component { + render () { + const label = counterpart('FeedbackModal.label') + const { hideFeedback, messages, showModal } = this.props + + if (showModal) { + return ( + hideFeedback()} + title={label} + > + <> + + +
    + {messages.map(message => +
  • + {message} +
  • + )} +
+
+ +