From 20242af3def51c60dfb302c4e1d553c929948d27 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Sat, 16 Jun 2018 18:19:31 -0400 Subject: [PATCH 01/48] preview view comment --- src/views/preview/preview.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/preview/preview.jsx b/src/views/preview/preview.jsx index c45f92646..013a0cec5 100644 --- a/src/views/preview/preview.jsx +++ b/src/views/preview/preview.jsx @@ -1,3 +1,6 @@ +// preview view can show either project page or editor page; +// idea is that we shouldn't require a page reload to switch back and forth + const bindAll = require('lodash.bindall'); const React = require('react'); const PropTypes = require('prop-types'); @@ -49,7 +52,7 @@ class Preview extends React.Component { this.props.getRemixes(this.state.projectId); this.props.getStudios(this.state.projectId); } - + } if (this.props.projectInfo.id !== prevProps.projectInfo.id) { this.initCounts(this.props.projectInfo.stats.favorites, this.props.projectInfo.stats.loves); @@ -157,7 +160,7 @@ class Preview extends React.Component { } } handlePermissions () { - // TODO: handle admins and mods + // TODO: handle admins and mods if (this.props.projectInfo.author.username === this.props.user.username) { this.setState({editable: true}); } From f0fbc0a57f7a76e7bd803d828b6fa7cf13f8892a Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Sat, 16 Jun 2018 19:13:50 -0400 Subject: [PATCH 02/48] add to studio modal appears from project page, looks horrendous --- src/components/modal/addtostudio/modal.jsx | 128 ++++++++++++++++++++ src/components/modal/addtostudio/modal.scss | 39 ++++++ src/l10n.json | 3 +- src/views/preview/presentation.jsx | 64 ++++++++-- 4 files changed, 226 insertions(+), 8 deletions(-) create mode 100644 src/components/modal/addtostudio/modal.jsx create mode 100644 src/components/modal/addtostudio/modal.scss diff --git a/src/components/modal/addtostudio/modal.jsx b/src/components/modal/addtostudio/modal.jsx new file mode 100644 index 000000000..3afad77fa --- /dev/null +++ b/src/components/modal/addtostudio/modal.jsx @@ -0,0 +1,128 @@ +const bindAll = require('lodash.bindall'); +const PropTypes = require('prop-types'); +const React = require('react'); +const FormattedMessage = require('react-intl').FormattedMessage; +const injectIntl = require('react-intl').injectIntl; +const intlShape = require('react-intl').intlShape; +const Modal = require('../base/modal.jsx'); +const log = require('../../../lib/log.js'); + +const Form = require('../../forms/form.jsx'); +const Button = require('../../forms/button.jsx'); +const Select = require('../../forms/select.jsx'); +const Spinner = require('../../spinner/spinner.jsx'); +const TextArea = require('../../forms/textarea.jsx'); + +require('../../forms/button.scss'); +require('./modal.scss'); + +class AddToStudioModal extends React.Component { + constructor (props) { + super(props); + bindAll(this, [ + 'handleReasonSelect', + 'handleSubmit' + ]); + this.state = { + prompt: props.intl.formatMessage({id: 'addToStudio.promptPlaceholder'}), + reason: '', + waiting: false + }; + } + handleSubmit (formData) { + this.setState({waiting: true}); + this.props.onAddToStudio(formData, err => { + if (err) log.error(err); + this.setState({ + prompt: this.props.intl.formatMessage({id: 'addToStudio.promptPlaceholder'}), + reason: '', + waiting: false + }); + }); + } + render () { + const { + intl, + onAddToStudio, // eslint-disable-line no-unused-vars + type, + ...modalProps + } = this.props; + const contentLabel = intl.formatMessage({id: `addToStudio.${type}`}); + return ( + +
+
+
+ {contentLabel} +
+
+ +
+ + + + ) + }} + /> +
+