diff --git a/src/js/components/AlbumLink.js b/src/js/components/AlbumLink.js
deleted file mode 100755
index 0a2e2ab1..00000000
--- a/src/js/components/AlbumLink.js
+++ /dev/null
@@ -1,21 +0,0 @@
-
-import React, { PropTypes } from 'react'
-import FontAwesome from 'react-fontawesome'
-import { Link } from 'react-router'
-
-export default class AlbumLink extends React.Component{
-
- constructor(props) {
- super(props);
- }
-
- render(){
- if( !this.props.album ) return -
- if( !this.props.album.uri ) return { this.props.album.name }
-
- var link = '/album/' + this.props.album.uri;
- return (
- { this.props.album.name }
- );
- }
-}
\ No newline at end of file
diff --git a/src/js/components/ContextMenu.js b/src/js/components/ContextMenu.js
index a7578330..8ba2ecb0 100755
--- a/src/js/components/ContextMenu.js
+++ b/src/js/components/ContextMenu.js
@@ -89,11 +89,6 @@ class ContextMenu extends React.Component{
this.props.uiActions.hideContextMenu();
}
- addToPlaylist(){
- this.props.uiActions.openModal( 'AddToPlaylistModal', { track_indexes: this.props.context_menu.data.selected_tracks_indexes })
- this.props.uiActions.hideContextMenu();
- }
-
removeFromPlaylist(){
this.props.uiActions.removeTracksFromPlaylist( this.props.playlist.uri, this.props.context_menu.data.selected_tracks_indexes )
this.props.uiActions.hideContextMenu();
diff --git a/src/js/components/Dropzones.js b/src/js/components/Dropzones.js
index 58f76ffa..62089ab7 100755
--- a/src/js/components/Dropzones.js
+++ b/src/js/components/Dropzones.js
@@ -49,11 +49,13 @@ class Dropzones extends React.Component{
}
switch( target.action ){
-
case 'enqueue':
this.props.mopidyActions.enqueueTracks( uris )
break
+ case 'add_to_playlist':
+ this.props.uiActions.openModal( 'add_to_playlist', { tracks_uris: uris } )
+ break
}
}
diff --git a/src/js/components/Modal/AddToPlaylistModal.js b/src/js/components/Modal/AddToPlaylistModal.js
index d9845ac4..db627498 100755
--- a/src/js/components/Modal/AddToPlaylistModal.js
+++ b/src/js/components/Modal/AddToPlaylistModal.js
@@ -3,14 +3,14 @@ import React, { PropTypes } from 'react'
import Icon from '../Icon'
import * as helpers from '../../helpers'
-class AddToPlaylistModal extends React.Component{
+export default class AddToPlaylistModal extends React.Component{
constructor(props){
super(props)
}
playlistSelected( playlist_uri ){
- this.props.uiActions.addTracksToPlaylist( playlist_uri, this.props.data.track_indexes )
+ this.props.uiActions.addTracksToPlaylist( playlist_uri, this.props.tracks_uris )
this.props.uiActions.closeModal()
}
diff --git a/src/js/components/Modal/Modal.js b/src/js/components/Modal/Modal.js
index 05156240..5f230379 100755
--- a/src/js/components/Modal/Modal.js
+++ b/src/js/components/Modal/Modal.js
@@ -29,7 +29,7 @@ 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 == 'create_playlist' ?
: null }
{ this.props.modal.name == 'edit_playlist' ?
: null }
diff --git a/src/js/components/Track.js b/src/js/components/Track.js
index e4a1a81e..d722a49a 100755
--- a/src/js/components/Track.js
+++ b/src/js/components/Track.js
@@ -1,10 +1,11 @@
import React, { PropTypes } from 'react'
+import { Link } from 'react-router'
import FontAwesome from 'react-fontawesome'
import ArtistSentence from './ArtistSentence'
-import AlbumLink from './AlbumLink'
import Dater from './Dater'
-var helpers = require('../helpers.js')
+
+import * as helpers from '../helpers'
export default class Track extends React.Component{
@@ -55,7 +56,7 @@ export default class Track extends React.Component{
{ track.artists ?
: '-' }
- { track.album ? : '-' }
+ { track.album ? {track.album.name} : '-' }
{ track.duration_ms ? : null }
diff --git a/src/js/services/localstorage/middleware.js b/src/js/services/localstorage/middleware.js
index 68da3581..101873b3 100755
--- a/src/js/services/localstorage/middleware.js
+++ b/src/js/services/localstorage/middleware.js
@@ -12,7 +12,7 @@ const localstorageMiddleware = (function(){
// append our state to a global variable. This gives us access to debug the store at any point
window._store = store
- console.log(action)
+ //console.log(action)
switch( action.type ){
diff --git a/src/js/services/ui/actions.js b/src/js/services/ui/actions.js
index 086a454b..ac025682 100755
--- a/src/js/services/ui/actions.js
+++ b/src/js/services/ui/actions.js
@@ -144,13 +144,7 @@ export function removeTracksFromPlaylist( playlist_uri, tracks_indexes ){
}
}
-export function addTracksToPlaylist( playlist_uri, tracks ){
-
- var tracks_uris = []
- for( var i = 0; i < tracks.length; i++ ){
- tracks_uris.push( tracks[i].uri )
- }
-
+export function addTracksToPlaylist( playlist_uri, tracks_uris ){
switch( helpers.uriSource( playlist_uri ) ){
case 'spotify':
diff --git a/src/js/views/Album.js b/src/js/views/Album.js
index 9d6ee0da..1239d377 100755
--- a/src/js/views/Album.js
+++ b/src/js/views/Album.js
@@ -3,7 +3,6 @@ import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import FontAwesome from 'react-fontawesome'
-let helpers = require('../helpers.js')
import TrackList from '../components/TrackList'
import Thumbnail from '../components/Thumbnail'
@@ -14,6 +13,7 @@ import FollowButton from '../components/FollowButton'
import Dater from '../components/Dater'
import LazyLoadListener from '../components/LazyLoadListener'
+import * as helpers from '../helpers'
import * as mopidyActions from '../services/mopidy/actions'
import * as spotifyActions from '../services/spotify/actions'
@@ -75,7 +75,7 @@ class Album extends React.Component{
-
+ { helpers.uriSource(this.props.params.uri) == 'spotify' ? : null }
@@ -50,7 +50,10 @@ class LibraryAlbums extends React.Component{
**/
const mapStateToProps = (state, ownProps) => {
- return state;
+ return {
+ albums: state.spotify.library_albums,
+ albums_more: state.spotify.library_albums_more,
+ }
}
const mapDispatchToProps = (dispatch) => {
diff --git a/src/js/views/library/LibraryArtists.js b/src/js/views/library/LibraryArtists.js
index 668230d5..428aa614 100755
--- a/src/js/views/library/LibraryArtists.js
+++ b/src/js/views/library/LibraryArtists.js
@@ -23,8 +23,8 @@ class LibraryArtists extends React.Component{
}
loadMore(){
- if( !this.props.spotify.library_artists_more ) return
- this.props.spotifyActions.getURL( this.props.spotify.library_artists_more, 'SPOTIFY_LIBRARY_ARTISTS_LOADED_MORE' );
+ if( !this.props.artists_more ) return
+ this.props.spotifyActions.getURL( this.props.artists_more, 'SPOTIFY_LIBRARY_ARTISTS_LOADED_MORE' );
}
render(){
@@ -32,7 +32,7 @@ class LibraryArtists extends React.Component{
- { this.props.spotify.library_artists ? : null }
+ { this.props.artists ? : null }
this.loadMore() }/>
@@ -48,7 +48,10 @@ class LibraryArtists extends React.Component{
**/
const mapStateToProps = (state, ownProps) => {
- return state;
+ return {
+ artists: state.spotify.library_artists,
+ artists_more: state.spotify.library_artists_more
+ }
}
const mapDispatchToProps = (dispatch) => {
diff --git a/src/js/views/library/LibraryLocalAlbums.js b/src/js/views/library/LibraryLocalAlbums.js
index 4efed70c..24c77cd3 100755
--- a/src/js/views/library/LibraryLocalAlbums.js
+++ b/src/js/views/library/LibraryLocalAlbums.js
@@ -21,25 +21,25 @@ class LibraryLocalAlbums extends React.Component{
}
componentWillReceiveProps( nextProps ){
- if( !this.props.mopidy.connected && nextProps.mopidy.connected ){
+ if( !this.props.mopidy_connected && nextProps.mopidy_connected ){
this.loadAlbums(nextProps);
}
}
loadAlbums(props = this.props){
- if( props.mopidy.connected ){
+ if( props.mopidy_connected ){
this.props.mopidyActions.getAlbums();
}
}
render(){
- if( !this.props.mopidy.albums ) return null
+ if( !this.props.albums ) return null
return (
);
@@ -54,7 +54,10 @@ class LibraryLocalAlbums extends React.Component{
**/
const mapStateToProps = (state, ownProps) => {
- return state;
+ return {
+ mopidy_connected: state.mopidy.connected,
+ albums: state.mopidy.albums
+ }
}
const mapDispatchToProps = (dispatch) => {
diff --git a/src/js/views/library/LibraryLocalArtists.js b/src/js/views/library/LibraryLocalArtists.js
index a6d1ce26..cb860d1e 100755
--- a/src/js/views/library/LibraryLocalArtists.js
+++ b/src/js/views/library/LibraryLocalArtists.js
@@ -21,25 +21,25 @@ class LibraryLocalArtists extends React.Component{
}
componentWillReceiveProps( nextProps ){
- if( !this.props.mopidy.connected && nextProps.mopidy.connected ){
+ if( !this.props.mopidy_connected && nextProps.mopidy_connected ){
this.loadArtists(nextProps);
}
}
loadArtists(props = this.props){
- if( props.mopidy.connected ){
+ if( props.mopidy_connected ){
this.props.mopidyActions.getArtists();
}
}
render(){
- if( !this.props.mopidy.artists ) return null
+ if( !this.props.artists ) return null
return (
);
@@ -54,7 +54,10 @@ class LibraryLocalArtists extends React.Component{
**/
const mapStateToProps = (state, ownProps) => {
- return state;
+ return {
+ mopidy_connected: state.mopidy.connected,
+ artists: state.mopidy.artists
+ }
}
const mapDispatchToProps = (dispatch) => {
diff --git a/src/js/views/library/LibraryLocalDirectory.js b/src/js/views/library/LibraryLocalDirectory.js
index 9fac756f..c35281ec 100755
--- a/src/js/views/library/LibraryLocalDirectory.js
+++ b/src/js/views/library/LibraryLocalDirectory.js
@@ -24,7 +24,7 @@ class LibraryLocalDirectory extends React.Component{
componentWillReceiveProps( nextProps ){
// mopidy goes online
- if( !this.props.mopidy.connected && nextProps.mopidy.connected ){
+ if( !this.props.mopidy_connected && nextProps.mopidy_connected ){
this.loadDirectory( nextProps );
}
@@ -35,19 +35,19 @@ class LibraryLocalDirectory extends React.Component{
}
loadDirectory( props = this.props ){
- if( props.mopidy.connected ){
+ if( props.mopidy_connected ){
this.props.mopidyActions.getDirectory( props.params.uri );
}
}
render(){
- if( !this.props.mopidy.directory ) return null
+ if( !this.props.directory ) return null
return (
);
@@ -62,7 +62,10 @@ class LibraryLocalDirectory extends React.Component{
**/
const mapStateToProps = (state, ownProps) => {
- return state;
+ return {
+ mopidy_connected: state.mopidy.connected,
+ directory: state.mopidy.directory
+ }
}
const mapDispatchToProps = (dispatch) => {
diff --git a/src/js/views/library/LibraryTracks.js b/src/js/views/library/LibraryTracks.js
index 58646ed2..71ab13ac 100755
--- a/src/js/views/library/LibraryTracks.js
+++ b/src/js/views/library/LibraryTracks.js
@@ -23,8 +23,8 @@ class LibraryTracks extends React.Component{
}
loadMore(){
- if( !this.props.spotify.library_tracks_more ) return
- this.props.spotifyActions.getURL( this.props.spotify.library_tracks_more, 'SPOTIFY_LIBRARY_TRACKS_LOADED_MORE' );
+ if( !this.props.tracks_more ) return
+ this.props.spotifyActions.getURL( this.props.tracks_more, 'SPOTIFY_LIBRARY_TRACKS_LOADED_MORE' );
}
render(){
@@ -32,7 +32,7 @@ class LibraryTracks extends React.Component{
- { this.props.spotify.library_tracks ? : null }
+ { this.props.tracks ? : null }
this.loadMore() }/>
@@ -48,7 +48,10 @@ class LibraryTracks extends React.Component{
**/
const mapStateToProps = (state, ownProps) => {
- return state;
+ return {
+ tracks: state.spotify.library_tracks,
+ tracks_more: state.spotify.library_tracks_more
+ }
}
const mapDispatchToProps = (dispatch) => {