diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js index 596f8a56..35059d5d 100644 --- a/js/components/ascribe_forms/form_register_piece.js +++ b/js/components/ascribe_forms/form_register_piece.js @@ -2,9 +2,6 @@ import React from 'react'; -import UserStore from '../../stores/user_store'; -import UserActions from '../../actions/user_actions'; - import Form from './form'; import Property from './property'; import InputFineUploader from './input_fineuploader'; @@ -16,22 +13,24 @@ import AppConstants from '../../constants/application_constants'; import AscribeSpinner from '../ascribe_spinner'; import { getLangText } from '../../utils/lang_utils'; -import { mergeOptions } from '../../utils/general_utils'; import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils'; let RegisterPieceForm = React.createClass({ propTypes: { + currentUser: React.PropTypes.object.isRequired, + headerMessage: React.PropTypes.string, submitMessage: React.PropTypes.string, - handleSuccess: React.PropTypes.func, - isFineUploaderActive: React.PropTypes.bool, - isFineUploaderEditable: React.PropTypes.bool, enableLocalHashing: React.PropTypes.bool, enableSeparateThumbnail: React.PropTypes.bool, + isFineUploaderActive: React.PropTypes.bool, + isFineUploaderEditable: React.PropTypes.bool, + handleSuccess: React.PropTypes.func, // For this form to work with SlideContainer, we sometimes have to disable it disabled: React.PropTypes.bool, + location: React.PropTypes.object, children: React.PropTypes.oneOfType([ React.PropTypes.arrayOf(React.PropTypes.element), @@ -48,26 +47,10 @@ let RegisterPieceForm = React.createClass({ }; }, - getInitialState(){ - return mergeOptions( - { - digitalWorkFile: null - }, - UserStore.getState() - ); - }, - - componentDidMount() { - UserStore.listen(this.onChange); - UserActions.fetchCurrentUser(); - }, - - componentWillUnmount() { - UserStore.unlisten(this.onChange); - }, - - onChange(state) { - this.setState(state); + getInitialState() { + return { + digitalWorkFile: null + } }, /** @@ -129,16 +112,17 @@ let RegisterPieceForm = React.createClass({ }, render() { - const { disabled, - handleSuccess, - submitMessage, - headerMessage, - isFineUploaderActive, - isFineUploaderEditable, - location, - children, - enableLocalHashing } = this.props; - const { currentUser} = this.state; + const { + children, + currentUser, + disabled, + enableLocalHashing, + handleSuccess, + headerMessage, + isFineUploaderActive, + isFineUploaderEditable, + location, + submitMessage } = this.props; const profileHashLocally = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false; const hashLocally = profileHashLocally && enableLocalHashing; diff --git a/js/components/register_piece.js b/js/components/register_piece.js index e855403a..49f191c7 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -102,8 +102,7 @@ let RegisterPiece = React.createClass( { + handleSuccess={this.handleSuccess}> {this.props.children} {this.getSpecifyEditions()} diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js index 7739a159..111f1290 100644 --- a/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js +++ b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js @@ -183,13 +183,14 @@ let CylandRegisterPiece = React.createClass({ 0} enableLocalHashing={false} headerMessage={getLangText('Submit to Cyland Archive')} submitMessage={getLangText('Submit')} isFineUploaderActive={true} handleSuccess={this.handleRegisterSuccess} - location={location}/> + location={location} /> diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js index 20a82db2..cd11445a 100644 --- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js +++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js @@ -219,7 +219,8 @@ let IkonotvRegisterPiece = React.createClass({ }, render() { - const { pageExitWarning } = this.state; + const { currentUser, location } = this.props; + const { pageExitWarning, step } = this.state; return (
0} + currentUser={currentUser} + disabled={step > 0} enableLocalHashing={false} headerMessage={getLangText('Register work')} submitMessage={getLangText('Register')} isFineUploaderActive={true} handleSuccess={this.handleRegisterSuccess} - location={this.props.location} /> + location={location} />
diff --git a/js/components/whitelabel/wallet/components/market/market_register_piece.js b/js/components/whitelabel/wallet/components/market/market_register_piece.js index 88de2026..381835e2 100644 --- a/js/components/whitelabel/wallet/components/market/market_register_piece.js +++ b/js/components/whitelabel/wallet/components/market/market_register_piece.js @@ -107,6 +107,7 @@ let MarketRegisterPiece = React.createClass({ render() { const { + currentUser, location, whitelabel: { name: whitelabelName = 'Market' @@ -128,6 +129,7 @@ let MarketRegisterPiece = React.createClass({ 0} enableLocalHashing={false} headerMessage={getLangText('Consign to %s', whitelabelName)}