2015-06-15 02:34:39 +01:00
|
|
|
import React from 'react';
|
2016-01-09 15:10:28 +00:00
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import { Router, Route, IndexRoute } from 'react-router';
|
|
|
|
import createBrowserHistory from 'history/lib/createBrowserHistory';
|
2015-08-20 23:22:57 +01:00
|
|
|
import ga, { Initializer as GAInitiailizer } from 'react-google-analytics';
|
2015-06-15 02:34:39 +01:00
|
|
|
import Home from './home';
|
|
|
|
import Share from './share';
|
|
|
|
import Head from './head';
|
|
|
|
import ErrorView from './error';
|
2015-08-21 18:33:50 +01:00
|
|
|
import NotFound from './notfound';
|
2014-12-22 22:38:08 +00:00
|
|
|
|
2015-08-20 23:22:57 +01:00
|
|
|
const App = React.createClass({
|
2014-12-22 22:38:08 +00:00
|
|
|
render: function () {
|
|
|
|
return (
|
|
|
|
<html>
|
2015-01-11 18:48:22 +00:00
|
|
|
<Head {...this.props} />
|
2015-06-03 21:45:54 -07:00
|
|
|
<body className='home'>
|
2016-01-09 15:10:28 +00:00
|
|
|
{this.props.children}
|
2014-12-22 22:38:08 +00:00
|
|
|
<GAInitiailizer />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-08-20 23:22:57 +01:00
|
|
|
const routes = (
|
2016-01-09 15:10:28 +00:00
|
|
|
<Route path='/' component={App}>
|
|
|
|
<IndexRoute component={Home} />
|
|
|
|
<Route path=':service/:type/:id' component={Share}/>
|
|
|
|
<Route path='*' component={NotFound}/>
|
2014-12-22 22:38:08 +00:00
|
|
|
</Route>
|
|
|
|
);
|
|
|
|
|
2015-06-03 21:45:54 -07:00
|
|
|
if (typeof window !== 'undefined') {
|
2015-06-15 23:14:02 +01:00
|
|
|
console.info('Time since page started rendering: ' + (Date.now() - timerStart) + 'ms'); // eslint-disable-line no-undef
|
2016-01-09 15:10:28 +00:00
|
|
|
ReactDOM.render(<Router history={createBrowserHistory()}>{routes}</Router>, document);
|
2015-06-14 20:13:57 +01:00
|
|
|
ga('create', 'UA-66209-8', 'auto');
|
|
|
|
ga('send', 'pageview');
|
2015-05-17 19:10:30 +01:00
|
|
|
}
|
2015-06-14 20:13:57 +01:00
|
|
|
|
2015-08-20 23:22:57 +01:00
|
|
|
export { routes };
|