-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyaspv2.js
77 lines (72 loc) · 2.95 KB
/
yaspv2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from 'react';
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
import appReducer, { REDUCER_KEY } from './reducers';
import { getMetadata, getConstants } from './actions';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
import createLogger from 'redux-logger';
import { Router, Route, browserHistory, IndexRoute } from 'react-router';
import { syncHistoryWithStore, routerReducer as routing, routerMiddleware } from 'react-router-redux';
import App from './components/App';
import Match from './components/Match';
import Player from './components/Player';
import Home from './components/Home';
import Search from './components/Search';
import injectTapEventPlugin from 'react-tap-event-plugin';
// This is used by material-ui components
injectTapEventPlugin();
// Load CSS
// These are sprites, will be needed at some point
// require('./node_modules/dota2-minimap-hero-sprites/assets/stylesheets/dota2minimapheroes.css');
require('./node_modules/font-awesome/css/font-awesome.css');
import './assets/flaticon.css';
import './global.css';
import 'material-design-icons';
const loggerMiddleware = createLogger();
const reducer = combineReducers({
[REDUCER_KEY]: appReducer,
routing,
});
const store = createStore(reducer, compose(
applyMiddleware(thunkMiddleware),
applyMiddleware(loggerMiddleware),
applyMiddleware(routerMiddleware(browserHistory)),
window.devToolsExtension ? window.devToolsExtension() : f => f // This enables the redux dev tools extension, or does nothing if not installed
));
// Fetch metadata (used on all pages)
// store.dispatch(Actions.fetchData(Actions.METADATA));
store.dispatch(getMetadata());
store.dispatch(getConstants());
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store);
// history.listen(function(location) {Actions.routeChange(location)});
const reactElement = document.getElementById('react');
render(
<Provider store={store}>
{/* Tell the Router to use our enhanced history */}
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="search" component={Search} />
<Route path="matches/:match_id" component={Match}>
<Route path=":info" />
</Route>
<Route path="players/:account_id" component={Player}>
<Route path="/:info">
<Route path="/:subkey" />
</Route>
</Route>
</Route>
</Router>
</Provider>, reactElement);
/*
<Route path="distributions" component={Distribution}/>
<Route path="carry" component={Carry}/>
<Route path="picks/:n" component={Picks}/>
<Route path="mmstats" component={MMStats}/>
<Route path="rankings/:hero_id" component={Ranking}/>
<Route path="benchmarks/:hero_id" component={Benchmark}/>
<Route path="search" component={Search}/>
<Route path="status" component={Status}/>
*/