2016-10-17 10:39:11 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import { bindActionCreators } from 'redux'
|
2016-10-17 14:27:48 +13:00
|
|
|
import { Link } from 'react-router'
|
2016-11-14 11:20:02 +13:00
|
|
|
import FontAwesome from 'react-fontawesome'
|
2016-10-17 10:39:11 +13:00
|
|
|
|
2016-11-12 16:36:36 +13:00
|
|
|
import PlaylistGrid from '../../components/PlaylistGrid'
|
2016-10-23 23:48:06 +13:00
|
|
|
import Header from '../../components/Header'
|
2016-10-21 23:27:50 +13:00
|
|
|
|
2016-11-14 11:20:02 +13:00
|
|
|
import * as uiActions from '../../services/ui/actions'
|
2016-10-21 09:56:07 +13:00
|
|
|
import * as mopidyActions from '../../services/mopidy/actions'
|
|
|
|
|
import * as spotifyActions from '../../services/spotify/actions'
|
2016-10-17 10:39:11 +13:00
|
|
|
|
2016-10-21 09:56:07 +13:00
|
|
|
class LibraryPlaylists extends React.Component{
|
2016-10-17 10:39:11 +13:00
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-10 10:26:15 +13:00
|
|
|
render(){
|
|
|
|
|
if( !this.props.playlists ) return null
|
2016-11-02 21:23:35 +13:00
|
|
|
var columns = [
|
2016-11-12 16:36:36 +13:00
|
|
|
{ name: 'name', width: '30'},
|
|
|
|
|
{ name: 'tracks.total', width: '15'},
|
2016-11-11 23:21:51 +13:00
|
|
|
{ name: 'can_edit', width: '15'},
|
2016-11-12 16:36:36 +13:00
|
|
|
{ name: 'uri', width: '40'}
|
2016-11-02 21:23:35 +13:00
|
|
|
]
|
|
|
|
|
|
2016-10-21 23:27:50 +13:00
|
|
|
return (
|
2016-10-26 16:55:47 +13:00
|
|
|
<div className="view library-playlists-view">
|
2016-11-10 10:26:15 +13:00
|
|
|
|
|
|
|
|
<Header icon="playlist" title="My playlists" />
|
|
|
|
|
|
2016-11-14 11:20:02 +13:00
|
|
|
<button onClick={ () => this.props.uiActions.openModal('create_playlist',false) }>
|
|
|
|
|
<FontAwesome name="plus" />
|
|
|
|
|
New playlist
|
|
|
|
|
</button>
|
|
|
|
|
|
2016-11-12 16:36:36 +13:00
|
|
|
<section className="grid-wrapper">
|
|
|
|
|
<PlaylistGrid playlists={this.props.playlists} />
|
2016-11-04 09:35:39 +13:00
|
|
|
</section>
|
2016-11-10 10:26:15 +13:00
|
|
|
|
2016-10-21 23:27:50 +13:00
|
|
|
</div>
|
|
|
|
|
)
|
2016-10-17 10:39:11 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Export our component
|
|
|
|
|
*
|
|
|
|
|
* We also integrate our global store, using connect()
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
2016-11-10 10:26:15 +13:00
|
|
|
return {
|
2016-11-10 13:44:14 +13:00
|
|
|
playlists: state.ui.playlists
|
2016-10-17 10:39:11 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-14 11:20:02 +13:00
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {
|
|
|
|
|
uiActions: bindActionCreators(uiActions, dispatch),
|
|
|
|
|
mopidyActions: bindActionCreators(mopidyActions, dispatch),
|
|
|
|
|
spotifyActions: bindActionCreators(spotifyActions, dispatch)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(LibraryPlaylists)
|