2016-12-22 14:09:16 +01:00
|
|
|
import 'whatwg-fetch';
|
2016-12-20 19:15:12 +01:00
|
|
|
import 'react-mdl/extra/material.css';
|
|
|
|
import 'react-mdl/extra/material.js';
|
|
|
|
|
2016-11-10 14:26:24 +01:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2016-12-29 11:55:25 +01:00
|
|
|
import { applyRouterMiddleware, Router, Route, IndexRedirect, hashHistory } from 'react-router';
|
|
|
|
import { useScroll } from 'react-router-scroll';
|
2016-11-10 14:26:24 +01:00
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import thunkMiddleware from 'redux-thunk';
|
2017-01-06 11:52:44 +01:00
|
|
|
import { createStore, applyMiddleware, compose } from 'redux';
|
2016-11-10 14:26:24 +01:00
|
|
|
|
|
|
|
import store from './store';
|
|
|
|
import App from './component/app';
|
|
|
|
|
|
|
|
import Features from './page/features';
|
|
|
|
import CreateFeatureToggle from './page/features/create';
|
2016-12-19 20:53:49 +01:00
|
|
|
import ViewFeatureToggle from './page/features/show';
|
2016-11-10 14:26:24 +01:00
|
|
|
import Strategies from './page/strategies';
|
2016-12-05 16:01:09 +01:00
|
|
|
import StrategyView from './page/strategies/show';
|
2016-11-10 14:26:24 +01:00
|
|
|
import CreateStrategies from './page/strategies/create';
|
|
|
|
import HistoryPage from './page/history';
|
2016-11-22 22:04:30 +01:00
|
|
|
import HistoryTogglePage from './page/history/toggle';
|
2016-11-10 14:26:24 +01:00
|
|
|
import Archive from './page/archive';
|
2016-12-03 15:54:15 +01:00
|
|
|
import Applications from './page/applications';
|
2016-12-05 15:15:01 +01:00
|
|
|
import ApplicationView from './page/applications/view';
|
2016-11-10 14:26:24 +01:00
|
|
|
|
2017-01-06 11:52:44 +01:00
|
|
|
let composeEnhancers;
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
|
|
|
|
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
|
|
} else {
|
|
|
|
composeEnhancers = compose;
|
|
|
|
}
|
|
|
|
|
2016-11-10 14:26:24 +01:00
|
|
|
const unleashStore = createStore(
|
|
|
|
store,
|
2017-01-06 11:52:44 +01:00
|
|
|
composeEnhancers(
|
|
|
|
applyMiddleware(thunkMiddleware)
|
2016-11-10 14:26:24 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2016-12-05 17:04:00 +01:00
|
|
|
// "pageTitle" and "link" attributes are for internal usage only
|
|
|
|
|
2016-11-10 14:26:24 +01:00
|
|
|
ReactDOM.render(
|
|
|
|
<Provider store={unleashStore}>
|
2016-12-29 11:55:25 +01:00
|
|
|
<Router history={hashHistory} render={applyRouterMiddleware(useScroll())}>
|
2016-11-10 14:26:24 +01:00
|
|
|
<Route path="/" component={App}>
|
|
|
|
<IndexRedirect to="/features" />
|
2016-12-05 17:04:00 +01:00
|
|
|
|
|
|
|
<Route pageTitle="Features" link="/features">
|
|
|
|
<Route pageTitle="Features" path="/features" component={Features} />
|
|
|
|
<Route pageTitle="New" path="/features/create" component={CreateFeatureToggle} />
|
2016-12-19 20:53:49 +01:00
|
|
|
<Route pageTitle=":name" path="/features/:activeTab/:name" component={ViewFeatureToggle} />
|
2016-12-05 17:04:00 +01:00
|
|
|
</Route>
|
2016-12-14 12:50:23 +01:00
|
|
|
|
2016-12-05 17:04:00 +01:00
|
|
|
<Route pageTitle="Strategies" link="/strategies">
|
|
|
|
<Route pageTitle="Strategies" path="/strategies" component={Strategies} />
|
|
|
|
<Route pageTitle="New" path="/strategies/create" component={CreateStrategies} />
|
2016-12-18 10:27:04 +01:00
|
|
|
<Route pageTitle=":strategyName" path="/strategies/:activeTab/:strategyName" component={StrategyView} />
|
2016-12-05 17:04:00 +01:00
|
|
|
</Route>
|
2016-12-14 12:50:23 +01:00
|
|
|
|
2016-12-05 17:04:00 +01:00
|
|
|
<Route pageTitle="History" link="/history">
|
|
|
|
<Route pageTitle="History" path="/history" component={HistoryPage} />
|
|
|
|
<Route pageTitle=":toggleName" path="/history/:toggleName" component={HistoryTogglePage} />
|
|
|
|
</Route>
|
|
|
|
|
2016-12-04 15:23:22 +01:00
|
|
|
<Route pageTitle="Archive" path="/archive" component={Archive} />
|
2016-12-05 17:04:00 +01:00
|
|
|
<Route pageTitle="Applications" link="/applications">
|
|
|
|
<Route pageTitle="Applications" path="/applications" component={Applications} />
|
|
|
|
<Route pageTitle=":name" path="/applications/:name" component={ApplicationView} />
|
|
|
|
</Route>
|
2016-12-14 12:50:23 +01:00
|
|
|
|
2016-11-10 14:26:24 +01:00
|
|
|
</Route>
|
|
|
|
</Router>
|
|
|
|
</Provider>, document.getElementById('app'));
|