);
}
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 c40d779d..d72080a7 100644
--- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js
+++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js
@@ -10,24 +10,18 @@ import Row from 'react-bootstrap/lib/Row';
import PieceListStore from '../../../../../stores/piece_list_store';
import PieceListActions from '../../../../../actions/piece_list_actions';
-import UserStore from '../../../../../stores/user_store';
-import UserActions from '../../../../../actions/user_actions';
-
import PieceStore from '../../../../../stores/piece_store';
import PieceActions from '../../../../../actions/piece_actions';
-import WhitelabelActions from '../../../../../actions/whitelabel_actions';
-import WhitelabelStore from '../../../../../stores/whitelabel_store';
-
import GlobalNotificationModel from '../../../../../models/global_notification_model';
import GlobalNotificationActions from '../../../../../actions/global_notification_actions';
-import RegisterPieceForm from '../../../../ascribe_forms/form_register_piece';
-import LoanForm from '../../../../ascribe_forms/form_loan';
-
import IkonotvArtistDetailsForm from './ikonotv_forms/ikonotv_artist_details_form';
import IkonotvArtworkDetailsForm from './ikonotv_forms/ikonotv_artwork_details_form';
+import RegisterPieceForm from '../../../../ascribe_forms/form_register_piece';
+import LoanForm from '../../../../ascribe_forms/form_loan';
+
import SlidesContainer from '../../../../ascribe_slides_container/slides_container';
import ApiUrls from '../../../../../constants/api_urls';
@@ -38,8 +32,14 @@ import { getLangText } from '../../../../../utils/lang_utils';
let IkonotvRegisterPiece = React.createClass({
propTypes: {
- handleSuccess: React.PropTypes.func,
piece: React.PropTypes.object.isRequired,
+ handleSuccess: React.PropTypes.func,
+
+ // Provided from PrizeApp
+ currentUser: React.PropTypes.object,
+ whitelabel: React.PropTypes.object,
+
+ // Provided from router
location: React.PropTypes.object
},
@@ -47,10 +47,8 @@ let IkonotvRegisterPiece = React.createClass({
getInitialState(){
return mergeOptions(
- UserStore.getState(),
PieceListStore.getState(),
PieceStore.getState(),
- WhitelabelStore.getState(),
{
step: 0,
pageExitWarning: getLangText("If you leave this form now, your work will not be loaned to Ikono TV.")
@@ -59,18 +57,12 @@ let IkonotvRegisterPiece = React.createClass({
componentDidMount() {
PieceListStore.listen(this.onChange);
- UserStore.listen(this.onChange);
PieceStore.listen(this.onChange);
- WhitelabelStore.listen(this.onChange);
- UserActions.fetchCurrentUser();
- WhitelabelActions.fetchWhitelabel();
// Before we load the new piece, we reset the piece store to delete old data that we do
// not want to display to the user.
PieceActions.updatePiece({});
- let queryParams = this.props.location.query;
-
// Since every step of this register process is atomic,
// we may need to enter the process at step 1 or 2.
// If this is the case, we'll need the piece number to complete submission.
@@ -78,6 +70,7 @@ let IkonotvRegisterPiece = React.createClass({
//
// We're using 'in' here as we want to know if 'piece_id' is present in the url,
// we don't care about the value.
+ const queryParams = this.props.location.query;
if (queryParams && 'piece_id' in queryParams) {
PieceActions.fetchOne(queryParams.piece_id);
}
@@ -85,9 +78,7 @@ let IkonotvRegisterPiece = React.createClass({
componentWillUnmount() {
PieceListStore.unlisten(this.onChange);
- UserStore.unlisten(this.onChange);
PieceStore.unlisten(this.onChange);
- WhitelabelStore.listen(this.onChange);
},
onChange(state) {
@@ -158,8 +149,7 @@ let IkonotvRegisterPiece = React.createClass({
},
canSubmit() {
- let currentUser = this.state.currentUser;
- let whitelabel = this.state.whitelabel;
+ const { currentUser, whitelabel } = this.props;
return currentUser && currentUser.acl && currentUser.acl.acl_wallet_submit && whitelabel && whitelabel.user;
},
@@ -199,10 +189,9 @@ let IkonotvRegisterPiece = React.createClass({
getSlideLoan() {
if (this.canSubmit()) {
- const { piece, whitelabel } = this.state;
- let today = new Moment();
- let endDate = new Moment();
- endDate.add(2, 'years');
+ const { piece, whitelabel } = this.props;
+ const today = new Moment();
+ const endDate = (new Moment()).add(2, 'years');
return (