2016-10-03 14:44:27 +13:00
|
|
|
/**
|
|
|
|
|
* Base-level application wrapper
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
import { Provider } from 'react-redux'
|
|
|
|
|
import { createStore } from 'redux'
|
2016-12-21 21:49:20 +13:00
|
|
|
import { Router, Route, Link, IndexRoute, hashHistory } from 'react-router'
|
2017-01-04 15:24:13 +13:00
|
|
|
import ReactGA from 'react-ga'
|
2016-10-03 14:44:27 +13:00
|
|
|
|
2016-10-03 15:22:15 +13:00
|
|
|
import store from './bootstrap.js'
|
2016-10-17 22:00:29 +13:00
|
|
|
require('../scss/app.scss');
|
|
|
|
|
|
2017-05-05 04:14:16 +12:00
|
|
|
import App from './App'
|
2016-10-17 10:39:11 +13:00
|
|
|
import Album from './views/Album'
|
|
|
|
|
import Artist from './views/Artist'
|
2016-10-21 09:56:07 +13:00
|
|
|
import Playlist from './views/Playlist'
|
2016-11-18 15:31:06 +13:00
|
|
|
import User from './views/User'
|
2016-10-17 10:39:11 +13:00
|
|
|
import Queue from './views/Queue'
|
2017-02-10 09:06:41 +13:00
|
|
|
import QueueHistory from './views/QueueHistory'
|
2016-10-17 10:39:11 +13:00
|
|
|
import Settings from './views/Settings'
|
2016-12-05 10:20:01 +13:00
|
|
|
import Debug from './views/Debug'
|
2016-11-03 08:57:16 +13:00
|
|
|
import Search from './views/Search'
|
2016-10-21 09:56:07 +13:00
|
|
|
|
2017-06-02 09:31:05 +12:00
|
|
|
import DiscoverRecommendations from './views/discover/DiscoverRecommendations'
|
2016-10-26 16:55:47 +13:00
|
|
|
import DiscoverFeatured from './views/discover/DiscoverFeatured'
|
|
|
|
|
import DiscoverCategories from './views/discover/DiscoverCategories'
|
|
|
|
|
import DiscoverCategory from './views/discover/DiscoverCategory'
|
2016-10-27 10:02:12 +13:00
|
|
|
import DiscoverNewReleases from './views/discover/DiscoverNewReleases'
|
2016-10-26 16:55:47 +13:00
|
|
|
|
2016-10-21 09:56:07 +13:00
|
|
|
import LibraryArtists from './views/library/LibraryArtists'
|
|
|
|
|
import LibraryAlbums from './views/library/LibraryAlbums'
|
|
|
|
|
import LibraryTracks from './views/library/LibraryTracks'
|
|
|
|
|
import LibraryPlaylists from './views/library/LibraryPlaylists'
|
2017-07-07 09:59:16 +12:00
|
|
|
import LibraryBrowse from './views/library/LibraryBrowse'
|
2016-10-03 14:44:27 +13:00
|
|
|
|
2017-09-19 16:57:59 +12:00
|
|
|
/*
|
|
|
|
|
// Hijack console error for Raven to capture
|
|
|
|
|
var originalConsoleError = console.error;
|
|
|
|
|
console.error = function(message, error){
|
|
|
|
|
Raven.captureException(message, error);
|
|
|
|
|
originalConsoleError.apply(this, arguments)
|
|
|
|
|
*/
|
|
|
|
|
|
2017-01-04 15:24:13 +13:00
|
|
|
// setup our analytics tracking
|
|
|
|
|
ReactGA.initialize('UA-64701652-3');
|
2017-02-05 20:14:27 +13:00
|
|
|
function handleUpdate() {
|
2017-01-04 15:24:13 +13:00
|
|
|
ReactGA.set({ page: window.location.hash })
|
|
|
|
|
ReactGA.pageview(window.location.hash)
|
2017-02-05 20:14:27 +13:00
|
|
|
$(window).scrollTop(0)
|
2017-03-06 09:03:20 +13:00
|
|
|
store.dispatch({type: 'HIDE_CONTEXT_MENU'})
|
2017-01-04 15:24:13 +13:00
|
|
|
}
|
|
|
|
|
|
2016-12-21 21:49:20 +13:00
|
|
|
global.baseURL = '/'
|
2016-12-21 15:24:07 +13:00
|
|
|
|
2016-10-03 14:44:27 +13:00
|
|
|
ReactDOM.render(
|
2016-10-03 15:22:15 +13:00
|
|
|
<Provider store={store}>
|
2017-02-05 20:14:27 +13:00
|
|
|
<Router history={hashHistory} onUpdate={handleUpdate}>
|
2016-12-21 15:24:07 +13:00
|
|
|
<Route path={global.baseURL} component={App}>
|
2016-10-23 23:48:06 +13:00
|
|
|
|
|
|
|
|
<IndexRoute component={Queue} />
|
2016-11-01 16:41:04 +13:00
|
|
|
<Route path="queue" component={Queue} />
|
2017-05-31 09:06:42 +12:00
|
|
|
<Route path="queue/history" component={QueueHistory} />
|
2016-11-06 15:47:37 +13:00
|
|
|
<Route path="settings" component={Settings} />
|
2017-05-31 09:06:42 +12:00
|
|
|
<Route path="settings/debug" component={Debug} />
|
2016-11-06 15:47:37 +13:00
|
|
|
|
2017-09-03 13:53:11 +12:00
|
|
|
<Route path="search(/iris::search::query)" component={Search} />
|
2016-11-06 15:47:37 +13:00
|
|
|
<Route path="album/:uri" component={Album} />
|
2017-05-05 04:50:22 +12:00
|
|
|
<Route path="artist/:uri(/:sub_view)" component={Artist} />
|
2016-11-06 15:47:37 +13:00
|
|
|
<Route path="playlist/:uri" component={Playlist} />
|
2016-11-18 15:31:06 +13:00
|
|
|
<Route path="user/:uri" component={User} />
|
2016-10-03 14:44:27 +13:00
|
|
|
|
2017-06-02 09:31:05 +12:00
|
|
|
<Route path="discover/recommendations(/:seeds)" component={DiscoverRecommendations} />
|
2016-11-01 16:41:04 +13:00
|
|
|
<Route path="discover/featured" component={DiscoverFeatured} />
|
|
|
|
|
<Route path="discover/categories" component={DiscoverCategories} />
|
|
|
|
|
<Route path="discover/categories/:id" component={DiscoverCategory} />
|
|
|
|
|
<Route path="discover/new-releases" component={DiscoverNewReleases} />
|
2016-10-26 16:55:47 +13:00
|
|
|
|
2016-11-01 16:41:04 +13:00
|
|
|
<Route path="library/artists" component={LibraryArtists} />
|
|
|
|
|
<Route path="library/albums" component={LibraryAlbums} />
|
|
|
|
|
<Route path="library/tracks" component={LibraryTracks} />
|
|
|
|
|
<Route path="library/playlists" component={LibraryPlaylists} />
|
2017-07-07 09:59:16 +12:00
|
|
|
<Route path="library/browse(/:uri)" component={LibraryBrowse} />
|
2016-10-03 14:44:27 +13:00
|
|
|
|
|
|
|
|
</Route>
|
|
|
|
|
</Router>
|
|
|
|
|
</Provider>,
|
|
|
|
|
document.getElementById('app')
|
|
|
|
|
);
|