Editing playlists, possibly addresses #119; Editing collaborative state

This commit is contained in:
James Barnsley
2017-08-17 17:37:53 +12:00
parent 40888f5835
commit 227d8657cc
4 changed files with 14 additions and 11 deletions

View File

@ -12,8 +12,8 @@ export default class EditPlaylistModal extends React.Component{
error: null,
name: this.props.data.name,
description: (this.props.data.description ? this.props.data.description : ''),
is_public: this.props.data.is_public,
is_collaborative: this.props.data.is_collaborative
public: this.props.data.public,
collaborative: this.props.data.collaborative
}
}
@ -24,7 +24,7 @@ export default class EditPlaylistModal extends React.Component{
this.setState({error: 'Name is required'})
return false
} else {
this.props.coreActions.savePlaylist(this.props.data.uri, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative)
this.props.coreActions.savePlaylist(this.props.data.uri, this.state.name, this.state.description, this.state.public, this.state.collaborative)
this.props.uiActions.closeModal()
return false
}
@ -56,16 +56,16 @@ export default class EditPlaylistModal extends React.Component{
<input
type="checkbox"
name="playlist_private"
checked={ this.state.is_public }
onChange={ e => this.setState({ is_public: !this.state.is_public })} />
checked={ this.state.public }
onChange={ e => this.setState({ public: !this.state.public })} />
<span className="label">Public</span>
</label>
<label>
<input
type="checkbox"
name="is_collaborative"
checked={ this.state.is_collaborative }
onChange={ e => this.setState({ is_collaborative: !this.state.is_collaborative })} />
name="collaborative"
checked={ this.state.collaborative }
onChange={ e => this.setState({ collaborative: !this.state.collaborative })} />
<span className="label">Collaborative</span>
</label>
</div>

View File

@ -74,9 +74,12 @@ class SpotifyAuthenticationFrame extends React.Component{
'user-library-modify',
'user-follow-modify',
'user-follow-read',
'user-read-email',
'user-top-read',
'user-read-currently-playing',
'user-read-playback-state'
'user-read-playback-state',
'playlist-read-collaborative',
'ugc-image-upload' // playlist image uploading
]
var popup = window.open(url+'&scope='+scopes.join('%20'),"popup","height=680,width=400");

View File

@ -914,7 +914,7 @@ export function getArtists( uris ){
export function playArtistTopTracks(uri){
return (dispatch, getState) => {
const artists = getState().ui.artists
const artists = getState().core.artists
// Do we have this artist (and their tracks) in our index already?
if (typeof(artists[uri]) !== 'undefined' && typeof(artists[uri].tracks) !== 'undefined'){

View File

@ -126,7 +126,7 @@ class Playlist extends React.Component{
return (
<div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button>
<button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.params.uri, name: this.props.playlist.name, is_public: this.props.playlist.public, description: this.props.playlist.description }) }>Edit</button>
<button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.params.uri, name: this.props.playlist.name, public: this.props.playlist.public, collaborative: this.props.playlist.collaborative, description: this.props.playlist.description }) }>Edit</button>
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
</div>
)