mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Add location to context
This commit is contained in:
parent
5a0a6e88db
commit
71dbad2a18
@ -7,7 +7,7 @@ import WhitelabelActions from '../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../stores/whitelabel_store';
|
||||
|
||||
import GlobalNotification from './global_notification';
|
||||
import { currentUserShape, whitelabelShape } from './prop_types';
|
||||
import { currentUserShape, locationShape, whitelabelShape } from './prop_types';
|
||||
|
||||
import { mergeOptions } from '../utils/general_utils';
|
||||
|
||||
@ -18,12 +18,13 @@ export default function AppBase(App) {
|
||||
|
||||
propTypes: {
|
||||
children: React.PropTypes.element.isRequired,
|
||||
location: React.PropTypes.object.isRequired,
|
||||
location: locationShape.isRequired,
|
||||
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
|
||||
},
|
||||
|
||||
childContextTypes: {
|
||||
currentUser: currentUserShape,
|
||||
location: locationShape,
|
||||
whitelabel: whitelabelShape
|
||||
},
|
||||
|
||||
@ -37,7 +38,11 @@ export default function AppBase(App) {
|
||||
getChildContext() {
|
||||
const { currentUser, whitelabel } = this.state;
|
||||
|
||||
return { currentUser, whitelabel };
|
||||
return {
|
||||
currentUser,
|
||||
whitelabel,
|
||||
location: this.props.location
|
||||
};
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -25,7 +25,6 @@ let EditionContainer = React.createClass({
|
||||
furtherDetailsType: React.PropTypes.func,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object,
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
|
@ -57,7 +57,6 @@ const PieceContainer = React.createClass({
|
||||
router: routerShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object,
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
|
@ -10,8 +10,11 @@ import UserActions from '../../actions/user_actions';
|
||||
import Form from './form';
|
||||
import Property from './property';
|
||||
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
import AscribeSpinner from '../ascribe_spinner';
|
||||
import withContext from '../context/with_context';
|
||||
import { locationShape } from '../prop_types';
|
||||
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
|
||||
@ -20,8 +23,10 @@ let LoginForm = React.createClass({
|
||||
propTypes: {
|
||||
headerMessage: React.PropTypes.string,
|
||||
submitMessage: React.PropTypes.string,
|
||||
location: React.PropTypes.object,
|
||||
whitelabelName: React.PropTypes.string
|
||||
whitelabelName: React.PropTypes.string,
|
||||
|
||||
// Injected through HOCs
|
||||
location: locationShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
@ -89,4 +94,4 @@ let LoginForm = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default LoginForm;
|
||||
export default withContext(LoginForm, 'location');
|
||||
|
@ -12,7 +12,7 @@ import UploadButton from '../ascribe_uploader/ascribe_upload_button/upload_butto
|
||||
|
||||
import AscribeSpinner from '../ascribe_spinner';
|
||||
import withContext from '../context/with_context';
|
||||
import { currentUserShape } from '../prop_types';
|
||||
import { currentUserShape, locationShape } from '../prop_types';
|
||||
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
@ -35,14 +35,14 @@ let RegisterPieceForm = React.createClass({
|
||||
// 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),
|
||||
React.PropTypes.element
|
||||
]),
|
||||
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
location: locationShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
@ -240,4 +240,4 @@ let RegisterPieceForm = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(RegisterPieceForm, 'currentUser');
|
||||
export default withContext(RegisterPieceForm, 'currentUser', 'location');
|
||||
|
@ -11,8 +11,11 @@ import Form from './form';
|
||||
import Property from './property';
|
||||
import InputCheckbox from './input_checkbox';
|
||||
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
import AscribeSpinner from '../ascribe_spinner';
|
||||
import withContext from '../context/with_context';
|
||||
import { locationShape } from '../prop_types';
|
||||
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
|
||||
@ -22,13 +25,15 @@ let SignupForm = React.createClass({
|
||||
headerMessage: React.PropTypes.string,
|
||||
submitMessage: React.PropTypes.string,
|
||||
handleSuccess: React.PropTypes.func,
|
||||
location: React.PropTypes.object,
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element,
|
||||
React.PropTypes.string
|
||||
]),
|
||||
whitelabelName: React.PropTypes.string
|
||||
whitelabelName: React.PropTypes.string,
|
||||
|
||||
// Injected through HOCs
|
||||
isLoggedIn: locationShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
@ -129,4 +134,4 @@ let SignupForm = React.createClass({
|
||||
});
|
||||
|
||||
|
||||
export default SignupForm;
|
||||
export default withContext(SignupForm, 'location');
|
||||
|
@ -5,7 +5,7 @@ import React from 'react';
|
||||
import UserStore from '../../stores/user_store';
|
||||
|
||||
import withContext from '../context/with_context';
|
||||
import { currentUserShape, routerShape, whitelabelShape } from '../prop_types';
|
||||
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../prop_types';
|
||||
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
|
||||
@ -84,11 +84,11 @@ export function ProxyHandler(...redirectFunctions) {
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired,
|
||||
isLoggedIn: bool.isRequired,
|
||||
location: locationShape.isRequired,
|
||||
router: routerShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: object,
|
||||
route: object
|
||||
},
|
||||
|
||||
@ -133,6 +133,11 @@ export function ProxyHandler(...redirectFunctions) {
|
||||
}
|
||||
});
|
||||
|
||||
return withContext(ProxyHandlerComponent, 'currentUser', 'isLoggedIn', 'router', 'whitelabel');
|
||||
return withContext(ProxyHandlerComponent,
|
||||
'currentUser',
|
||||
'isLoggedIn',
|
||||
'location',
|
||||
'router',
|
||||
'whitelabel');
|
||||
};
|
||||
}
|
||||
|
@ -28,10 +28,7 @@ let ContractSettings = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
|
@ -26,10 +26,7 @@ let SettingsContainer = React.createClass({
|
||||
|
||||
// Injected through HOCs
|
||||
isLoggedIn: React.PropTypes.bool.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
loadUser(invalidateCache) {
|
||||
|
@ -5,7 +5,7 @@ import React from 'react';
|
||||
import SlidesContainerBreadcrumbs from './slides_container_breadcrumbs';
|
||||
|
||||
import withContext from '../context/with_context';
|
||||
import { routerShape } from '../prop_types';
|
||||
import { locationShape, routerShape } from '../prop_types';
|
||||
|
||||
|
||||
const { arrayOf, element, bool, shape, string, object } = React.PropTypes;
|
||||
@ -19,10 +19,10 @@ const SlidesContainer = React.createClass({
|
||||
pending: string,
|
||||
complete: string
|
||||
}),
|
||||
location: object,
|
||||
pageExitWarning: string,
|
||||
|
||||
// Injected through HOCs
|
||||
location: locationShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
router: routerShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
@ -190,4 +190,4 @@ const SlidesContainer = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(SlidesContainer, 'router');
|
||||
export default withContext(SlidesContainer, 'location', 'router');
|
||||
|
@ -6,20 +6,23 @@ import GlobalNotificationModel from '../models/global_notification_model';
|
||||
import GlobalNotificationActions from '../actions/global_notification_actions';
|
||||
|
||||
import Form from './ascribe_forms/form';
|
||||
import Property from './ascribe_forms/property';
|
||||
import InputTextAreaToggable from './ascribe_forms/input_textarea_toggable';
|
||||
import Property from './ascribe_forms/property';
|
||||
|
||||
import AscribeSpinner from './ascribe_spinner';
|
||||
import withContext from './context/with_context';
|
||||
import { locationShape } from './prop_types';
|
||||
|
||||
import ApiUrls from '../constants/api_urls';
|
||||
|
||||
import { getLangText } from '../utils/lang_utils';
|
||||
import { setDocumentTitle } from '../utils/dom_utils';
|
||||
|
||||
|
||||
let CoaVerifyContainer = React.createClass({
|
||||
propTypes: {
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
// Injected through HOCs
|
||||
location: locationShape.isRequired
|
||||
},
|
||||
|
||||
render() {
|
||||
@ -113,5 +116,4 @@ let CoaVerifyForm = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
export default CoaVerifyContainer;
|
||||
export default withContext(CoaVerifyContainer, 'location');
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { currentUserShape, routerShape, whitelabelShape } from '../prop_types';
|
||||
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../prop_types';
|
||||
|
||||
import { selectFromObject } from '../../utils/general_utils';
|
||||
import { getDisplayName } from '../../utils/react_utils';
|
||||
@ -42,6 +42,7 @@ const ContextPropDefinitions = {
|
||||
},
|
||||
transformToProps: ({ currentUser }) => ({ isLoggedIn: !!currentUser.email })
|
||||
},
|
||||
location: locationShape.isRequired,
|
||||
router: routerShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
};
|
||||
|
@ -15,25 +15,17 @@ import { getLangText } from '../utils/lang_utils';
|
||||
let LoginContainer = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
whitelabel: { name: whitelabelName },
|
||||
location
|
||||
} = this.props;
|
||||
const { whitelabel: { name: whitelabelName } } = this.props;
|
||||
|
||||
setDocumentTitle(getLangText('Log in'));
|
||||
|
||||
return (
|
||||
<div className="ascribe-login-wrapper">
|
||||
<LoginForm
|
||||
location={location}
|
||||
whitelabelName={whitelabelName} />
|
||||
<LoginForm whitelabelName={whitelabelName} />
|
||||
<div className="ascribe-login-text">
|
||||
{getLangText(`Not a ${whitelabelName || 'ascribe'} user`)}? <Link to="/signup">{getLangText('Sign up')}...</Link><br/>
|
||||
{getLangText('Forgot my password')}? <Link to="/password_reset">{getLangText('Rescue me')}...</Link>
|
||||
|
@ -10,7 +10,7 @@ import Property from './ascribe_forms/property';
|
||||
|
||||
import AscribeSpinner from './ascribe_spinner';
|
||||
import withContext from './context/with_context';
|
||||
import { routerShape } from './prop_types';
|
||||
import { locationShape, routerShape } from './prop_types';
|
||||
|
||||
import ApiUrls from '../constants/api_urls';
|
||||
|
||||
@ -21,10 +21,7 @@ import { getLangText } from '../utils/lang_utils';
|
||||
let PasswordResetContainer = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
router: routerShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
location: locationShape.isRequired,
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
@ -113,10 +110,11 @@ let PasswordRequestResetForm = React.createClass({
|
||||
|
||||
let PasswordResetForm = withContext(React.createClass({
|
||||
propTypes: {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
|
||||
email: React.PropTypes.string,
|
||||
token: React.PropTypes.string
|
||||
token: React.PropTypes.string,
|
||||
|
||||
// Injected through HOCs
|
||||
router: routerShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
@ -180,4 +178,4 @@ let PasswordResetForm = withContext(React.createClass({
|
||||
}
|
||||
}), 'router');
|
||||
|
||||
export default PasswordResetContainer;
|
||||
export default withContext(PasswordResetContainer, 'location');
|
||||
|
@ -22,7 +22,7 @@ import PieceListToolbar from './ascribe_piece_list_toolbar/piece_list_toolbar';
|
||||
|
||||
import AscribeSpinner from './ascribe_spinner';
|
||||
import withContext from './context/with_context';
|
||||
import { routerShape } from './prop_types';
|
||||
import { locationShape, routerShape } from './prop_types';
|
||||
|
||||
import { getAvailableAcls } from '../utils/acl_utils';
|
||||
import { setDocumentTitle } from '../utils/dom_utils';
|
||||
@ -47,10 +47,8 @@ const PieceList = React.createClass({
|
||||
orderBy: React.PropTypes.string,
|
||||
|
||||
// Injected through HOCs
|
||||
router: routerShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
location: locationShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
router: routerShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
@ -352,4 +350,4 @@ const PieceList = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(PieceList, 'router');
|
||||
export default withContext(PieceList, 'location', 'router');
|
||||
|
@ -2,4 +2,4 @@ export { default as currentUserShape } from './current_user_shape';
|
||||
export { default as whitelabelShape } from './whitelabel_shape';
|
||||
|
||||
// Re-export PropTypes from react-router
|
||||
export { routerShape } from 'react-router/es6/PropTypes';
|
||||
export { locationShape, routerShape } from 'react-router/es6/PropTypes';
|
||||
|
@ -31,10 +31,7 @@ const RegisterPiece = React.createClass( {
|
||||
|
||||
// Injected through HOCs
|
||||
router: routerShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
|
@ -13,10 +13,7 @@ import { getLangText } from '../utils/lang_utils';
|
||||
let SignupContainer = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
@ -34,10 +31,7 @@ let SignupContainer = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
location,
|
||||
whitelabel: { name: whitelabelName }
|
||||
} = this.props;
|
||||
const { whitelabel: { name: whitelabelName } } = this.props;
|
||||
const { message, submitted } = this.state;
|
||||
|
||||
setDocumentTitle(getLangText('Sign up'));
|
||||
@ -56,8 +50,7 @@ let SignupContainer = React.createClass({
|
||||
<div className="ascribe-login-wrapper">
|
||||
<SignupForm
|
||||
handleSuccess={this.handleSuccess}
|
||||
whitelabelName={whitelabelName}
|
||||
location={location}/>
|
||||
whitelabelName={whitelabelName} />
|
||||
<div className="ascribe-login-text">
|
||||
{getLangText(`Already a ${whitelabelName || 'ascribe'} user`)}? <Link to="/login">{getLangText('Log in')}...</Link><br/>
|
||||
</div>
|
||||
@ -67,5 +60,4 @@ let SignupContainer = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
export default withContext(SignupContainer, 'whitelabel');
|
||||
|
@ -15,10 +15,7 @@ import { getLangText } from '../../../../../utils/lang_utils';
|
||||
let Vivi23Landing = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
componentWillMount() {
|
||||
|
@ -7,11 +7,6 @@ import Vivi23AccordionListItemThumbnailPlaceholder from './23vivi_accordion_list
|
||||
import MarketPieceList from '../market/market_piece_list';
|
||||
|
||||
let Vivi23PieceList = React.createClass({
|
||||
propTypes: {
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<MarketPieceList
|
||||
|
@ -12,11 +12,6 @@ import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
|
||||
let CCRegisterPiece = React.createClass({
|
||||
propTypes: {
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return mergeOptions(
|
||||
LicenseStore.getState(),
|
||||
@ -89,8 +84,7 @@ let CCRegisterPiece = React.createClass({
|
||||
{...this.props}
|
||||
enableLocalHashing={false}
|
||||
headerMessage={getLangText('Register under a Creative Commons license')}
|
||||
submitMessage={getLangText('Submit')}
|
||||
location={this.props.location}>
|
||||
submitMessage={getLangText('Submit')}>
|
||||
{this.getLicenses()}
|
||||
</RegisterPiece>
|
||||
);
|
||||
|
@ -34,7 +34,6 @@ const CylandPieceContainer = React.createClass({
|
||||
router: routerShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object,
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
|
@ -15,10 +15,7 @@ let CylandPieceList = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
shouldRedirect(pieceCount) {
|
||||
|
@ -24,7 +24,7 @@ import RegisterPieceForm from '../../../../ascribe_forms/form_register_piece';
|
||||
import SlidesContainer from '../../../../ascribe_slides_container/slides_container';
|
||||
|
||||
import withContext from '../../../../context/with_context';
|
||||
import { currentUserShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||
|
||||
import ApiUrls from '../../../../../constants/api_urls';
|
||||
|
||||
@ -38,11 +38,9 @@ const CylandRegisterPiece = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired,
|
||||
location: locationShape.isRequired,
|
||||
router: routerShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
@ -128,7 +126,7 @@ const CylandRegisterPiece = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
const { currentUser, location, whitelabel } = this.props;
|
||||
const { currentUser, whitelabel } = this.props;
|
||||
const { piece, step } = this.state;
|
||||
|
||||
const today = new Moment();
|
||||
@ -163,8 +161,7 @@ const CylandRegisterPiece = React.createClass({
|
||||
glyphiconClassNames={{
|
||||
pending: 'glyphicon glyphicon-chevron-right',
|
||||
completed: 'glyphicon glyphicon-lock'
|
||||
}}
|
||||
location={location}>
|
||||
}}>
|
||||
<div data-slide-title={getLangText('Register work')}>
|
||||
<Row className="no-margin">
|
||||
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
|
||||
@ -219,4 +216,4 @@ const CylandRegisterPiece = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(CylandRegisterPiece, 'currentUser', 'router', 'whitelabel');
|
||||
export default withContext(CylandRegisterPiece, 'currentUser', 'location', 'router', 'whitelabel');
|
||||
|
@ -28,10 +28,7 @@ const IkonotvContractNotifications = React.createClass({
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired,
|
||||
router: routerShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
|
@ -35,7 +35,6 @@ const IkonotvPieceContainer = React.createClass({
|
||||
router: routerShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object,
|
||||
params: React.PropTypes.object
|
||||
},
|
||||
|
||||
|
@ -7,6 +7,7 @@ import Button from 'react-bootstrap/lib/Button';
|
||||
import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
|
||||
|
||||
import withContext from '../../../../context/with_context';
|
||||
import { locationShape } from '../../../../prop_types';
|
||||
|
||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
@ -15,24 +16,22 @@ import { getLangText } from '../../../../../utils/lang_utils';
|
||||
let IkonotvLanding = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
isLoggedIn: React.PropTypes.bool.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
isLoggedIn: React.PropTypes.bool.isRequired,
|
||||
location: locationShape.isRequired
|
||||
},
|
||||
|
||||
getEnterButton() {
|
||||
const { isLoggedIn, location } = this.props;
|
||||
const { isLoggedIn, location: { query } } = this.props;
|
||||
let redirect = '/login';
|
||||
|
||||
if (isLoggedIn) {
|
||||
redirect = '/collection';
|
||||
} else if (location.query.redirect) {
|
||||
redirect = '/' + location.query.redirect;
|
||||
} else if (query.redirect) {
|
||||
redirect = `/${query.redirect}`;
|
||||
}
|
||||
|
||||
return (
|
||||
<LinkContainer to={redirect} query={location.query}>
|
||||
<LinkContainer to={redirect} query={query}>
|
||||
<Button>
|
||||
{getLangText('ENTER TO START')}
|
||||
</Button>
|
||||
@ -102,4 +101,4 @@ let IkonotvLanding = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(IkonotvLanding, 'isLoggedIn');
|
||||
export default withContext(IkonotvLanding, 'isLoggedIn', 'location');
|
||||
|
@ -19,12 +19,7 @@ let IkonotvPieceList = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from WalletApp
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
|
@ -22,7 +22,7 @@ import LoanForm from '../../../../ascribe_forms/form_loan';
|
||||
import SlidesContainer from '../../../../ascribe_slides_container/slides_container';
|
||||
|
||||
import withContext from '../../../../context/with_context';
|
||||
import { currentUserShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||
import { currentUserShape, locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||
|
||||
import ApiUrls from '../../../../../constants/api_urls';
|
||||
|
||||
@ -36,11 +36,9 @@ const IkonotvRegisterPiece = React.createClass({
|
||||
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
location: locationShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
router: routerShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
@ -209,7 +207,6 @@ const IkonotvRegisterPiece = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
const { location } = this.props;
|
||||
const { pageExitWarning, step } = this.state;
|
||||
|
||||
return (
|
||||
@ -220,7 +217,6 @@ const IkonotvRegisterPiece = React.createClass({
|
||||
pending: 'glyphicon glyphicon-chevron-right',
|
||||
completed: 'glyphicon glyphicon-lock'
|
||||
}}
|
||||
location={location}
|
||||
pageExitWarning={pageExitWarning}>
|
||||
<div data-slide-title={getLangText('Register work')}>
|
||||
<Row className="no-margin">
|
||||
@ -244,4 +240,4 @@ const IkonotvRegisterPiece = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(IkonotvRegisterPiece, 'currentUser', 'router', 'whitelabel');
|
||||
export default withContext(IkonotvRegisterPiece, 'currentUser', 'location', 'router', 'whitelabel');
|
||||
|
@ -17,10 +17,7 @@ let MarketPieceList = React.createClass({
|
||||
|
||||
// Injected through HOCs
|
||||
currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
whitelabel: whitelabelShape.isRequired // eslint-disable-line react/sort-prop-types
|
||||
},
|
||||
|
||||
componentWillMount() {
|
||||
|
@ -17,7 +17,7 @@ import RegisterPieceForm from '../../../../ascribe_forms/form_register_piece';
|
||||
import SlidesContainer from '../../../../ascribe_slides_container/slides_container';
|
||||
|
||||
import withContext from '../../../../context/with_context';
|
||||
import { routerShape, whitelabelShape } from '../../../../prop_types';
|
||||
import { locationShape, routerShape, whitelabelShape } from '../../../../prop_types';
|
||||
|
||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||
@ -27,10 +27,8 @@ let MarketRegisterPiece = React.createClass({
|
||||
propTypes: {
|
||||
// Injected through HOCs
|
||||
router: routerShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired,
|
||||
|
||||
// Provided from router
|
||||
location: React.PropTypes.object
|
||||
location: locationShape.isRequired,
|
||||
whitelabel: whitelabelShape.isRequired
|
||||
},
|
||||
|
||||
getInitialState(){
|
||||
@ -99,12 +97,7 @@ let MarketRegisterPiece = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
location,
|
||||
whitelabel: {
|
||||
name: whitelabelName = 'Market'
|
||||
}
|
||||
} = this.props
|
||||
const { whitelabel: { name: whitelabelName = 'Market' } } = this.props;
|
||||
const { piece, step } = this.state;
|
||||
|
||||
setDocumentTitle(getLangText('Register a new piece'));
|
||||
@ -116,8 +109,7 @@ let MarketRegisterPiece = React.createClass({
|
||||
glyphiconClassNames={{
|
||||
pending: 'glyphicon glyphicon-chevron-right',
|
||||
completed: 'glyphicon glyphicon-lock'
|
||||
}}
|
||||
location={location}>
|
||||
}}>
|
||||
<div data-slide-title={getLangText('Register work')}>
|
||||
<Row className="no-margin">
|
||||
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
|
||||
@ -160,4 +152,4 @@ let MarketRegisterPiece = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default withContext(MarketRegisterPiece, 'router', 'whitelabel');
|
||||
export default withContext(MarketRegisterPiece, 'location', 'router', 'whitelabel');
|
||||
|
Loading…
Reference in New Issue
Block a user