var Analytics, History, HistoryLocation, Navbar, React, RouteHandler, SpyMode, TransitionActions, TransitionStore, ref, ref1;
React = require('react');
ref = require('react-router'), HistoryLocation = ref.HistoryLocation, History = ref.History, RouteHandler = ref.RouteHandler;
Navbar = require('./navbar');
Analytics = require('../helpers/analytics');
SpyMode = require('openstax-react-components').SpyMode;
ref1 = require('../flux/transition'), TransitionActions = ref1.TransitionActions, TransitionStore = ref1.TransitionStore;
module.exports = React.createClass({
displayName: 'App',
contextTypes: {
router: React.PropTypes.func
},
componentDidMount: function() {
this.storeInitial();
Analytics.setTracker(window.ga);
return HistoryLocation.addChangeListener(this.storeHistory);
},
componentWillUnmount: function() {
return HistoryLocation.removeChangeListener(this.storeHistory);
},
storeInitial: function() {
return this.storeHistory({
path: this.context.router.getCurrentPath()
});
},
storeHistory: function(locationChangeEvent) {
Analytics.onNavigation(locationChangeEvent, this.context.router);
return TransitionActions.load(locationChangeEvent, this.context.router);
},
render: function() {
return React.createElement("div", {
"className": 'tutor-app openstax-wrapper'
}, React.createElement(SpyMode.Wrapper, null, React.createElement(Navbar, null), React.createElement(RouteHandler, null)));
}
});
|