-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conditional rendering of DevTools
- Loading branch information
Showing
9 changed files
with
115 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,38 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Switch, Route } from 'react-router'; | ||
|
||
const App = ({ children }) => | ||
<div id="venomkb-app"> | ||
{ children } | ||
</div>; | ||
import Home from './Home'; | ||
import About from './About'; | ||
import AboutFeatures from './AboutFeatures'; | ||
import AboutVenomseq from './AboutVenomseq'; | ||
import AboutOntology from './AboutOntology'; | ||
import AboutVenoms from './AboutVenoms'; | ||
import AboutApi from './AboutApi'; | ||
import Contact from './Contact'; | ||
import Publications from './Publications'; | ||
import Download from './Download'; | ||
import NotFound from './NotFound'; | ||
|
||
App.propTypes = { | ||
children: PropTypes.object | ||
}; | ||
import DataContainer from '../containers/DataContainer'; | ||
import DataDetailContainer from '../containers/DataDetailContainer'; | ||
|
||
const App = () => ( | ||
<Switch> | ||
<Route exact path="/" component={Home} /> | ||
<Route path="/about" component={About} /> | ||
<Route path="/about/features" component={AboutFeatures} /> | ||
<Route path="/about/venomseq" component={AboutVenomseq} /> | ||
<Route path="/about/ontology" component={AboutOntology} /> | ||
<Route path="/about/whyvenoms" component={AboutVenoms} /> | ||
<Route path="/about/api" components={AboutApi} /> | ||
<Route path="/contact" component={Contact} /> | ||
<Route path="/publications" component={Publications} /> | ||
<Route path="/data" component={DataContainer} /> | ||
<Route path="/download" component={Download} /> | ||
<Route path="/:index" component={DataDetailContainer} /> | ||
<Route path="*" component={NotFound} /> | ||
</Switch> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { Component } from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import createHistory from 'history/createBrowserHistory'; | ||
import { ConnectedRouter } from 'react-router-redux'; | ||
|
||
|
||
import App from '../components/App'; | ||
import DevTools from './DevTools'; | ||
|
||
const history = createHistory(); | ||
|
||
export default class Root extends Component { | ||
render() { | ||
const { store } = this.props; | ||
|
||
return ( | ||
<Provider store={store}> | ||
<ConnectedRouter history={history}> | ||
<div> | ||
<App/> | ||
<DevTools/> | ||
</div> | ||
</ConnectedRouter> | ||
</Provider> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./Root.prod'); | ||
} else { | ||
module.exports = require('./Root.dev'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React, { Component } from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import createHistory from 'history/createBrowserHistory'; | ||
import { ConnectedRouter } from 'react-router-redux'; | ||
|
||
import App from '../components/App'; | ||
|
||
const history = createHistory(); | ||
|
||
export default class Root extends Component { | ||
render() { | ||
const { store } = this.props; | ||
|
||
return ( | ||
<Provider store={store}> | ||
<ConnectedRouter history={history}> | ||
<App/> | ||
</ConnectedRouter> | ||
</Provider> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { createStore, applyMiddleware, compose } from 'redux'; | ||
import thunkMiddleware from 'redux-thunk'; | ||
import { persistState } from 'redux-devtools'; | ||
import rootReducer from '../reducers'; | ||
import DevTools from '../containers/DevTools'; | ||
|
||
export default function configureStore(initialState) { | ||
// const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | ||
const enhancer = compose( | ||
applyMiddleware(thunkMiddleware), | ||
DevTools.instrument() | ||
); | ||
// middleware | ||
import thunkMiddleware from 'redux-thunk'; // thunk allows reducers to return functions instead of objects | ||
|
||
console.log("Calling configureStore.dev.js"); | ||
|
||
const store = createStore( | ||
rootReducer, | ||
initialState, | ||
enhancer | ||
); | ||
const enhancer = compose( | ||
applyMiddleware(thunkMiddleware), | ||
DevTools.instrument() | ||
); | ||
|
||
export default function configureStore(initialState) { | ||
const store = createStore(rootReducer, initialState, enhancer); | ||
|
||
return store; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { createStore } from 'redux'; | ||
import { createStore, applyMiddleware, compose } from 'redux'; | ||
import rootReducer from '../reducers'; | ||
|
||
// middleware | ||
import thunkMiddleware from 'redux-thunk'; | ||
|
||
console.log("Calling configureStore.prod.js"); | ||
|
||
const enhancer = applyMiddleware(thunkMiddleware); | ||
|
||
export default function configureStore(initialState) { | ||
return createStore( | ||
rootReducer, | ||
initialState | ||
); | ||
} | ||
return createStore(rootReducer, initialState, enhancer); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters