Add to playlist extra detail

This commit is contained in:
James Barnsley
2016-11-21 07:59:52 +13:00
parent 96ad8a75c1
commit 194d41df18
3 changed files with 21 additions and 13 deletions

View File

@ -1,5 +1,6 @@
import React, { PropTypes } from 'react'
import FontAwesome from 'react-fontawesome'
import Icon from '../Icon'
import * as helpers from '../../helpers'
@ -22,16 +23,22 @@ export default class AddToPlaylistModal extends React.Component{
}
return (
<div className="playlists">
{
playlists.map( playlist => {
return (
<div className="playlist" key={playlist.uri} onClick={ () => this.playlistSelected(playlist.uri) }>
{ playlist.name }
</div>
)
})
}
<div>
<h4>Add to playlist</h4>
<div className="playlists">
{
playlists.map( playlist => {
return (
<div className="playlist" key={playlist.uri} onClick={ () => this.playlistSelected(playlist.uri) }>
<FontAwesome className="source" name={helpers.sourceIcon(playlist.uri)} />
&nbsp;
<span className="name">{ playlist.name }</span>
{ playlist.tracks ? <span className="grey-text">&nbsp;{ playlist.tracks.total } tracks</span> : null }
</div>
)
})
}
</div>
</div>
)
}

View File

@ -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 ){

View File

@ -11,8 +11,9 @@ const PusherMiddleware = (function(){
const handleMessage = (ws, store, message) => {
switch( message.action ){
default:
var name = message.action.toUpperCase();
name = name.replace('GET_','');
var name = 'unspecified'
if( message.action ) name = message.action
name = name.replace('GET_','').toUpperCase()
store.dispatch({ type: 'PUSHER_'+name, data: message.data })
}
}