Editing playlist modal
This commit is contained in:
@ -8,7 +8,7 @@ import { connect } from 'react-redux'
|
||||
import Sidebar from '../components/Sidebar'
|
||||
import ContextMenu from '../components/ContextMenu'
|
||||
import Dragger from '../components/Dragger'
|
||||
import Modal from '../components/Modal'
|
||||
import Modal from '../components/Modal/Modal'
|
||||
|
||||
import * as uiActions from '../services/ui/actions'
|
||||
import * as pusherActions from '../services/pusher/actions'
|
||||
|
||||
@ -74,23 +74,30 @@ class Playlist extends React.Component{
|
||||
this.props.uiActions.removeTracksFromPlaylist( this.props.playlist.uri, track_indexes )
|
||||
}
|
||||
|
||||
renderFollowOrDeleteButton(){
|
||||
renderEditButtons(){
|
||||
switch( helpers.uriSource( this.props.params.uri ) ){
|
||||
|
||||
case 'm3u':
|
||||
return <ConfirmationButton className="large tertiary" content="Delete" confirmingContent="Are you sure?" onConfirm={ e => this.delete() } />
|
||||
break
|
||||
return (
|
||||
<span>
|
||||
<button className="large tertiary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.playlist.uri, name: this.props.playlist.name }) }>Edit</button>
|
||||
<ConfirmationButton className="large tertiary" content="Delete" confirmingContent="Are you sure?" onConfirm={ e => this.delete() } />
|
||||
</span>
|
||||
)
|
||||
|
||||
case 'spotify':
|
||||
if( !this.props.spotify_authorized ) return null
|
||||
if( this.props.playlist.owner && this.props.playlist.owner.id == this.props.spotify_userid ){
|
||||
return <ConfirmationButton className="large tertiary" content="Delete" confirmingContent="Are you sure?" onConfirm={ e => this.unfollow() } />
|
||||
return (
|
||||
<span>
|
||||
<button className="large tertiary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.playlist.uri, name: this.props.playlist.name, is_public: this.props.playlist.public }) }>Edit</button>
|
||||
<ConfirmationButton className="large tertiary" content="Delete" confirmingContent="Are you sure?" onConfirm={ e => this.unfollow() } />
|
||||
</span>
|
||||
)
|
||||
}else if( this.props.playlist.following ){
|
||||
return <button className="large tertiary" onClick={ e => this.unfollow() }>Unfollow</button>
|
||||
}else{
|
||||
return <button className="large tertiary" onClick={ e => this.follow() }>Follow</button>
|
||||
}
|
||||
break
|
||||
return <button className="large tertiary" onClick={ e => this.follow() }>Follow</button>
|
||||
|
||||
}
|
||||
}
|
||||
@ -107,7 +114,7 @@ class Playlist extends React.Component{
|
||||
|
||||
<div className="actions">
|
||||
<button className="large primary" onClick={ e => this.play() }>Play</button>
|
||||
{ this.renderFollowOrDeleteButton() }
|
||||
{ this.renderEditButtons() }
|
||||
</div>
|
||||
|
||||
<ul className="details">
|
||||
|
||||
@ -27,15 +27,17 @@ class LibraryPlaylists extends React.Component{
|
||||
{ name: 'uri', width: '40'}
|
||||
]
|
||||
|
||||
var actions = (
|
||||
<button onClick={ () => this.props.uiActions.openModal('create_playlist', {} ) }>
|
||||
<FontAwesome name="plus" />
|
||||
New
|
||||
</button>
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="view library-playlists-view">
|
||||
|
||||
<Header icon="playlist" title="My playlists" />
|
||||
|
||||
<button onClick={ () => this.props.uiActions.openModal('create_playlist',false) }>
|
||||
<FontAwesome name="plus" />
|
||||
New playlist
|
||||
</button>
|
||||
<Header icon="playlist" title="My playlists" actions={actions} />
|
||||
|
||||
<section className="grid-wrapper">
|
||||
<PlaylistGrid playlists={this.props.playlists} />
|
||||
|
||||
Reference in New Issue
Block a user