mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Update market routes for loading user and whitelabel settings in top level app
This commit is contained in:
parent
194c554637
commit
fbb35915eb
@ -32,10 +32,11 @@ const PRLanding = React.createClass({
|
||||
|
||||
componentDidMount() {
|
||||
const { location } = this.props;
|
||||
|
||||
PrizeStore.listen(this.onChange);
|
||||
PrizeActions.fetchPrize();
|
||||
|
||||
if (location && location.query && location.query.redirect) {
|
||||
if (location.query.redirect) {
|
||||
let queryCopy = JSON.parse(JSON.stringify(location.query));
|
||||
delete queryCopy.redirect;
|
||||
window.setTimeout(() => this.history.replaceState(null, `/${location.query.redirect}`, queryCopy));
|
||||
|
@ -5,42 +5,32 @@ import React from 'react';
|
||||
import Button from 'react-bootstrap/lib/Button';
|
||||
import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
|
||||
|
||||
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../../../../../stores/whitelabel_store';
|
||||
|
||||
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
|
||||
let Vivi23Landing = React.createClass({
|
||||
getInitialState() {
|
||||
return WhitelabelStore.getState();
|
||||
propTypes: {
|
||||
customThumbnailPlaceholder: React.PropTypes.func,
|
||||
|
||||
// Provided from PrizeApp
|
||||
currentUser: React.PropTypes.object,
|
||||
whitelabel: React.PropTypes.object,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
componentWillMount() {
|
||||
setDocumentTitle('23VIVI Marketplace');
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="container ascribe-form-wrapper vivi23-landing">
|
||||
<div className="row">
|
||||
<div className="col-xs-12">
|
||||
<div className="row vivi23-landing--header">
|
||||
<img className="vivi23-landing--header-logo" src={this.state.whitelabel.logo} />
|
||||
<img className="vivi23-landing--header-logo" src={this.props.whitelabel.logo} />
|
||||
<div>
|
||||
{getLangText('Artwork from the 23VIVI Marketplace is powered by') + ' '}
|
||||
<span className="icon-ascribe-logo" />
|
||||
|
@ -8,17 +8,21 @@ import MarketPieceList from '../market/market_piece_list';
|
||||
|
||||
let Vivi23PieceList = React.createClass({
|
||||
propTypes: {
|
||||
// Provided from PrizeApp
|
||||
currentUser: React.PropTypes.object,
|
||||
whitelabel: React.PropTypes.object,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<MarketPieceList
|
||||
customThumbnailPlaceholder={Vivi23AccordionListItemThumbnailPlaceholder}
|
||||
location={this.props.location} />
|
||||
{...this.props}
|
||||
customThumbnailPlaceholder={Vivi23AccordionListItemThumbnailPlaceholder} />
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default Vivi23PieceList;
|
||||
|
@ -32,7 +32,6 @@ let WalletPieceContainer = React.createClass({
|
||||
])
|
||||
},
|
||||
|
||||
|
||||
render() {
|
||||
if (this.props.piece && this.props.piece.id) {
|
||||
return (
|
||||
|
@ -5,46 +5,31 @@ import React from 'react';
|
||||
import Button from 'react-bootstrap/lib/Button';
|
||||
import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
|
||||
|
||||
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../../../../../stores/whitelabel_store';
|
||||
|
||||
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
|
||||
|
||||
let LumenusLanding = React.createClass({
|
||||
propTypes: {
|
||||
// Provided from PrizeApp
|
||||
currentUser: React.PropTypes.object,
|
||||
whitelabel: React.PropTypes.object,
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
WhitelabelStore.getState()
|
||||
);
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
componentWillMount() {
|
||||
setDocumentTitle('Lumenus Marketplace');
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="container ascribe-form-wrapper">
|
||||
<div className="row">
|
||||
<div className="col-xs-12 wp-landing-wrapper">
|
||||
<div className="row" style={{border: '1px solid #CCC', padding: '2em'}}>
|
||||
<img src={this.state.whitelabel.logo} width="150px"/>
|
||||
<img src={this.props.whitelabel.logo} width="150px"/>
|
||||
<div style={{marginTop: '1em'}}>
|
||||
{getLangText('Artwork from the Lumenus Marketplace is powered by') + ' '}
|
||||
<span>
|
||||
|
@ -6,11 +6,6 @@ import MarketAclButtonList from './market_buttons/market_acl_button_list';
|
||||
|
||||
import PieceList from '../../../../piece_list';
|
||||
|
||||
import UserActions from '../../../../../actions/user_actions';
|
||||
import UserStore from '../../../../../stores/user_store';
|
||||
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../../../../../stores/whitelabel_store';
|
||||
|
||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
@ -18,45 +13,27 @@ import { getLangText } from '../../../../../utils/lang_utils';
|
||||
let MarketPieceList = React.createClass({
|
||||
propTypes: {
|
||||
customThumbnailPlaceholder: React.PropTypes.func,
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
UserStore.getState(),
|
||||
WhitelabelStore.getState()
|
||||
);
|
||||
// Provided from PrizeApp
|
||||
currentUser: React.PropTypes.object,
|
||||
whitelabel: React.PropTypes.object,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
componentWillMount() {
|
||||
setDocumentTitle(getLangText('Collection'));
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
UserStore.listen(this.onChange);
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
|
||||
UserActions.fetchCurrentUser();
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
UserStore.unlisten(this.onChange);
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
render() {
|
||||
const { customThumbnailPlaceholder, location } = this.props;
|
||||
const {
|
||||
currentUser: { email: userEmail },
|
||||
customThumbnailPlaceholder,
|
||||
whitelabel: {
|
||||
name: whitelabelName = 'Market',
|
||||
user: whitelabelAdminEmail
|
||||
} } = this.state;
|
||||
} } = this.props;
|
||||
|
||||
let filterParams = null;
|
||||
let canLoadPieceList = false;
|
||||
@ -77,12 +54,12 @@ let MarketPieceList = React.createClass({
|
||||
|
||||
return (
|
||||
<PieceList
|
||||
{...this.props}
|
||||
canLoadPieceList={canLoadPieceList}
|
||||
redirectTo="/register_piece?slide_num=0"
|
||||
bulkModalButtonListType={MarketAclButtonList}
|
||||
customThumbnailPlaceholder={customThumbnailPlaceholder}
|
||||
filterParams={filterParams}
|
||||
location={location} />
|
||||
filterParams={filterParams} />
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -6,19 +6,15 @@ import { History } from 'react-router';
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
|
||||
import PieceActions from '../../../../../actions/piece_actions';
|
||||
import PieceListStore from '../../../../../stores/piece_list_store';
|
||||
import PieceListActions from '../../../../../actions/piece_list_actions';
|
||||
|
||||
import MarketAdditionalDataForm from './market_forms/market_additional_data_form';
|
||||
|
||||
import Property from '../../../../ascribe_forms/property';
|
||||
import RegisterPieceForm from '../../../../ascribe_forms/form_register_piece';
|
||||
|
||||
import PieceActions from '../../../../../actions/piece_actions';
|
||||
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 WhitelabelActions from '../../../../../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../../../../../stores/whitelabel_store';
|
||||
|
||||
import SlidesContainer from '../../../../ascribe_slides_container/slides_container';
|
||||
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
@ -27,6 +23,11 @@ import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
|
||||
let MarketRegisterPiece = React.createClass({
|
||||
propTypes: {
|
||||
// Provided from PrizeApp
|
||||
currentUser: React.PropTypes.object,
|
||||
whitelabel: React.PropTypes.object,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
@ -35,8 +36,6 @@ let MarketRegisterPiece = React.createClass({
|
||||
getInitialState(){
|
||||
return mergeOptions(
|
||||
PieceListStore.getState(),
|
||||
UserStore.getState(),
|
||||
WhitelabelStore.getState(),
|
||||
{
|
||||
step: 0
|
||||
});
|
||||
@ -44,11 +43,6 @@ let MarketRegisterPiece = React.createClass({
|
||||
|
||||
componentDidMount() {
|
||||
PieceListStore.listen(this.onChange);
|
||||
UserStore.listen(this.onChange);
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
|
||||
UserActions.fetchCurrentUser();
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
|
||||
// Reset the piece store to make sure that we don't display old data
|
||||
// if the user repeatedly registers works
|
||||
@ -57,8 +51,6 @@ let MarketRegisterPiece = React.createClass({
|
||||
|
||||
componentWillUnmount() {
|
||||
PieceListStore.unlisten(this.onChange);
|
||||
UserStore.unlisten(this.onChange);
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
@ -115,10 +107,11 @@ let MarketRegisterPiece = React.createClass({
|
||||
|
||||
render() {
|
||||
const {
|
||||
step,
|
||||
location,
|
||||
whitelabel: {
|
||||
name: whitelabelName = 'Market'
|
||||
} } = this.state;
|
||||
} } = this.props
|
||||
const { step } = this.state;
|
||||
|
||||
setDocumentTitle(getLangText('Register a new piece'));
|
||||
|
||||
@ -130,7 +123,7 @@ let MarketRegisterPiece = React.createClass({
|
||||
pending: 'glyphicon glyphicon-chevron-right',
|
||||
completed: 'glyphicon glyphicon-lock'
|
||||
}}
|
||||
location={this.props.location}>
|
||||
location={location}>
|
||||
<div data-slide-title={getLangText('Register work')}>
|
||||
<Row className="no-margin">
|
||||
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
|
||||
@ -142,7 +135,7 @@ let MarketRegisterPiece = React.createClass({
|
||||
isFineUploaderActive={true}
|
||||
enableSeparateThumbnail={false}
|
||||
handleSuccess={this.handleRegisterSuccess}
|
||||
location={this.props.location}>
|
||||
location={location}>
|
||||
<Property
|
||||
name="num_editions"
|
||||
label={getLangText('Specify editions')}>
|
||||
|
Loading…
Reference in New Issue
Block a user