Last active
May 13, 2016 08:57
-
-
Save iongion/0ba4980ed1bdeef2ab31241e0c859ece to your computer and use it in GitHub Desktop.
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
// entry point | |
// node | |
// vendors | |
import 'babel-polyfill'; | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { Router, Route, IndexRoute, hashHistory } from 'react-router'; | |
import { syncHistoryWithStore } from 'react-router-redux'; | |
// project | |
import configureStore from './store/configureStore'; | |
import AppPage from './containers/pages/App'; | |
import HomePage from './containers/pages/Home'; | |
export default class EntryPoint { | |
boot(node) { | |
this.store = configureStore({ | |
configuration: { | |
video: { | |
width: 1280, | |
height: 720, | |
}, | |
}, | |
domain: {}, | |
}); | |
this.history = syncHistoryWithStore(hashHistory, this.store); | |
this.renderTo(node); | |
return this; | |
} | |
renderTo(node) { | |
render( | |
<Provider store={this.store}> | |
<Router history={this.history}> | |
<Route path="/" component={AppPage}> | |
<IndexRoute component={HomePage} /> | |
<Route path="/home" component={HomePage} /> | |
</Route> | |
</Router> | |
</Provider> | |
, | |
node | |
); | |
return this; | |
} | |
} | |
// reducers | |
// node | |
// vendors | |
import { routerReducer } from 'react-router-redux'; | |
import { combineReducers } from 'redux'; | |
import _ from 'lodash'; | |
// project | |
import * as ActionTypes from '../actions'; | |
function configuration(state, action) { | |
console.debug('configuration reducer called', state, action); | |
switch (action.type) { | |
case ActionTypes.CONFIGURE_APP: | |
return state; | |
default: | |
return state; | |
} | |
} | |
function domain(state = {}, action) { | |
console.debug('domain reducer called', state, action); | |
switch (action.type) { | |
default: | |
return state; | |
} | |
} | |
/* | |
export default function combined(state, action) { | |
return { | |
configuration: configuration(state.configuration, action), | |
domain: domain(state.domain, action), | |
routing: routerReducer, | |
}; | |
} | |
*/ | |
export default combineReducers({ | |
routing: routerReducer, | |
configuration, | |
domain, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment