mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
Clean up entry point
This commit is contained in:
parent
0c75f92e4c
commit
c6c858e94a
@ -1,20 +1,11 @@
|
|||||||
var React = require('react');
|
var React = require('react');
|
||||||
var UserStore = require('./stores/UserStore');
|
var Router = require('react-router');
|
||||||
var Menu = require('./components/Menu');
|
var Menu = require('./components/Menu');
|
||||||
var ErrorMessages = require('./components/ErrorMessages');
|
var ErrorMessages = require('./components/ErrorMessages');
|
||||||
var initalizer = require('./stores/initalizer');
|
var initalizer = require('./stores/initalizer');
|
||||||
var LogEntriesComponent = require('./components/log/LogEntriesComponent');
|
|
||||||
var FeatureTogglesComponent = require('./components/feature/FeatureTogglesComponent');
|
|
||||||
var StrategiesComponent = require('./components/strategy/StrategiesComponent');
|
|
||||||
var ArchiveFeatureComponent = require('./components/feature/ArchiveFeatureComponent');
|
|
||||||
var Router = require('react-router');
|
|
||||||
var DefaultRoute = Router.DefaultRoute;
|
|
||||||
var Link = Router.Link;
|
var Link = Router.Link;
|
||||||
var Route = Router.Route;
|
|
||||||
var RouteHandler = Router.RouteHandler;
|
var RouteHandler = Router.RouteHandler;
|
||||||
|
|
||||||
UserStore.init();
|
|
||||||
|
|
||||||
var UnleashApp = React.createClass({
|
var UnleashApp = React.createClass({
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
router: React.PropTypes.func
|
router: React.PropTypes.func
|
||||||
@ -24,22 +15,22 @@ var UnleashApp = React.createClass({
|
|||||||
initalizer(30);
|
initalizer(30);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderLink: function(id, label) {
|
||||||
|
return (
|
||||||
|
<Link to={id} className="nav-element centerify" activeClassName="nav-active">
|
||||||
|
<span className="topbar-nav-svg-caption caption showbydefault no-break">{label}</span>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Menu>
|
<Menu>
|
||||||
<Link to="features" className="nav-element centerify" activeClassName="nav-active">
|
{this.renderLink("features", "Toggles")}
|
||||||
<span className="topbar-nav-svg-caption caption showbydefault no-break">Features</span>
|
{this.renderLink("strategies", "Strategies")}
|
||||||
</Link>
|
{this.renderLink("log", "Log")}
|
||||||
<Link to="strategies" className="nav-element centerify" activeClassName="nav-active">
|
{this.renderLink("archive", "Archive")}
|
||||||
<span className="topbar-nav-svg-caption caption showbydefault no-break">Strategies</span>
|
|
||||||
</Link>
|
|
||||||
<Link to="log" className="nav-element centerify" activeClassName="nav-active">
|
|
||||||
<span className="topbar-nav-svg-caption caption showbydefault no-break">Log</span>
|
|
||||||
</Link>
|
|
||||||
<Link to="archive" className="nav-element centerify" activeClassName="nav-active">
|
|
||||||
<span className="topbar-nav-svg-caption caption showbydefault no-break">Archive</span>
|
|
||||||
</Link>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className="page">
|
<div className="page">
|
||||||
@ -58,18 +49,5 @@ var UnleashApp = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var routes = (
|
|
||||||
<Route name="app" path="/" handler={UnleashApp}>
|
|
||||||
<Route name="strategies" handler={StrategiesComponent}/>
|
|
||||||
<Route name="log" handler={LogEntriesComponent}/>
|
|
||||||
<Route name="archive" handler={ArchiveFeatureComponent}/>
|
|
||||||
<DefaultRoute name="features" handler={FeatureTogglesComponent}/>
|
|
||||||
</Route>
|
|
||||||
);
|
|
||||||
|
|
||||||
Router.run(routes, function (Handler) {
|
|
||||||
React.render(<Handler/>, document.getElementById('content'));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = UnleashApp;
|
module.exports = UnleashApp;
|
||||||
|
10
public/js/app.jsx
Normal file
10
public/js/app.jsx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
var React = require('react');
|
||||||
|
var Router = require('react-router');
|
||||||
|
var UserStore = require('./stores/UserStore');
|
||||||
|
var routes = require('./routes');
|
||||||
|
|
||||||
|
UserStore.init();
|
||||||
|
|
||||||
|
Router.run(routes, function (Handler) {
|
||||||
|
React.render(<Handler/>, document.getElementById('content'));
|
||||||
|
});
|
20
public/js/routes.jsx
Normal file
20
public/js/routes.jsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
var React = require('react');
|
||||||
|
var Router = require('react-router');
|
||||||
|
var UnleashApp = require('./UnleashApp');
|
||||||
|
var LogEntriesComponent = require('./components/log/LogEntriesComponent');
|
||||||
|
var FeatureTogglesComponent = require('./components/feature/FeatureTogglesComponent');
|
||||||
|
var StrategiesComponent = require('./components/strategy/StrategiesComponent');
|
||||||
|
var ArchiveFeatureComponent = require('./components/feature/ArchiveFeatureComponent');
|
||||||
|
var DefaultRoute = Router.DefaultRoute;
|
||||||
|
var Route = Router.Route;
|
||||||
|
|
||||||
|
var routes = (
|
||||||
|
<Route name="app" path="/" handler={UnleashApp}>
|
||||||
|
<Route name="strategies" handler={StrategiesComponent}/>
|
||||||
|
<Route name="log" handler={LogEntriesComponent}/>
|
||||||
|
<Route name="archive" handler={ArchiveFeatureComponent}/>
|
||||||
|
<DefaultRoute name="features" handler={FeatureTogglesComponent}/>
|
||||||
|
</Route>
|
||||||
|
);
|
||||||
|
|
||||||
|
module.exports = routes;
|
@ -7,7 +7,7 @@ var js_root = path.join(path.join(root, 'public'), 'js');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
context: js_root,
|
context: js_root,
|
||||||
entry: 'UnleashApp',
|
entry: 'app',
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
path: js_root,
|
path: js_root,
|
||||||
|
Loading…
Reference in New Issue
Block a user