Weening out old full props; Dropzone add to playlist

This commit is contained in:
James Barnsley
2016-11-19 13:06:08 +13:00
parent d8e430858c
commit 96ad8a75c1
18 changed files with 70 additions and 94 deletions

View File

@ -22,8 +22,8 @@ class LibraryAlbums extends React.Component{
}
loadMore(){
if( !this.props.spotify.library_albums_more ) return
this.props.spotifyActions.getURL( this.props.spotify.library_albums_more, 'SPOTIFY_LIBRARY_ALBUMS_LOADED_MORE' );
if( !this.props.albums_more ) return
this.props.spotifyActions.getURL( this.props.albums_more, 'SPOTIFY_LIBRARY_ALBUMS_LOADED_MORE' );
}
render(){
@ -34,7 +34,7 @@ class LibraryAlbums extends React.Component{
title="My albums"
/>
<section className="grid-wrapper">
{ this.props.spotify.library_albums ? <AlbumGrid albums={this.props.spotify.library_albums} /> : null }
{ this.props.albums ? <AlbumGrid albums={this.props.albums} /> : null }
</section>
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</div>
@ -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) => {

View File

@ -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{
<div className="view library-artists-view">
<Header icon="mic" title="My artists" />
<section className="grid-wrapper">
{ this.props.spotify.library_artists ? <ArtistGrid artists={this.props.spotify.library_artists} /> : null }
{ this.props.artists ? <ArtistGrid artists={this.props.artists} /> : null }
</section>
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</div>
@ -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) => {

View File

@ -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 (
<div className="view library-local-view">
<Header icon="music" title="Local albums" />
<div>
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.mopidy.albums} link_prefix="/album/" />
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.albums} link_prefix="/album/" />
</div>
</div>
);
@ -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) => {

View File

@ -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 (
<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.mopidy.artists} link_prefix="/artist/" />
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.artists} link_prefix="/artist/" />
</section>
</div>
);
@ -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) => {

View File

@ -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 (
<div className="view library-local-view">
<Header icon="music" title="Local files" />
<section className="list-wrapper">
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.mopidy.directory} link_prefix="/library/local/directory/" />
<List columns={[{ name: 'name', width: '100'}]} rows={this.props.directory} link_prefix="/library/local/directory/" />
</section>
</div>
);
@ -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) => {

View File

@ -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{
<div className="view library-tracks-view">
<Header icon="music" title="My tracks" />
<section className="list-wrapper">
{ this.props.spotify.library_tracks ? <TrackList tracks={this.props.spotify.library_tracks} /> : null }
{ this.props.tracks ? <TrackList tracks={this.props.tracks} /> : null }
</section>
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</div>
@ -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) => {