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