Nicer context menus

This commit is contained in:
James Barnsley
2017-01-27 16:13:11 +13:00
parent 31472ae564
commit cd17467ced
8 changed files with 150 additions and 54 deletions

View File

@ -28,6 +28,12 @@ class LibraryAlbums extends React.Component{
if (!this.props.library_albums) this.props.spotifyActions.getLibraryAlbums();
}
handleContextMenu(e,uri){
e.preventDefault()
var data = { uris: [uri] }
this.props.uiActions.showContextMenu( e, data, 'album', 'click' )
}
loadMore(){
this.props.spotifyActions.getURL( this.props.library_albums_more, 'SPOTIFY_LIBRARY_ALBUMS_LOADED' );
}
@ -76,13 +82,19 @@ class LibraryAlbums extends React.Component{
]
return (
<section className="list-wrapper">
<List rows={albums} columns={columns} link_prefix={global.baseURL+"album/"} />
<List
handleContextMenu={(e,uri) => this.handleContextMenu(e,uri)}
rows={albums}
columns={columns}
link_prefix={global.baseURL+"album/"} />
</section>
)
}else if( this.props.view == 'thumbnails' ){
return (
<section className="grid-wrapper">
<AlbumGrid albums={albums} />
<AlbumGrid
handleContextMenu={(e,uri) => this.handleContextMenu(e,uri)}
albums={albums} />
</section>
)
}else{

View File

@ -21,6 +21,12 @@ class LibraryArtists extends React.Component{
super(props);
}
handleContextMenu(e,uri){
e.preventDefault()
var data = { uris: [uri] }
this.props.uiActions.showContextMenu( e, data, 'artist', 'click' )
}
componentDidMount(){
if (!this.props.library_artists) this.props.spotifyActions.getLibraryArtists();
}
@ -61,13 +67,19 @@ class LibraryArtists extends React.Component{
]
return (
<section className="list-wrapper">
<List rows={artists} columns={columns} link_prefix={global.baseURL+"artist/"} show_source_icon={true} />
<List
handleContextMenu={(e,uri) => this.handleContextMenu(e,uri)}
rows={artists}
columns={columns}
link_prefix={global.baseURL+"artist/"} show_source_icon={true} />
</section>
)
}else{
return (
<section className="grid-wrapper">
<ArtistGrid artists={artists} />
<ArtistGrid
handleContextMenu={(e,uri) => this.handleContextMenu(e,uri)}
artists={artists} />
</section>
)
}