1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Convert whitelabel to be passed down through context and withWhitelabel HOC

This commit is contained in:
Brett Sun 2016-06-07 14:53:48 +02:00
parent b5eda1cdd2
commit b02695a33a
42 changed files with 217 additions and 229 deletions

View File

@ -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 } from './prop_types'; import { currentUserShape, whitelabelShape } from './prop_types';
import { mergeOptions } from '../utils/general_utils'; import { mergeOptions } from '../utils/general_utils';
@ -23,7 +23,8 @@ export default function AppBase(App) {
}, },
childContextTypes: { childContextTypes: {
currentUser: currentUserShape currentUser: currentUserShape,
whitelabel: whitelabelShape
}, },
getInitialState() { getInitialState() {
@ -34,9 +35,9 @@ export default function AppBase(App) {
}, },
getChildContext() { getChildContext() {
const { currentUser } = this.state; const { currentUser, whitelabel } = this.state;
return { currentUser }; return { currentUser, whitelabel };
}, },
componentDidMount() { componentDidMount() {
@ -58,7 +59,6 @@ export default function AppBase(App) {
render() { render() {
const { routes } = this.props; const { routes } = this.props;
const { whitelabel } = this.state;
// The second element of the routes prop given to us by react-router is always the // The second element of the routes prop given to us by react-router is always the
// active second-level component object (ie. after App). // active second-level component object (ie. after App).
@ -68,8 +68,7 @@ export default function AppBase(App) {
<div> <div>
<App <App
{...this.props} {...this.props}
activeRoute={activeRoute} activeRoute={activeRoute} />
whitelabel={whitelabel} />
<GlobalNotification /> <GlobalNotification />
<div id="modal" className="container" /> <div id="modal" className="container" />
</div> </div>

View File

@ -19,24 +19,27 @@ import AccordionListItemPiece from './accordion_list_item_piece';
import AccordionListItemEditionWidget from './accordion_list_item_edition_widget'; import AccordionListItemEditionWidget from './accordion_list_item_edition_widget';
import CreateEditionsForm from '../ascribe_forms/create_editions_form'; import CreateEditionsForm from '../ascribe_forms/create_editions_form';
import AclProxy from '../acl_proxy'; import AclProxy from '../acl_proxy';
import { whitelabelShape } from '../prop_types';
import { getLangText } from '../../utils/lang_utils';
import { mergeOptions } from '../../utils/general_utils'; import { mergeOptions } from '../../utils/general_utils';
import { getLangText } from '../../utils/lang_utils';
import { withWhitelabel } from '../../utils/react_utils';
let AccordionListItemWallet = React.createClass({ let AccordionListItemWallet = React.createClass({
propTypes: { propTypes: {
content: React.PropTypes.object.isRequired, content: React.PropTypes.object.isRequired,
whitelabel: React.PropTypes.object.isRequired,
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
]), ]),
className: React.PropTypes.string, className: React.PropTypes.string,
thumbnailPlaceholder: React.PropTypes.func thumbnailPlaceholder: React.PropTypes.func,
// Injected through HOCs
whitelabel: whitelabelShape.isRequired // eslint-disable-line react/sort-prop-types
}, },
getInitialState() { getInitialState() {
@ -162,4 +165,4 @@ let AccordionListItemWallet = React.createClass({
} }
}); });
export default AccordionListItemWallet; export default withWhitelabel(AccordionListItemWallet);

View File

@ -11,22 +11,16 @@ const AscribeApp = React.createClass({
activeRoute: React.PropTypes.object.isRequired, activeRoute: React.PropTypes.object.isRequired,
children: React.PropTypes.element.isRequired, children: React.PropTypes.element.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
// Provided from AppBase
whitelabel: React.PropTypes.object
}, },
render() { render() {
const { activeRoute, children, routes, whitelabel } = this.props; const { activeRoute, children, routes } = this.props;
const showFooter = activeRoute && activeRoute.footer; const showFooter = activeRoute && activeRoute.footer;
return ( return (
<div className="ascribe-app ascribe-default-app"> <div className="ascribe-app ascribe-default-app">
<Header <Header routes={routes} />
routes={routes} <AppRouteWrapper>
whitelabel={whitelabel} />
<AppRouteWrapper
whitelabel={whitelabel}>
{/* Routes are injected here */} {/* Routes are injected here */}
{children} {children}
</AppRouteWrapper> </AppRouteWrapper>

View File

@ -36,7 +36,6 @@ import { withCurrentUser } from '../../utils/react_utils';
const Edition = React.createClass({ const Edition = React.createClass({
propTypes: { propTypes: {
edition: React.PropTypes.object.isRequired, edition: React.PropTypes.object.isRequired,
whitelabel: React.PropTypes.object.isRequired,
actionPanelButtonListType: React.PropTypes.func, actionPanelButtonListType: React.PropTypes.func,
coaError: React.PropTypes.object, coaError: React.PropTypes.object,
@ -60,7 +59,6 @@ const Edition = React.createClass({
edition, edition,
isLoggedIn, isLoggedIn,
loadEdition, loadEdition,
whitelabel,
furtherDetailsType: FurtherDetailsType furtherDetailsType: FurtherDetailsType
} = this.props; } = this.props;
@ -84,8 +82,7 @@ const Edition = React.createClass({
<EditionSummary <EditionSummary
actionPanelButtonListType={actionPanelButtonListType} actionPanelButtonListType={actionPanelButtonListType}
edition={edition} edition={edition}
handleSuccess={loadEdition} handleSuccess={loadEdition} />
whitelabel={whitelabel} />
<CollapsibleParagraph <CollapsibleParagraph
title={getLangText('Certificate of Authenticity')} title={getLangText('Certificate of Authenticity')}
show={edition.acl.acl_coa === true}> show={edition.acl.acl_coa === true}>
@ -157,7 +154,6 @@ const Edition = React.createClass({
let EditionSummary = withCurrentUser(React.createClass({ let EditionSummary = withCurrentUser(React.createClass({
propTypes: { propTypes: {
edition: React.PropTypes.object.isRequired, edition: React.PropTypes.object.isRequired,
whitelabel: React.PropTypes.object.isRequired,
actionPanelButtonListType: React.PropTypes.func, actionPanelButtonListType: React.PropTypes.func,
handleSuccess: React.PropTypes.func, handleSuccess: React.PropTypes.func,
@ -182,7 +178,6 @@ let EditionSummary = withCurrentUser(React.createClass({
edition, edition,
handleSuccess, handleSuccess,
isLoggedIn, isLoggedIn,
whitelabel
} = this.props; } = this.props;
return ( return (
@ -214,8 +209,7 @@ let EditionSummary = withCurrentUser(React.createClass({
<EditionActionPanel <EditionActionPanel
actionPanelButtonListType={actionPanelButtonListType} actionPanelButtonListType={actionPanelButtonListType}
edition={edition} edition={edition}
handleSuccess={handleSuccess} handleSuccess={handleSuccess} />
whitelabel={whitelabel} />
</DetailProperty> </DetailProperty>
</AclProxy> </AclProxy>
<hr/> <hr/>

View File

@ -38,7 +38,6 @@ const EditionActionPanel = React.createClass({
propTypes: { propTypes: {
edition: React.PropTypes.object.isRequired, edition: React.PropTypes.object.isRequired,
router: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired,
whitelabel: React.PropTypes.object.isRequired,
actionPanelButtonListType: React.PropTypes.func, actionPanelButtonListType: React.PropTypes.func,
handleSuccess: React.PropTypes.func handleSuccess: React.PropTypes.func
@ -99,9 +98,7 @@ const EditionActionPanel = React.createClass({
}, },
render() { render() {
const { actionPanelButtonListType: ActionPanelButtonListType, const { edition, actionPanelButtonListType: ActionPanelButtonListType } = this.props;
edition,
whitelabel } = this.props;
if (edition.notifications && edition.notifications.length) { if (edition.notifications && edition.notifications.length) {
return ( return (
@ -117,8 +114,7 @@ const EditionActionPanel = React.createClass({
availableAcls={edition.acl} availableAcls={edition.acl}
className="ascribe-button-list" className="ascribe-button-list"
handleSuccess={this.handleSuccess} handleSuccess={this.handleSuccess}
pieceOrEditions={[edition]} pieceOrEditions={[edition]} >
whitelabel={whitelabel}>
<AclProxy <AclProxy
aclObject={edition.acl} aclObject={edition.acl}
aclName="acl_withdraw_transfer"> aclName="acl_withdraw_transfer">

View File

@ -24,9 +24,6 @@ let EditionContainer = React.createClass({
actionPanelButtonListType: React.PropTypes.func, actionPanelButtonListType: React.PropTypes.func,
furtherDetailsType: React.PropTypes.func, furtherDetailsType: React.PropTypes.func,
// Provided from AscribeApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object, location: React.PropTypes.object,
params: React.PropTypes.object params: React.PropTypes.object
@ -75,7 +72,7 @@ let EditionContainer = React.createClass({
}, },
render() { render() {
const { actionPanelButtonListType, furtherDetailsType, whitelabel } = this.props; const { actionPanelButtonListType, furtherDetailsType } = this.props;
const { edition, coaMeta } = this.state; const { edition, coaMeta } = this.state;
if (edition.id) { if (edition.id) {
@ -87,8 +84,7 @@ let EditionContainer = React.createClass({
coaError={coaMeta.err} coaError={coaMeta.err}
edition={edition} edition={edition}
furtherDetailsType={furtherDetailsType} furtherDetailsType={furtherDetailsType}
loadEdition={this.loadEdition} loadEdition={this.loadEdition} />
whitelabel={whitelabel} />
); );
} else { } else {
return ( return (

View File

@ -57,9 +57,6 @@ const PieceContainer = 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
// Provided from AscribeApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object, location: React.PropTypes.object,
params: React.PropTypes.object params: React.PropTypes.object

View File

@ -14,20 +14,20 @@ import CollapsibleParagraph from '../ascribe_collapsible/collapsible_paragraph';
import AclProxy from '../acl_proxy'; import AclProxy from '../acl_proxy';
import AscribeSpinner from '../ascribe_spinner'; import AscribeSpinner from '../ascribe_spinner';
import { currentUserShape } from '../prop_types'; import { currentUserShape, whitelabelShape } 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 { withCurrentUser } from '../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../utils/react_utils';
let AccountSettings = React.createClass({ let AccountSettings = React.createClass({
propTypes: { propTypes: {
loadUser: React.PropTypes.func.isRequired, loadUser: React.PropTypes.func.isRequired,
whitelabel: React.PropTypes.object.isRequired
// 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
}, },
handleSuccess() { handleSuccess() {
@ -112,4 +112,4 @@ let AccountSettings = React.createClass({
} }
}); });
export default withCurrentUser(AccountSettings); export default withCurrentUser(withWhitelabel(AccountSettings));

View File

@ -16,21 +16,19 @@ import CreateContractForm from '../ascribe_forms/form_create_contract';
import ActionPanel from '../ascribe_panel/action_panel'; import ActionPanel from '../ascribe_panel/action_panel';
import AclProxy from '../acl_proxy'; import AclProxy from '../acl_proxy';
import { currentUserShape } from '../prop_types'; import { currentUserShape, whitelabelShape } from '../prop_types';
import { setDocumentTitle } from '../../utils/dom_utils'; import { setDocumentTitle } from '../../utils/dom_utils';
import { truncateTextAtCharIndex } from '../../utils/general_utils'; import { truncateTextAtCharIndex } from '../../utils/general_utils';
import { getLangText } from '../../utils/lang_utils'; import { getLangText } from '../../utils/lang_utils';
import { withCurrentUser } from '../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../utils/react_utils';
let ContractSettings = React.createClass({ let ContractSettings = React.createClass({
propTypes: { propTypes: {
// Injected through HOCs // Injected through HOCs
currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types currentUser: currentUserShape.isRequired,
whitelabel: whitelabelShape.isRequired,
// Provided from AscribeApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -185,4 +183,4 @@ let ContractSettings = React.createClass({
} }
}); });
export default ContractSettings; export default withCurrentUser(withWhitelabel(ContractSettings));

View File

@ -10,10 +10,11 @@ import BitcoinWalletSettings from './bitcoin_wallet_settings';
import WebhookSettings from './webhook_settings'; import WebhookSettings from './webhook_settings';
import AclProxy from '../acl_proxy'; import AclProxy from '../acl_proxy';
import { whitelabelShape } 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';
import { withCurrentUser } from '../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../utils/react_utils';
let SettingsContainer = React.createClass({ let SettingsContainer = React.createClass({
@ -25,9 +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
// Provided from AscribeApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -45,9 +44,7 @@ let SettingsContainer = React.createClass({
if (isLoggedIn) { if (isLoggedIn) {
return ( return (
<div className="settings-container"> <div className="settings-container">
<AccountSettings <AccountSettings loadUser={this.loadUser} />
loadUser={this.loadUser}
whitelabel={whitelabel} />
{children} {children}
<AclProxy <AclProxy
aclObject={whitelabel} aclObject={whitelabel}
@ -67,4 +64,4 @@ let SettingsContainer = React.createClass({
} }
}); });
export default withCurrentUser(SettingsContainer); export default withCurrentUser(withWhitelabel(SettingsContainer));

View File

@ -18,9 +18,6 @@ import { setDocumentTitle } from '../utils/dom_utils';
let CoaVerifyContainer = React.createClass({ let CoaVerifyContainer = React.createClass({
propTypes: { propTypes: {
// Provided from AscribeApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },

View File

@ -17,21 +17,21 @@ import AclProxy from './acl_proxy';
import HeaderNotifications from './header_notifications'; import HeaderNotifications from './header_notifications';
import HeaderNotificationDebug from './header_notification_debug'; import HeaderNotificationDebug from './header_notification_debug';
import NavRoutesLinks from './nav_routes_links'; import NavRoutesLinks from './nav_routes_links';
import { currentUserShape } from './prop_types'; import { currentUserShape, whitelabelShape } from './prop_types';
import { constructHead } from '../utils/dom_utils'; import { constructHead } from '../utils/dom_utils';
import { getLangText } from '../utils/lang_utils'; import { getLangText } from '../utils/lang_utils';
import { withCurrentUser } from '../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../utils/react_utils';
let Header = React.createClass({ let Header = React.createClass({
propTypes: { propTypes: {
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
whitelabel: React.PropTypes.object.isRequired,
// 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
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
}, },
getInitialState() { getInitialState() {
@ -219,4 +219,4 @@ let Header = React.createClass({
} }
}); });
export default withCurrentUser(Header); export default withCurrentUser(withWhitelabel(Header));

View File

@ -5,22 +5,27 @@ import Link from 'react-router/es6/Link';
import LoginForm from './ascribe_forms/form_login'; import LoginForm from './ascribe_forms/form_login';
import { getLangText } from '../utils/lang_utils'; import { whitelabelShape } from './prop_types';
import { setDocumentTitle } from '../utils/dom_utils'; import { setDocumentTitle } from '../utils/dom_utils';
import { getLangText } from '../utils/lang_utils';
import { withWhitelabel } from '../utils/react_utils';
let LoginContainer = React.createClass({ let LoginContainer = React.createClass({
propTypes: { propTypes: {
// Provided from AscribeApp // Injected through HOCs
whitelabel: React.PropTypes.object, whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },
render() { render() {
const { whitelabel: { name: whitelabelName }, const {
location } = this.props; whitelabel: { name: whitelabelName },
location
} = this.props;
setDocumentTitle(getLangText('Log in')); setDocumentTitle(getLangText('Log in'));
@ -38,6 +43,4 @@ let LoginContainer = React.createClass({
} }
}); });
export default withWhitelabel(LoginContainer);
export default LoginContainer;

View File

@ -16,9 +16,6 @@ import { setDocumentTitle } from '../utils/dom_utils';
let PasswordResetContainer = React.createClass({ let PasswordResetContainer = React.createClass({
propTypes: { propTypes: {
// Provided from AscribeApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },

View File

@ -47,9 +47,6 @@ const PieceList = React.createClass({
orderParams: React.PropTypes.array, orderParams: React.PropTypes.array,
orderBy: React.PropTypes.string, orderBy: React.PropTypes.string,
// Provided from AscribeApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },
@ -274,13 +271,14 @@ const PieceList = React.createClass({
}, },
render() { render() {
const { accordionListItemType: AccordionListItemType, const {
bulkModalButtonListType: BulkModalButtonListType,
customSubmitButton, customSubmitButton,
customThumbnailPlaceholder, customThumbnailPlaceholder,
filterParams, filterParams,
orderParams, orderParams,
whitelabel } = this.props; accordionListItemType: AccordionListItemType,
bulkModalButtonListType: BulkModalButtonListType
} = this.props;
const loadingElement = <AscribeSpinner color='dark-blue' size='lg'/>; const loadingElement = <AscribeSpinner color='dark-blue' size='lg'/>;
@ -311,7 +309,6 @@ const PieceList = React.createClass({
availableAcls={availableAcls} availableAcls={availableAcls}
handleSuccess={this.handleAclSuccess} handleSuccess={this.handleAclSuccess}
pieceOrEditions={selectedEditions} pieceOrEditions={selectedEditions}
whitelabel={whitelabel}
className="text-center ascribe-button-list collapse-group"> className="text-center ascribe-button-list collapse-group">
<DeleteButton <DeleteButton
handleSuccess={this.handleAclSuccess} handleSuccess={this.handleAclSuccess}
@ -339,8 +336,7 @@ const PieceList = React.createClass({
key={piece.id} key={piece.id}
className="col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2 ascribe-accordion-list-item" className="col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2 ascribe-accordion-list-item"
content={piece} content={piece}
thumbnailPlaceholder={customThumbnailPlaceholder} thumbnailPlaceholder={customThumbnailPlaceholder}>
whitelabel={whitelabel}>
<AccordionListItemTableEditions <AccordionListItemTableEditions
className="ascribe-accordion-list-item-table col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2" className="ascribe-accordion-list-item-table col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2"
parentId={piece.id} /> parentId={piece.id} />

View File

@ -1 +1,2 @@
export { default as currentUserShape } from './current_user_shape'; export { default as currentUserShape } from './current_user_shape';
export { default as whitelabelShape } from './whitelabel_shape';

View File

@ -0,0 +1,11 @@
import React from 'react';
const { shape, string } = React.PropTypes;
export default shape({
name: string,
subdomain: string,
title: string,
user: string
});

View File

@ -13,6 +13,7 @@ import GlobalNotificationActions from '../actions/global_notification_actions';
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 { whitelabelShape } from './prop_types';
import { getLangText } from '../utils/lang_utils'; import { getLangText } from '../utils/lang_utils';
import { setDocumentTitle } from '../utils/dom_utils'; import { setDocumentTitle } from '../utils/dom_utils';
@ -29,8 +30,8 @@ const RegisterPiece = React.createClass( {
React.PropTypes.string React.PropTypes.string
]), ]),
// Provided from AscribeApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired, whitelabel: whitelabelShape.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object

View File

@ -3,14 +3,17 @@ import Link from 'react-router/es6/Link';
import SignupForm from './ascribe_forms/form_signup'; import SignupForm from './ascribe_forms/form_signup';
import { getLangText } from '../utils/lang_utils'; import { whitelabelShape } from './prop_types';
import { setDocumentTitle } from '../utils/dom_utils'; import { setDocumentTitle } from '../utils/dom_utils';
import { getLangText } from '../utils/lang_utils';
import { withWhitelabel } from '../utils/react_utils';
let SignupContainer = React.createClass({ let SignupContainer = React.createClass({
propTypes: { propTypes: {
// Provided from AscribeApp // Injected through HOCs
whitelabel: React.PropTypes.object, whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -31,8 +34,10 @@ let SignupContainer = React.createClass({
}, },
render() { render() {
const { location, 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'));
@ -63,4 +68,4 @@ let SignupContainer = React.createClass({
}); });
export default SignupContainer; export default withWhitelabel(SignupContainer);

View File

@ -5,16 +5,17 @@ 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 { getLangText } from '../../../../../utils/lang_utils'; import { whitelabelShape } from '../../../../prop_types';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let Vivi23Landing = React.createClass({ let Vivi23Landing = React.createClass({
propTypes: { propTypes: {
customThumbnailPlaceholder: React.PropTypes.func, // Injected through HOCs
whitelabel: whitelabelShape.isRequired,
// Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -68,4 +69,4 @@ let Vivi23Landing = React.createClass({
} }
}); });
export default Vivi23Landing; export default withWhitelabel(Vivi23Landing);

View File

@ -8,9 +8,6 @@ import MarketPieceList from '../market/market_piece_list';
let Vivi23PieceList = React.createClass({ let Vivi23PieceList = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },

View File

@ -5,14 +5,17 @@ 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 { whitelabelShape } from '../../../../prop_types';
import { getLangText } from '../../../../../utils/lang_utils'; import { getLangText } from '../../../../../utils/lang_utils';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let ArtcityLanding = React.createClass({ let ArtcityLanding = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired whitelabel: whitelabelShape.isRequired
}, },
componentWillMount() { componentWillMount() {
@ -60,4 +63,4 @@ let ArtcityLanding = React.createClass({
} }
}); });
export default ArtcityLanding; export default withWhitelabel(ArtcityLanding);

View File

@ -13,9 +13,6 @@ import { mergeOptions } from '../../../../../utils/general_utils';
let CCRegisterPiece = React.createClass({ let CCRegisterPiece = React.createClass({
propTypes: { propTypes: {
// Provided from AscribeApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },

View File

@ -31,9 +31,6 @@ const CylandPieceContainer = React.createClass({
propTypes: { propTypes: {
router: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired,
// Provided from WalletApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object, location: React.PropTypes.object,
params: React.PropTypes.object params: React.PropTypes.object

View File

@ -6,15 +6,17 @@ import Button from 'react-bootstrap/lib/Button';
import LinkContainer from 'react-router-bootstrap/lib/LinkContainer'; import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
import { whitelabelShape } from '../../../../prop_types';
import { getLangText } from '../../../../../utils/lang_utils';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let CylandLanding = React.createClass({ let CylandLanding = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired whitelabel: whitelabelShape.isRequired,
}, },
render() { render() {
@ -62,4 +64,4 @@ let CylandLanding = React.createClass({
} }
}); });
export default CylandLanding; export default withWhitelabel(CylandLanding);

View File

@ -5,19 +5,17 @@ import PieceList from '../../../../piece_list';
import CylandAccordionListItem from './cyland_accordion_list/cyland_accordion_list_item'; import CylandAccordionListItem from './cyland_accordion_list/cyland_accordion_list_item';
import { currentUserShape } from '../../../../prop_types'; import { currentUserShape, whitelabelShape } 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';
import { withCurrentUser } from '../../../../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../../../../utils/react_utils';
let CylandPieceList = React.createClass({ let CylandPieceList = React.createClass({
propTypes: { propTypes: {
// Injected through HOCs // Injected through HOCs
currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types currentUser: currentUserShape.isRequired,
whitelabel: whitelabelShape.isRequired,
// Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -59,4 +57,4 @@ let CylandPieceList = React.createClass({
} }
}); });
export default withCurrentUser(CylandPieceList); export default withCurrentUser(withWhitelabel(CylandPieceList));

View File

@ -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 { currentUserShape } from '../../../../prop_types'; import { currentUserShape, whitelabelShape } from '../../../../prop_types';
import ApiUrls from '../../../../../constants/api_urls'; import ApiUrls from '../../../../../constants/api_urls';
@ -32,7 +32,7 @@ import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getAclFormMessage } from '../../../../../utils/form_utils'; import { getAclFormMessage } from '../../../../../utils/form_utils';
import { getLangText } from '../../../../../utils/lang_utils'; import { getLangText } from '../../../../../utils/lang_utils';
import { mergeOptions } from '../../../../../utils/general_utils'; import { mergeOptions } from '../../../../../utils/general_utils';
import { withCurrentUser } from '../../../../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../../../../utils/react_utils';
const CylandRegisterPiece = React.createClass({ const CylandRegisterPiece = React.createClass({
@ -41,9 +41,7 @@ const CylandRegisterPiece = 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,
// Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -223,4 +221,4 @@ const CylandRegisterPiece = React.createClass({
} }
}); });
export default withRouter(withCurrentUser(CylandRegisterPiece)); export default withRouter(withCurrentUser(withWhitelabel(CylandRegisterPiece)));

View File

@ -5,17 +5,17 @@ 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 { whitelabelShape } from '../../../../prop_types';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
import { getLangText } from '../../../../../utils/lang_utils';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let DemoLanding = React.createClass({ let DemoLanding = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp // Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired whitelabel: whitelabelShape.isRequired,
}, },
componentWillMount() { componentWillMount() {
@ -63,4 +63,4 @@ let DemoLanding = React.createClass({
} }
}); });
export default DemoLanding; export default withWhitelabel(DemoLanding);

View File

@ -15,13 +15,13 @@ import OwnershipFetcher from '../../../../../fetchers/ownership_fetcher';
import CopyrightAssociationForm from '../../../../ascribe_forms/form_copyright_association'; import CopyrightAssociationForm from '../../../../ascribe_forms/form_copyright_association';
import Property from '../../../../ascribe_forms/property'; import Property from '../../../../ascribe_forms/property';
import { currentUserShape } from '../../../../../prop_types'; import { currentUserShape, whitelabelShape } from '../../../../prop_types';
import AppConstants from '../../../../../constants/application_constants'; import AppConstants from '../../../../../constants/application_constants';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils'; import { getLangText } from '../../../../../utils/lang_utils';
import { withCurrentUser } from '../../../../../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../../../../utils/react_utils';
const IkonotvContractNotifications = React.createClass({ const IkonotvContractNotifications = React.createClass({
@ -30,9 +30,7 @@ const IkonotvContractNotifications = 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
// Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -203,4 +201,4 @@ const IkonotvContractNotifications = React.createClass({
} }
}); });
export default withRouter(withCurrentUser(IkonotvContractNotifications)); export default withRouter(withCurrentUser(withWhitelabel(IkonotvContractNotifications)));

View File

@ -32,9 +32,6 @@ const IkonotvPieceContainer = React.createClass({
propTypes: { propTypes: {
router: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired,
// Provided from WalletApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object, location: React.PropTypes.object,
params: React.PropTypes.object params: React.PropTypes.object

View File

@ -16,9 +16,6 @@ let IkonotvLanding = 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
// Provided from WalletApp
whitelabel: React.PropTypes.object,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
}, },

View File

@ -8,20 +8,20 @@ import NotificationStore from '../../../../../stores/notification_store';
import IkonotvAccordionListItem from './ikonotv_accordion_list/ikonotv_accordion_list_item'; import IkonotvAccordionListItem from './ikonotv_accordion_list/ikonotv_accordion_list_item';
import { currentUserShape } from '../../../../prop_types'; import { currentUserShape, whitelabelShape } 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';
import { withCurrentUser } from '../../../../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../../../../utils/react_utils';
let IkonotvPieceList = React.createClass({ let IkonotvPieceList = React.createClass({
propTypes: { propTypes: {
// Injected through HOCs // Injected through HOCs
currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types currentUser: currentUserShape.isRequired,
whitelabel: whitelabelShape.isRequired,
// Provided from WalletApp // Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -91,4 +91,4 @@ let IkonotvPieceList = React.createClass({
} }
}); });
export default withCurrentUser(IkonotvPieceList); export default withCurrentUser(withWhitelabel(IkonotvPieceList));

View File

@ -22,13 +22,13 @@ import LoanForm from '../../../../ascribe_forms/form_loan';
import SlidesContainer from '../../../../ascribe_slides_container/slides_container'; import SlidesContainer from '../../../../ascribe_slides_container/slides_container';
import { currentUserShape } from '../../../../prop_types'; import { currentUserShape, whitelabelShape } from '../../../../prop_types';
import ApiUrls from '../../../../../constants/api_urls'; import ApiUrls from '../../../../../constants/api_urls';
import { mergeOptions } from '../../../../../utils/general_utils'; import { mergeOptions } from '../../../../../utils/general_utils';
import { getLangText } from '../../../../../utils/lang_utils'; import { getLangText } from '../../../../../utils/lang_utils';
import { withCurrentUser } from '../../../../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../../../../utils/react_utils';
const IkonotvRegisterPiece = React.createClass({ const IkonotvRegisterPiece = React.createClass({
@ -39,9 +39,7 @@ 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
whitelabel: whitelabelShape.isRequired, // eslint-disable-line react/sort-prop-types
// Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -248,4 +246,4 @@ const IkonotvRegisterPiece = React.createClass({
} }
}); });
export default withRouter(withCurrentUser(IkonotvRegisterPiece)); export default withRouter(withCurrentUser(withWhitelabel(IkonotvRegisterPiece)));

View File

@ -5,17 +5,17 @@ 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 { getLangText } from '../../../../../utils/lang_utils'; import { whitelabelShape } from '../../../../prop_types';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let LumenusLanding = React.createClass({ let LumenusLanding = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired, whitelabel: whitelabelShape.isRequired,
// Provided from router
location: React.PropTypes.object
}, },
componentWillMount() { componentWillMount() {
@ -65,4 +65,4 @@ let LumenusLanding = React.createClass({
} }
}); });
export default LumenusLanding; export default withWhitelabel(LumenusLanding);

View File

@ -16,7 +16,6 @@ let MarketAclButtonList = React.createClass({
availableAcls: React.PropTypes.object.isRequired, availableAcls: React.PropTypes.object.isRequired,
handleSuccess: React.PropTypes.func.isRequired, handleSuccess: React.PropTypes.func.isRequired,
pieceOrEditions: React.PropTypes.array.isRequired, pieceOrEditions: React.PropTypes.array.isRequired,
whitelabel: React.PropTypes.object.isRequired,
children: React.PropTypes.oneOfType([ children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.arrayOf(React.PropTypes.element),
@ -26,12 +25,13 @@ let MarketAclButtonList = React.createClass({
}, },
render() { render() {
const { availableAcls, const {
availableAcls,
children, children,
className, className,
handleSuccess, handleSuccess,
pieceOrEditions, pieceOrEditions
whitelabel } = this.props; } = this.props;
const buttonProps = selectFromObject(this.props, [ const buttonProps = selectFromObject(this.props, [
'availableAcls', 'availableAcls',
@ -44,8 +44,7 @@ let MarketAclButtonList = React.createClass({
<MarketSubmitButton <MarketSubmitButton
availableAcls={availableAcls} availableAcls={availableAcls}
editions={pieceOrEditions} editions={pieceOrEditions}
handleSuccess={handleSuccess} handleSuccess={handleSuccess} />
whitelabel={whitelabel} />
<EmailButton {...buttonProps} /> <EmailButton {...buttonProps} />
<TransferButton {...buttonProps} /> <TransferButton {...buttonProps} />
<UnconsignButton {...buttonProps} /> <UnconsignButton {...buttonProps} />

View File

@ -14,23 +14,23 @@ import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory';
import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper'; import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper';
import AclProxy from '../../../../../acl_proxy'; import AclProxy from '../../../../../acl_proxy';
import { currentUserShape } from '../../../../../prop_types'; import { currentUserShape, whitelabelShape } from '../../../../../prop_types';
import { getAclFormMessage, getAclFormDataId } from '../../../../../../utils/form_utils'; import { getAclFormMessage, getAclFormDataId } from '../../../../../../utils/form_utils';
import { getLangText } from '../../../../../../utils/lang_utils'; import { getLangText } from '../../../../../../utils/lang_utils';
import { withCurrentUser } from '../../../../../../utils/react_utils'; import { withCurrentUser, withWhitelabel } from '../../../../../../utils/react_utils';
let MarketSubmitButton = React.createClass({ let MarketSubmitButton = React.createClass({
propTypes: { propTypes: {
availableAcls: React.PropTypes.object.isRequired, availableAcls: React.PropTypes.object.isRequired,
editions: React.PropTypes.array.isRequired, editions: React.PropTypes.array.isRequired,
whitelabel: React.PropTypes.object.isRequired,
className: React.PropTypes.string, className: React.PropTypes.string,
handleSuccess: React.PropTypes.func, handleSuccess: React.PropTypes.func,
// 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
}, },
canEditionBeSubmitted(edition) { canEditionBeSubmitted(edition) {
@ -82,12 +82,14 @@ let MarketSubmitButton = React.createClass({
}, },
render() { render() {
const { availableAcls, const {
availableAcls,
currentUser, currentUser,
className, className,
editions, editions,
handleSuccess, handleSuccess,
whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.props; whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail }
} = this.props;
const { solePieceId, canEdit, canSubmit } = this.getAggregateEditionDetails(); const { solePieceId, canEdit, canSubmit } = this.getAggregateEditionDetails();
const message = getAclFormMessage({ const message = getAclFormMessage({
@ -185,4 +187,4 @@ let MarketSubmitButton = React.createClass({
} }
}); });
export default withCurrentUser(MarketSubmitButton); export default withCurrentUser(withWhitelabel(MarketSubmitButton));

View File

@ -5,17 +5,17 @@ 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 { whitelabelShape } from '../../../../prop_types';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
import { getLangText } from '../../../../../utils/lang_utils';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let MarketLanding = React.createClass({ let MarketLanding = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired whitelabel: whitelabelShape.isRequired,
}, },
componentDidUpdate() { componentDidUpdate() {
@ -69,4 +69,4 @@ let MarketLanding = React.createClass({
} }
}); });
export default MarketLanding; export default withWhitelabel(MarketLanding);

View File

@ -5,11 +5,11 @@ import React from 'react';
import MarketAclButtonList from './market_buttons/market_acl_button_list'; import MarketAclButtonList from './market_buttons/market_acl_button_list';
import PieceList from '../../../../piece_list'; import PieceList from '../../../../piece_list';
import { currentUserShape } from '../../../../prop_types'; import { currentUserShape, whitelabelShape } 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';
import { withCurrentUser } from '../../../../../utils/react_utils'; import { withCurrentUser, withWhiteLabel } from '../../../../../utils/react_utils';
let MarketPieceList = React.createClass({ let MarketPieceList = React.createClass({
propTypes: { propTypes: {
@ -17,9 +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
// Provided from WalletApp
whitelabel: React.PropTypes.object.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -73,4 +71,4 @@ let MarketPieceList = React.createClass({
} }
}); });
export default withCurrentUser(MarketPieceList); export default withCurrentUser(withWhitelabel(MarketPieceList));

View File

@ -17,16 +17,19 @@ 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 { getLangText } from '../../../../../utils/lang_utils'; import { 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';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let MarketRegisterPiece = React.createClass({ let MarketRegisterPiece = React.createClass({
propTypes: { propTypes: {
router: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired,
// Provided from WalletApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired, whitelabel: whitelabelShape.isRequired,
// Provided from router // Provided from router
location: React.PropTypes.object location: React.PropTypes.object
@ -98,10 +101,12 @@ let MarketRegisterPiece = React.createClass({
}, },
render() { render() {
const { location, const {
location,
whitelabel: { whitelabel: {
name: whitelabelName = 'Market' name: whitelabelName = 'Market'
} } = this.props }
} = this.props
const { piece, step } = this.state; const { piece, step } = this.state;
setDocumentTitle(getLangText('Register a new piece')); setDocumentTitle(getLangText('Register a new piece'));
@ -157,4 +162,4 @@ let MarketRegisterPiece = React.createClass({
} }
}); });
export default withRouter(MarketRegisterPiece); export default withRouter(withWhitelabel(MarketRegisterPiece));

View File

@ -5,17 +5,17 @@ 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 { whitelabelShape } from '../../../../prop_types';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
import { getLangText } from '../../../../../utils/lang_utils';
import { setDocumentTitle } from '../../../../../utils/dom_utils'; import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { getLangText } from '../../../../../utils/lang_utils';
import { withWhitelabel } from '../../../../../utils/react_utils';
let PollineLanding = React.createClass({ let PollineLanding = React.createClass({
propTypes: { propTypes: {
// Provided from WalletApp // Injected through HOCs
whitelabel: React.PropTypes.object.isRequired whitelabel: whitelabelShape.isRequired,
}, },
componentWillMount() { componentWillMount() {
@ -63,4 +63,4 @@ let PollineLanding = React.createClass({
} }
}); });
export default PollineLanding; export default withWhitelabel(PollineLanding);

View File

@ -15,13 +15,10 @@ let WalletApp = React.createClass({
children: React.PropTypes.element.isRequired, children: React.PropTypes.element.isRequired,
router: React.PropTypes.object.isRequired, router: React.PropTypes.object.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
// Provided from AppBase
whitelabel: React.PropTypes.object
}, },
render() { render() {
const { activeRoute, children, router, routes, whitelabel } = this.props; const { activeRoute, children, router, routes } = this.props;
const subdomain = getSubdomain(); const subdomain = getSubdomain();
const path = activeRoute && activeRoute.path; const path = activeRoute && activeRoute.path;
const Footer = activeRoute && activeRoute.footer; const Footer = activeRoute && activeRoute.footer;
@ -33,9 +30,7 @@ let WalletApp = React.createClass({
header = (<div className="hero"/>); header = (<div className="hero"/>);
} else { } else {
header = ( header = (
<Header <Header routes={routes} />
routes={routes}
whitelabel={whitelabel} />
); );
} }
@ -44,8 +39,7 @@ let WalletApp = React.createClass({
return ( return (
<div className={classNames('ascribe-app', 'ascribe-wallet-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}> <div className={classNames('ascribe-app', 'ascribe-wallet-app', `route--${(path ? path.split('/')[0] : 'landing')}`)}>
{header} {header}
<AppRouteWrapper <AppRouteWrapper>
whitelabel={whitelabel}>
{/* Routes are injected here */} {/* Routes are injected here */}
{children} {children}
</AppRouteWrapper> </AppRouteWrapper>

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { currentUserShape } from '../components/prop_types'; import { currentUserShape, whitelabelShape } from '../components/prop_types';
/** /**
@ -32,3 +32,25 @@ export function withCurrentUser(Component) {
return WithCurrentUser; return WithCurrentUser;
} }
/**
* Similar to react-router's `withRouter`, this injects the `whitelabel` from the Component's
* context into the Component as a prop.
*
* @param {Component} Component Component to inject `context.whitelabel` into
* @return {Component} Wrapped component
*/
export function withWhitelabel(Component) {
const contextTypes = {
whitelabel: whitelabelShape.isRequired
};
const WithWhitelabel = (props, { whitelabel }) => (
<Component {...props} whitelabel={whitelabel} />
);
WithWhitelabel.displayName = `WithWhitelabel(${getDisplayName(Component)})`;
WithWhitelabel.contextTypes = contextTypes;
return WithWhitelabel;
}