1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/index.jsx

77 lines
3.2 KiB
React
Raw Normal View History

2016-12-22 14:09:16 +01:00
import 'whatwg-fetch';
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';
import ViewFeatureToggle from './page/features/show';
2016-11-10 14:26:24 +01:00
import Strategies from './page/strategies';
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
2017-03-07 14:55:33 +01:00
<Route pageTitle="Feature Toggles" link="/features">
<Route pageTitle="Feature toggles" path="/features" component={Features} />
2016-12-05 17:04:00 +01:00
<Route pageTitle="New" path="/features/create" component={CreateFeatureToggle} />
<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} />
<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
2017-03-07 14:55:33 +01:00
<Route pageTitle="Event History" link="/history">
2017-06-29 08:36:10 +02:00
<Route pageTitle="Event history" path="/history" component={HistoryPage} />
2016-12-05 17:04:00 +01:00
<Route pageTitle=":toggleName" path="/history/:toggleName" component={HistoryTogglePage} />
</Route>
2017-03-07 14:55:33 +01:00
<Route pageTitle="Archived Toggles" 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'));