Forced /iris/ for use in Tornado

This commit is contained in:
James Barnsley
2016-12-21 15:24:07 +13:00
parent d743690d10
commit cf8521e421
26 changed files with 50 additions and 46 deletions

View File

@ -17,7 +17,7 @@ export default class AlbumGrid extends React.Component{
{
this.props.albums.map(
(album, index) => {
return <GridItem item={album} key={index} link={'/album/'+album.uri} />
return <GridItem item={album} key={index} link={global.baseURL+'album/'+album.uri} />
}
)
}

View File

@ -17,7 +17,7 @@ export default class ArtistGrid extends React.Component{
{
this.props.artists.map(
(artist, index) => {
return <GridItem item={artist} key={index} link={'/artist/'+artist.uri} />
return <GridItem item={artist} key={index} link={global.baseURL+'artist/'+artist.uri} />
}
)
}

View File

@ -18,7 +18,7 @@ export default class ArtistList extends React.Component{
this.props.artists.map( (artist, index) => {
if( artist.uri ){
return (
<Link to={ '/artist/' + artist.uri } key={artist.uri} className="artist">
<Link to={global.baseURL+'artist/'+ artist.uri} key={artist.uri} className="artist">
<Thumbnail circle={true} size="small" images={artist.images} />
<span className="name">{ artist.name }</span>
</Link>

View File

@ -24,7 +24,7 @@ export default class ArtistSentence extends React.Component{
}
if( !artist.name ) artist.name = '-'
if( artist.uri ){
var content = <Link className="artist" to={'/artist/'+artist.uri}>{ artist.name }</Link>
var content = <Link className="artist" to={global.baseURL+'artist/'+artist.uri}>{ artist.name }</Link>
}else{
var content = <span>{ artist.name }</span>
}

View File

@ -18,7 +18,7 @@ export default class CategoryGrid extends React.Component{
{
this.props.categories.map(
(category, index) => {
return <GridItem item={category} key={index} link={'/discover/categories/'+category.id} />
return <GridItem item={category} key={index} link={global.baseURL+'discover/categories/'+category.id} />
}
)
}

View File

@ -228,9 +228,7 @@ class ContextMenu extends React.Component{
var items = this.getItems(trigger)
var height = 0
if (items) height = items.length * 34
console.log(style.top, height)
if (items) height = items.length * 34 // this is an approximation of how tall each menu item is
if (this.props.context_menu.position_x > (window.innerWidth - 154)) className += ' right-align'
if (this.props.context_menu.position_x > (window.innerWidth - 308)) className += ' right-align-submenu'

View File

@ -49,7 +49,7 @@ export default class List extends React.Component{
}
}
if (key_string === 'owner') return <Link to={ '/user/'+ value.uri }>{value.id}</Link>
if (key_string === 'owner') return <Link to={global.baseURL+'user/'+ value.uri}>{value.id}</Link>
if (key[0] === 'artists') return <ArtistSentence artists={value} />
if (value === true) return <FontAwesome name="check" />
if (typeof(value) === 'number') return <span>{value.toLocaleString()}</span>

View File

@ -18,7 +18,7 @@ export default class PlaylistGrid extends React.Component{
{
this.props.playlists.map(
(playlist, index) => {
return <GridItem item={playlist} key={index} link={'/playlist/'+playlist.uri} />
return <GridItem item={playlist} key={index} link={global.baseURL+'playlist/'+playlist.uri} />
}
)
}

View File

@ -15,7 +15,7 @@ export default class PlaylistListItem extends React.Component{
renderOwner(){
if( !this.props.item.owner ) return null;
return (
<Link to={ '/user/'+this.props.item.owner.id }>
<Link to={global.baseURL+'user/'+this.props.item.owner.id}>
{ this.props.item.owner.id }
</Link>
);
@ -25,7 +25,7 @@ export default class PlaylistListItem extends React.Component{
if( !this.props.item ) return null
return (
<ListItem extraClasses="playlist" link={ '/playlist/'+this.props.item.uri }>
<ListItem extraClasses="playlist" link={global.baseURL+'playlist/'+this.props.item.uri}>
<span className="col name">
{this.props.item.name}
</span>

View File

@ -20,7 +20,7 @@ class SearchForm extends React.Component{
handleSubmit(e){
e.preventDefault();
browserHistory.push('/search/'+this.state.query);
browserHistory.push(global.baseURL+'search/'+this.state.query);
return false
}

View File

@ -31,7 +31,7 @@ class Sidebar extends React.Component{
<nav>
<section>
<Link activeClassName="active" to="/queue">
<Link activeClassName="active" to={global.baseURL+"queue"}>
<Icon name="play" className="white" />
Now playing
</Link>
@ -39,19 +39,19 @@ class Sidebar extends React.Component{
<section>
<title>Discover</title>
<Link activeClassName="active" to="/discover">
<Link activeClassName="active" to={global.baseURL+"discover"}>
<Icon name="compass" className="white" />
Discover
</Link>
<Link activeClassName="active" to="/discover/categories">
<Link activeClassName="active" to={global.baseURL+"discover/categories"}>
<Icon name="grid" className="white" />
Genre / Mood
</Link>
<Link activeClassName="active" to="/discover/featured">
<Link activeClassName="active" to={global.baseURL+"discover/featured"}>
<Icon name="star" className="white" />
Featured playlists
</Link>
<Link activeClassName="active" to="/discover/new-releases">
<Link activeClassName="active" to={global.baseURL+"discover/new-releases"}>
<Icon name="leaf" className="white" />
New releases
</Link>
@ -59,30 +59,30 @@ class Sidebar extends React.Component{
<section>
<title>My Music</title>
<Link activeClassName="active" to="/library/playlists">
<Link activeClassName="active" to={global.baseURL+"library/playlists"}>
<Icon name="playlist" className="white" />
Playlists
</Link>
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? "/library/artists" : null}>
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? global.baseURL+"library/artists" : null}>
<Icon name="mic" className="white" />
Artists
</Link>
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? "/library/albums" : null}>
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? global.baseURL+"library/albums" : null}>
<Icon name="cd" className="white" />
Albums
</Link>
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? "/library/tracks" : null}>
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? global.baseURL+"library/tracks" : null}>
<Icon name="music" className="white" />
Tracks
</Link>
<Link activeClassName="active" to="/library/local">
<Link activeClassName="active" to={global.baseURL+"library/local"}>
<Icon name="folder" className="white" />
Local
</Link>
</section>
<section>
<Link activeClassName="active" to="/settings">
<Link activeClassName="active" to={global.baseURL+"settings"}>
<Icon name="cog" className="white" />
Settings
{ !this.props.mopidy_connected || !this.props.spotify_connected || !this.props.pusher_connected ? <FontAwesome name="exclamation-triangle" className="red-text pull-right" /> : null }

View File

@ -58,7 +58,7 @@ class SpotifyAuthenticationFrame extends React.Component{
frameUrl: '//jamesbarnsley.co.nz/auth.php?action=authorize&app='+location.protocol+'//'+window.location.host,
authorizing: true
})
this.props.uiActions.createNotification('No popup? Your browse may have blocked it...')
this.props.uiActions.createNotification('No popup? Your browser may have blocked it...')
}
renderAuthorizeButton(){

View File

@ -43,7 +43,7 @@ export default class Track extends React.Component{
var album = '-'
if( track.album ){
if( track.album.uri ){
album = <Link to={'/album/'+track.album.uri}>{track.album.name}</Link>
album = <Link to={global.baseURL+'album/'+track.album.uri}>{track.album.name}</Link>
} else {
album = <span>{track.album.name}</span>
}

View File

@ -37,10 +37,12 @@ import LibraryLocalArtists from './views/library/LibraryLocalArtists'
import LibraryLocalAlbums from './views/library/LibraryLocalAlbums'
import LibraryLocalDirectory from './views/library/LibraryLocalDirectory'
global.baseURL = '/iris/'
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Route path="/" component={App}>
<Route path={global.baseURL} component={App}>
<IndexRoute component={Queue} />
<Route path="queue" component={Queue} />

View File

@ -110,26 +110,26 @@ class Search extends React.Component{
<div className="search-result-sections cf">
<section>
<div className="inner">
<h4><Link to={'/search/'+this.props.params.query+'/artists'}>Artists</Link></h4>
<h4><Link to={global.baseURL+'search/'+this.props.params.query+'/artists'}>Artists</Link></h4>
<ArtistGrid className="mini" artists={ this.props.search_results.artists.slice(0,6) } />
</div>
</section>
<section>
<div className="inner">
<h4><Link to={'/search/'+this.props.params.query+'/albums'}>Albums</Link></h4>
<h4><Link to={global.baseURL+'search/'+this.props.params.query+'/albums'}>Albums</Link></h4>
<AlbumGrid className="mini" albums={ this.props.search_results.albums.slice(0,6) } />
</div>
</section>
<section>
<div className="inner">
<h4><Link to={'/search/'+this.props.params.query+'/playlists'}>Playlists</Link></h4>
<h4><Link to={global.baseURL+'search/'+this.props.params.query+'/playlists'}>Playlists</Link></h4>
<PlaylistGrid className="mini" playlists={ this.props.search_results.playlists.slice(0,6) } />
</div>
</section>
</div>
<section className="list-wrapper">
<h4 className="left-padding"><Link to={'/search/'+this.props.params.query+'/tracks'}>Tracks</Link></h4>
<h4 className="left-padding"><Link to={global.baseURL+'search/'+this.props.params.query+'/tracks'}>Tracks</Link></h4>
<TrackList show_source_icon={true} tracks={ this.props.search_results.tracks } />
<LazyLoadListener loadMore={ () => this.loadMore('tracks') }/>
</section>

View File

@ -90,7 +90,7 @@ class Settings extends React.Component{
renderSpotifyUser(){
if( this.props.spotify.me && this.props.spotify.authorized ){
return (
<Link className="user" to={'/user/'+this.props.spotify.me.uri}>
<Link className="user" to={global.baseURL+'user/'+this.props.spotify.me.uri}>
<Thumbnail circle={true} size="small" images={this.props.spotify.me.images} />
<span className="user-name">
{ this.props.spotify.me.display_name ? this.props.spotify.me.display_name : this.props.spotify.me.id }
@ -271,7 +271,7 @@ class Settings extends React.Component{
<div className="input">
<ConfirmationButton className="destructive" content="Reset all settings" confirmingContent="Are you sure?" onConfirm={() => this.resetAllSettings()} />
&nbsp;&nbsp;
<button className="primary" onClick={ () => browserHistory.push('debug') }>
<button className="primary" onClick={ () => browserHistory.push(global.baseURL+'debug') }>
<FontAwesome name="flask" />&nbsp;Debugger
</button>
</div>

View File

@ -60,7 +60,7 @@ class LibraryAlbums extends React.Component{
]
return (
<section className="list-wrapper">
<List rows={this.props.albums} columns={columns} link_prefix="/album/" />
<List rows={this.props.albums} columns={columns} link_prefix={global.baseURL+"album/"} />
</section>
)
}else if( this.props.view == 'thumbnails' ){

View File

@ -48,7 +48,7 @@ class LibraryArtists extends React.Component{
]
return (
<section className="list-wrapper">
<List rows={this.props.artists} columns={columns} link_prefix="/artist/" show_source_icon={true} />
<List rows={this.props.artists} columns={columns} link_prefix={global.baseURL+"artist/"} show_source_icon={true} />
</section>
)
}else{

View File

@ -18,17 +18,17 @@ export default class LibraryLocal extends React.Component{
var grid_items = [
{
name: 'Artists',
link: '/library/local/artists',
link: global.baseURL+'library/local/artists',
icons: ['/assets/backgrounds/category-artists.jpg']
},
{
name: 'Albums',
link: '/library/local/albums',
link: global.baseURL+'library/local/albums',
icons: ['/assets/backgrounds/category-albums.jpg']
},
{
name: 'Folders',
link: '/library/local/directory/local:directory',
link: global.baseURL+'library/local/directory/local:directory',
icons: ['/assets/backgrounds/category-folders.jpg']
}
]

View File

@ -39,7 +39,7 @@ class LibraryLocalAlbums extends React.Component{
<div className="view library-local-view">
<Header icon="music" title="Local albums" />
<div>
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.albums} link_prefix="/album/" />
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.albums} link_prefix={global.baseURL+"album/"} />
</div>
</div>
);

View File

@ -39,7 +39,7 @@ class LibraryLocalArtists extends React.Component{
<div className="view library-local-view">
<Header icon="music" title="Local artists" />
<section className="list-wrapper">
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.artists} link_prefix="/artist/" />
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.artists} link_prefix={global.baseURL+"artist/"} />
</section>
</div>
);

View File

@ -80,7 +80,7 @@ class LibraryLocalDirectory extends React.Component{
<Header icon="music" title="Local files" actions={actions} />
<section className="list-wrapper">
<List columns={[{ name: 'name', width: '100'}]} rows={items.folders} link_prefix="/library/local/directory/" />
<List columns={[{ name: 'name', width: '100'}]} rows={items.folders} link_prefix={global.baseURL+"library/local/directory/"} />
<TrackList tracks={items.tracks} noheader />
</section>
</div>

View File

@ -65,7 +65,7 @@ class LibraryPlaylists extends React.Component{
]
return (
<section className="list-wrapper">
<List rows={playlists} columns={columns} link_prefix="/playlist/" show_source_icon={true} />
<List rows={playlists} columns={columns} link_prefix={global.baseURL+"playlist/"} show_source_icon={true} />
</section>
)
}else{