diff --git a/src/js/components/LazyLoadListener.js b/src/js/components/LazyLoadListener.js index 92020ec2..d9382301 100755 --- a/src/js/components/LazyLoadListener.js +++ b/src/js/components/LazyLoadListener.js @@ -6,7 +6,9 @@ export default class LazyLoadListener extends React.Component{ constructor(props) { super(props); - this.state = { loading: false } + this.state = { + loading: false + } this.handleScroll = this.handleScroll.bind(this); } @@ -20,7 +22,7 @@ export default class LazyLoadListener extends React.Component{ handleScroll(e){ if( (window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 80) ){ - if( !this.state.loading && this.props.enabled ){ + if (!this.state.loading && this.props.loading){ this.setState({ loading: true }) this.props.loadMore(); } @@ -31,7 +33,7 @@ export default class LazyLoadListener extends React.Component{ render(){ return ( -
+
{this.state.loading ?
: null}
) diff --git a/src/js/components/Modal/AddToPlaylistModal.js b/src/js/components/Modal/AddToPlaylistModal.js index 04876a78..dce01539 100755 --- a/src/js/components/Modal/AddToPlaylistModal.js +++ b/src/js/components/Modal/AddToPlaylistModal.js @@ -13,7 +13,7 @@ export default class AddToPlaylistModal extends React.Component{ } playlistSelected( playlist_uri ){ - this.props.uiActions.addTracksToPlaylist( playlist_uri, this.props.tracks_uris ) + this.props.coreActions.addTracksToPlaylist( playlist_uri, this.props.tracks_uris ) this.props.uiActions.closeModal() } diff --git a/src/js/components/Modal/CreatePlaylistModal.js b/src/js/components/Modal/CreatePlaylistModal.js index d56eeaf3..89a3ba3d 100755 --- a/src/js/components/Modal/CreatePlaylistModal.js +++ b/src/js/components/Modal/CreatePlaylistModal.js @@ -24,7 +24,7 @@ export default class CreatePlaylistModal extends React.Component{ this.setState({error: 'Name is required'}) return false } else { - this.props.uiActions.createPlaylist( this.state.scheme, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative ) + this.props.coreActions.createPlaylist( this.state.scheme, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative ) this.props.uiActions.closeModal() } diff --git a/src/js/components/Modal/EditPlaylistModal.js b/src/js/components/Modal/EditPlaylistModal.js index 10c00a43..2a40fab2 100755 --- a/src/js/components/Modal/EditPlaylistModal.js +++ b/src/js/components/Modal/EditPlaylistModal.js @@ -24,7 +24,7 @@ export default class EditPlaylistModal extends React.Component{ this.setState({error: 'Name is required'}) return false } else { - this.props.uiActions.savePlaylist(this.props.data.uri, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative) + this.props.coreActions.savePlaylist(this.props.data.uri, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative) this.props.uiActions.closeModal() return false } diff --git a/src/js/components/Modal/Modal.js b/src/js/components/Modal/Modal.js index ebe6207c..53750096 100755 --- a/src/js/components/Modal/Modal.js +++ b/src/js/components/Modal/Modal.js @@ -47,10 +47,10 @@ class Modal extends React.Component{
- { this.props.modal.name == 'add_to_playlist' ? : null } + { this.props.modal.name == 'add_to_playlist' ? : null } { this.props.modal.name == 'add_to_queue' ? : null } - { this.props.modal.name == 'create_playlist' ? : null } - { this.props.modal.name == 'edit_playlist' ? : null } + { this.props.modal.name == 'create_playlist' ? : null } + { this.props.modal.name == 'edit_playlist' ? : null } { this.props.modal.name == 'send_authorization' ? : null } { this.props.modal.name == 'receive_authorization' ? : null } { this.props.modal.name == 'edit_radio' ? : null } diff --git a/src/js/services/mopidy/middleware.js b/src/js/services/mopidy/middleware.js index 4a05ace9..b332dac4 100755 --- a/src/js/services/mopidy/middleware.js +++ b/src/js/services/mopidy/middleware.js @@ -866,7 +866,7 @@ const MopidyMiddleware = (function(){ var album = Object.assign( {}, { - is_mopidy: true, + source: 'local', artists: response[uri][0].artists, tracks: response[uri], tracks_total: response[uri].length @@ -895,7 +895,7 @@ const MopidyMiddleware = (function(){ { images: [] }, response[0].album, { - is_mopidy: true, + source: 'local', artists: response[0].artists, tracks: response, tracks_total: response.length diff --git a/src/js/services/spotify/middleware.js b/src/js/services/spotify/middleware.js index fabdda9d..61940fd0 100755 --- a/src/js/services/spotify/middleware.js +++ b/src/js/services/spotify/middleware.js @@ -250,6 +250,7 @@ const SpotifyMiddleware = (function(){ {}, action.data.artists.items[i], { + source: 'spotify', in_library: true // assumed because we asked for library items } ) @@ -276,6 +277,7 @@ const SpotifyMiddleware = (function(){ action.data.items[i].album, { in_library: true, // assumed because we asked for library items + source: 'spotify', added_at: action.data.items[i].added_at, tracks: action.data.items[i].album.tracks.items, tracks_more: action.data.items[i].album.tracks.next, diff --git a/src/js/views/Album.js b/src/js/views/Album.js index 9bbfcd06..aa71fb9f 100755 --- a/src/js/views/Album.js +++ b/src/js/views/Album.js @@ -98,7 +98,7 @@ class Album extends React.Component{ render(){ if (helpers.isLoading(this.props.load_queue,['spotify_albums/'+helpers.getFromUri('albumid',this.props.params.uri)])){ return ( -
+
) diff --git a/src/js/views/Artist.js b/src/js/views/Artist.js index a34da95d..4ecc63dc 100755 --- a/src/js/views/Artist.js +++ b/src/js/views/Artist.js @@ -98,7 +98,7 @@ class Artist extends React.Component{ renderBody(){ if (helpers.isLoading(this.props.load_queue,['spotify_artists/'+helpers.getFromUri('artistid',this.props.params.uri), 'lastfm_method=artist.getInfo'])){ return ( -
+
) diff --git a/src/js/views/Playlist.js b/src/js/views/Playlist.js index a3b6d975..b3a5f878 100755 --- a/src/js/views/Playlist.js +++ b/src/js/views/Playlist.js @@ -159,7 +159,7 @@ class Playlist extends React.Component{ if (helpers.isLoading(this.props.load_queue,['spotify_users/'+user_id+'/playlists/'+playlist_id+'?'])){ return ( -
+
) diff --git a/src/js/views/discover/DiscoverCategories.js b/src/js/views/discover/DiscoverCategories.js index 7075558b..f83ead21 100755 --- a/src/js/views/discover/DiscoverCategories.js +++ b/src/js/views/discover/DiscoverCategories.js @@ -23,7 +23,7 @@ class DiscoverCategories extends React.Component{ return (
-
+
diff --git a/src/js/views/discover/DiscoverCategory.js b/src/js/views/discover/DiscoverCategory.js index cf5d0aaa..18e6d11b 100755 --- a/src/js/views/discover/DiscoverCategory.js +++ b/src/js/views/discover/DiscoverCategory.js @@ -38,7 +38,7 @@ class DiscoverCategory extends React.Component{ return (
-
+
diff --git a/src/js/views/discover/DiscoverFeatured.js b/src/js/views/discover/DiscoverFeatured.js index c98871cd..7e602dcc 100755 --- a/src/js/views/discover/DiscoverFeatured.js +++ b/src/js/views/discover/DiscoverFeatured.js @@ -74,7 +74,7 @@ class DiscoverFeatured extends React.Component{ return (
-
+
diff --git a/src/js/views/discover/DiscoverNewReleases.js b/src/js/views/discover/DiscoverNewReleases.js index f69fc676..fe4cd7f9 100755 --- a/src/js/views/discover/DiscoverNewReleases.js +++ b/src/js/views/discover/DiscoverNewReleases.js @@ -82,7 +82,7 @@ class DiscoverNewReleases extends React.Component{ return (
-
+
diff --git a/src/js/views/discover/DiscoverRecommendations.js b/src/js/views/discover/DiscoverRecommendations.js index f85c330d..aafa56d3 100755 --- a/src/js/views/discover/DiscoverRecommendations.js +++ b/src/js/views/discover/DiscoverRecommendations.js @@ -174,7 +174,7 @@ class Discover extends React.Component{ renderResults(){ if (helpers.isLoading(this.props.load_queue,['spotify_recommendations'])){ return ( -
+
) diff --git a/src/js/views/library/LibraryAlbums.js b/src/js/views/library/LibraryAlbums.js index 35534a2b..111b47d8 100755 --- a/src/js/views/library/LibraryAlbums.js +++ b/src/js/views/library/LibraryAlbums.js @@ -108,28 +108,26 @@ class LibraryAlbums extends React.Component{ label: 'Added', name: 'added_at' }, - { - label: 'Released', - name: 'release_date' - }, { label: 'Tracks', name: 'tracks_total' + }, + { + label: 'Source', + name: 'source' } ] return ( -
- this.handleContextMenu(e,item)} - rows={albums} - columns={columns} - className="album-list" - link_prefix={global.baseURL+"album/"} /> -
+ this.handleContextMenu(e,item)} + rows={albums} + columns={columns} + className="album-list" + link_prefix={global.baseURL+"album/"} /> ) }else if( this.props.view == 'detail' ){ return ( -
+
{ albums.map( album => { return ( @@ -150,38 +148,42 @@ class LibraryAlbums extends React.Component{ ) }) } -
+
) }else{ return ( -
- this.handleContextMenu(e,item)} - albums={albums} /> -
+ this.handleContextMenu(e,item)} + albums={albums} /> ) } } render(){ - if (helpers.isLoading(this.props.load_queue,['spotify_me/albums'])){ - return ( -
-
-
-
-
-
- ) - } - var albums = [] - if (this.props.library_albums && this.props.albums){ for (var i = 0; i < this.props.library_albums.length; i++){ var uri = this.props.library_albums[i] + if (this.props.albums.hasOwnProperty(uri)){ - albums.push(this.props.albums[uri]) + switch (this.props.filter){ + + case 'spotify': + if (this.props.albums[uri].source == 'spotify'){ + albums.push(this.props.albums[uri]) + } + break + + case 'local': + if (this.props.albums[uri].source == 'local'){ + albums.push(this.props.albums[uri]) + } + break + + default: + albums.push(this.props.albums[uri]) + break + } } } @@ -190,6 +192,21 @@ class LibraryAlbums extends React.Component{ } } + var filter_options = [ + { + value: 'all', + label: 'All' + }, + { + value: 'local', + label: 'Local' + }, + { + value: 'spotify', + label: 'Spotify' + } + ] + var view_options = [ { value: 'thumbnails', @@ -214,18 +231,19 @@ class LibraryAlbums extends React.Component{ value: 'added_at', label: 'Added' }, - { - value: 'release_date', - label: 'Released' - }, { value: 'tracks_total', label: 'Tracks' + }, + { + value: 'source', + label: 'Source' } ] var options = ( + {this.props.uiActions.set({ library_albums_filter: val}); this.props.uiActions.hideContextMenu() }} /> {this.setSort(val); this.props.uiActions.hideContextMenu() }} /> {this.props.uiActions.set({ library_albums_view: val }); this.props.uiActions.hideContextMenu() }} /> @@ -233,10 +251,15 @@ class LibraryAlbums extends React.Component{ return (
+
- { this.renderView(albums) } - this.loadMoreSpotify()}/> - 0} loadMore={() => this.loadMoreMopidy()}/> + +
+ { this.renderView(albums) } + this.loadMoreSpotify()}/> + 0} loadMore={() => this.loadMoreMopidy()}/> +
+
); } @@ -259,6 +282,7 @@ const mapStateToProps = (state, ownProps) => { library_albums_spotify_started: state.core.library_albums_spotify_started, library_albums_spotify_more: state.core.library_albums_spotify_more, view: state.ui.library_albums_view, + filter: (state.ui.library_albums_filter ? state.ui.library_albums_filter : 'all'), sort: (state.ui.library_albums_sort ? state.ui.library_albums_sort : 'name'), sort_reverse: (state.ui.library_albums_sort_reverse ? true : false) } diff --git a/src/js/views/library/LibraryBrowse.js b/src/js/views/library/LibraryBrowse.js index 6d3501f8..662d3c2f 100755 --- a/src/js/views/library/LibraryBrowse.js +++ b/src/js/views/library/LibraryBrowse.js @@ -117,7 +117,7 @@ class LibraryBrowse extends React.Component{ return (
-
+
diff --git a/src/js/views/library/LibraryLocalAlbums.js b/src/js/views/library/LibraryLocalAlbums.js index 029a3052..3ad190ad 100755 --- a/src/js/views/library/LibraryLocalAlbums.js +++ b/src/js/views/library/LibraryLocalAlbums.js @@ -156,7 +156,7 @@ class LibraryLocalAlbums extends React.Component{ return (
-
+
diff --git a/src/js/views/library/LibraryLocalArtists.js b/src/js/views/library/LibraryLocalArtists.js index 97f508ef..2211ebd1 100755 --- a/src/js/views/library/LibraryLocalArtists.js +++ b/src/js/views/library/LibraryLocalArtists.js @@ -59,7 +59,7 @@ class LibraryLocalArtists extends React.Component{ return (
-
+
diff --git a/src/js/views/library/LibraryPlaylists.js b/src/js/views/library/LibraryPlaylists.js index 267e498f..21fcae19 100755 --- a/src/js/views/library/LibraryPlaylists.js +++ b/src/js/views/library/LibraryPlaylists.js @@ -45,7 +45,7 @@ class LibraryPlaylists extends React.Component{ renderView(){ if (helpers.isLoading(this.props.load_queue,['spotify_me/playlists'])){ return ( -
+
) @@ -109,10 +109,6 @@ class LibraryPlaylists extends React.Component{ label: 'Owner', name: 'owner' }, - { - label: 'Source', - name: 'source' - }, { label: 'Tracks', name: 'tracks_total' @@ -120,12 +116,14 @@ class LibraryPlaylists extends React.Component{ { label: 'Editable', name: 'can_edit' + }, + { + label: 'Source', + name: 'source' } ] } - console.log(columns) - return (
-
+
diff --git a/src/scss/components/_lists.scss b/src/scss/components/_lists.scss index faedad05..9338c342 100755 --- a/src/scss/components/_lists.scss +++ b/src/scss/components/_lists.scss @@ -52,13 +52,6 @@ padding-bottom: 2px; } - .source { - color: $mid_grey; - position: absolute; - top: 14px; - right: 12px; - } - &.field { padding: 0 !important; @@ -92,6 +85,13 @@ margin-top: -3px; background: transparent; } + + .source { + color: $mid_grey; + position: absolute; + top: 14px; + right: 12px; + } } } diff --git a/src/scss/components/_loader.scss b/src/scss/components/_loader.scss index 0a6b6899..77b0b4e2 100755 --- a/src/scss/components/_loader.scss +++ b/src/scss/components/_loader.scss @@ -2,11 +2,18 @@ .body-loader { padding: 35vh 0; + &.loading { + .loader { + opacity: 1; + } + } + .loader { height: 120px; width: 120px; margin: 0 auto; position: relative; + opacity: 0; &:before, &:after { @@ -42,11 +49,19 @@ } &.lazy-loader { - padding: 0; + padding: 20px; + height: 40px; .loader { height: 40px; width: 40px; + opacity: 0; + } + + &.loading { + .loader { + opacity: 1; + } } } } \ No newline at end of file