From 75247b25944d7744cd6545df4d372521d9fd1fe3 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 7 Jun 2016 17:46:12 +0200 Subject: [PATCH] Remove obsolete AppRouteWrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that currentUser and whitelabel are passed as context, we don’t need AppRouteWrapper to copy them into routes as props --- js/components/app_route_wrapper.js | 34 ------------------- js/components/ascribe_app.js | 5 ++- js/components/whitelabel/wallet/wallet_app.js | 5 ++- 3 files changed, 4 insertions(+), 40 deletions(-) delete mode 100644 js/components/app_route_wrapper.js diff --git a/js/components/app_route_wrapper.js b/js/components/app_route_wrapper.js deleted file mode 100644 index d680faeb..00000000 --- a/js/components/app_route_wrapper.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -import React from 'react'; - -import { omitFromObject } from '../utils/general_utils'; - -const AppRouteWrapper = React.createClass({ - propTypes: { - children: React.PropTypes.oneOfType([ - React.PropTypes.arrayOf(React.PropTypes.element), - React.PropTypes.element - ]).isRequired - }, - - render() { - const propsToPropagate = omitFromObject(this.props, ['children']); - - let childrenWithProps = this.props.children; - // If there are more props given, propagate them into the child routes by cloning the routes - if (Object.keys(propsToPropagate).length) { - childrenWithProps = React.Children.map(this.props.children, (child) => { - return React.cloneElement(child, propsToPropagate); - }); - } - - return ( -
- {childrenWithProps} -
- ); - } -}); - -export default AppRouteWrapper; diff --git a/js/components/ascribe_app.js b/js/components/ascribe_app.js index 7a7fb2d6..7cbc435f 100644 --- a/js/components/ascribe_app.js +++ b/js/components/ascribe_app.js @@ -1,7 +1,6 @@ import React from 'react'; import AppBase from './app_base'; -import AppRouteWrapper from './app_route_wrapper'; import Footer from './footer'; import Header from './header'; @@ -20,10 +19,10 @@ const AscribeApp = React.createClass({ return (
- +
{/* Routes are injected here */} {children} - +
{showFooter ?
: null}
); diff --git a/js/components/whitelabel/wallet/wallet_app.js b/js/components/whitelabel/wallet/wallet_app.js index 0bbfd38d..acb6bd3e 100644 --- a/js/components/whitelabel/wallet/wallet_app.js +++ b/js/components/whitelabel/wallet/wallet_app.js @@ -3,7 +3,6 @@ import withRouter from 'react-router/es6/withRouter'; import classNames from 'classnames'; import AppBase from '../../app_base'; -import AppRouteWrapper from '../../app_route_wrapper'; import Header from '../../header'; import { getSubdomain } from '../../../utils/general_utils'; @@ -39,10 +38,10 @@ let WalletApp = React.createClass({ return (
{header} - +
{/* Routes are injected here */} {children} - +
{Footer ?
);