2015-01-25 13:38:25 +01:00
|
|
|
var React = require('react'),
|
2015-03-28 13:59:04 +01:00
|
|
|
MenuItemListComponent = require('./shared/menuItemListComponent'),
|
2015-04-07 00:29:14 +02:00
|
|
|
SectionListComponent = require('./shared/sectionsListComponent'),
|
|
|
|
|
|
2015-01-25 13:38:25 +01:00
|
|
|
Router = require('react-router'),
|
2015-03-01 16:43:28 +01:00
|
|
|
Link = Router.Link,
|
2015-02-17 21:58:39 +01:00
|
|
|
RouteHandler = Router.RouteHandler,
|
2015-03-14 08:17:06 +01:00
|
|
|
LoginStatus = require('./shared/loginStatus'),
|
|
|
|
|
InitializationStore = require('../stores/initializationStore'),
|
|
|
|
|
InitializationActions = require('../actions/initializationActions');
|
2015-01-25 13:38:25 +01:00
|
|
|
|
2015-02-08 15:17:35 +01:00
|
|
|
var CartIcon = require('./cart/cartIcon');
|
2015-03-22 16:16:52 +01:00
|
|
|
var SearchBox = require('./shared/searchBox');
|
2015-02-08 15:17:35 +01:00
|
|
|
|
2015-01-25 13:38:25 +01:00
|
|
|
var RootApp = React.createClass({
|
|
|
|
|
|
2015-03-14 08:17:06 +01:00
|
|
|
// Add change listeners to stores
|
|
|
|
|
componentDidMount: function() {
|
2015-04-07 00:29:14 +02:00
|
|
|
InitializationStore.addChangeListener(this._onChange);
|
2015-03-14 08:17:06 +01:00
|
|
|
InitializationActions.initialize();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
|
return InitializationStore.getState();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onChange: function () {
|
|
|
|
|
if (this.isMounted()) {
|
2015-04-07 00:29:14 +02:00
|
|
|
this.setState(InitializationStore.getState());
|
2015-03-14 08:17:06 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
componentWillUnmount: function () {
|
|
|
|
|
InitializationStore.removeChangeListener(this._onChange);
|
|
|
|
|
},
|
|
|
|
|
|
2015-01-25 13:38:25 +01:00
|
|
|
render: function() {
|
|
|
|
|
|
2015-03-14 08:17:06 +01:00
|
|
|
if (!this.state.isEverythingReadyToStartTheShow) {
|
|
|
|
|
return (<div>loading...</div>);
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-25 13:38:25 +01:00
|
|
|
return (
|
|
|
|
|
<div className="container">
|
2015-02-22 13:40:22 +01:00
|
|
|
<div className='page-header'>
|
2015-03-01 16:43:28 +01:00
|
|
|
<h1 className="main-heading">
|
2015-04-07 00:29:14 +02:00
|
|
|
|
2015-03-13 07:04:44 +01:00
|
|
|
<Link to="app"><img src="https://res.cloudinary.com/lfvt7ps2n/image/upload/c_scale,w_132/v1426226452/ribica-ispunjava-zelje_nng0gn.png" /></Link>
|
|
|
|
|
|
2015-03-04 06:47:07 +01:00
|
|
|
</h1>
|
2015-03-29 12:46:51 +02:00
|
|
|
<div style= {{float:'right'}}>
|
2015-03-04 06:47:07 +01:00
|
|
|
<div style={{display: 'inline-block'}}>
|
|
|
|
|
<Link to="korpa">Završi narudžbu</Link><CartIcon /> |
|
|
|
|
|
</div>
|
2015-02-22 13:40:22 +01:00
|
|
|
<LoginStatus />
|
|
|
|
|
</div>
|
2015-01-25 13:38:25 +01:00
|
|
|
</div>
|
2015-02-22 13:40:22 +01:00
|
|
|
<div className='row'>
|
2015-03-22 16:16:52 +01:00
|
|
|
<div className='col-md-8' id='header'>
|
2015-03-28 13:59:04 +01:00
|
|
|
<MenuItemListComponent />
|
2015-03-04 06:47:07 +01:00
|
|
|
</div>
|
2015-03-22 16:16:52 +01:00
|
|
|
|
|
|
|
|
<div className="col-md-4">
|
|
|
|
|
<SearchBox />
|
|
|
|
|
</div>
|
2015-02-22 13:40:22 +01:00
|
|
|
</div>
|
2015-03-22 16:16:52 +01:00
|
|
|
|
2015-02-22 13:40:22 +01:00
|
|
|
<div className='row'>
|
|
|
|
|
<RouteHandler />
|
|
|
|
|
</div>
|
2015-04-07 00:29:14 +02:00
|
|
|
|
2015-03-04 06:47:07 +01:00
|
|
|
</div>
|
2015-04-07 00:29:14 +02:00
|
|
|
|
2015-01-25 13:38:25 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = RootApp;
|