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