2016-10-26 16:55:47 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
2017-01-27 16:13:11 +13:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import { createStore, bindActionCreators } from 'redux'
|
2017-08-09 08:52:49 +12:00
|
|
|
import { Link, hashHistory } from 'react-router'
|
2017-01-27 16:13:11 +13:00
|
|
|
import FontAwesome from 'react-fontawesome'
|
2016-10-26 16:55:47 +13:00
|
|
|
|
2017-03-27 08:29:18 +13:00
|
|
|
import * as helpers from '../helpers'
|
2017-01-27 16:13:11 +13:00
|
|
|
import * as uiActions from '../services/ui/actions'
|
2017-08-09 08:52:49 +12:00
|
|
|
import GridItem from './GridItem'
|
2017-01-27 16:13:11 +13:00
|
|
|
|
|
|
|
|
class PlaylistGrid extends React.Component{
|
2016-10-26 16:55:47 +13:00
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-27 16:13:11 +13:00
|
|
|
handleContextMenu(e,item){
|
|
|
|
|
e.preventDefault()
|
2017-01-29 16:34:17 +13:00
|
|
|
var data = {
|
|
|
|
|
e: e,
|
|
|
|
|
context: 'playlist',
|
2017-01-27 16:13:11 +13:00
|
|
|
uris: [item.uri],
|
2017-02-28 16:13:27 +13:00
|
|
|
items: [item]
|
2017-01-27 16:13:11 +13:00
|
|
|
}
|
2017-01-29 16:34:17 +13:00
|
|
|
this.props.uiActions.showContextMenu(data)
|
2017-01-27 16:13:11 +13:00
|
|
|
}
|
|
|
|
|
|
2016-10-26 16:55:47 +13:00
|
|
|
render(){
|
2016-11-08 13:36:13 +13:00
|
|
|
if( !this.props.playlists ) return null
|
|
|
|
|
|
|
|
|
|
var className = "grid playlist-grid"
|
|
|
|
|
if( this.props.className ) className += ' '+this.props.className
|
|
|
|
|
return (
|
|
|
|
|
<div className={className}>
|
|
|
|
|
{
|
2017-08-09 08:52:49 +12:00
|
|
|
this.props.playlists.map(playlist => {
|
|
|
|
|
return (
|
|
|
|
|
<GridItem
|
|
|
|
|
key={playlist.uri}
|
|
|
|
|
type="playlist"
|
|
|
|
|
item={playlist}
|
|
|
|
|
onClick={e => {hashHistory.push(global.baseURL+'playlist/'+playlist.uri)}}
|
|
|
|
|
onContextMenu={e => this.handleContextMenu(e,playlist)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2016-11-08 13:36:13 +13:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2016-10-26 16:55:47 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-27 16:13:11 +13:00
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {
|
|
|
|
|
uiActions: bindActionCreators(uiActions, dispatch)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(PlaylistGrid)
|
|
|
|
|
|