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'
|
2016-11-01 07:37:18 +13:00
|
|
|
import LibraryLocal from './views/library/LibraryLocal'
|
2016-11-01 19:27:59 +13:00
|
|
|
import LibraryLocalArtists from './views/library/LibraryLocalArtists'
|
2016-11-02 16:51:00 +13:00
|
|
|
import LibraryLocalAlbums from './views/library/LibraryLocalAlbums'
|
|
|
|
|
import LibraryLocalDirectory from './views/library/LibraryLocalDirectory'
|
2016-10-03 14:44:27 +13:00
|
|
|
|
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-06-20 19:55:47 +12:00
|
|
|
<Route path="search(/iris::search::type::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} />
|
|
|
|
|
<Route path="library/local" component={LibraryLocal} />
|
2016-11-01 19:27:59 +13:00
|
|
|
<Route path="library/local/artists" component={LibraryLocalArtists} />
|
2016-11-02 16:51:00 +13:00
|
|
|
<Route path="library/local/albums" component={LibraryLocalAlbums} />
|
|
|
|
|
<Route path="library/local/directory/:uri" component={LibraryLocalDirectory} />
|
2016-10-03 14:44:27 +13:00
|
|
|
|
|
|
|
|
</Route>
|
|
|
|
|
</Router>
|
|
|
|
|
</Provider>,
|
|
|
|
|
document.getElementById('app')
|
|
|
|
|
);
|