Placeholder for copyuris; Fixing expired tokens
This commit is contained in:
@ -99,6 +99,16 @@ class ContextMenu extends React.Component{
|
||||
this.props.uiActions.hideContextMenu();
|
||||
}
|
||||
|
||||
copyURIs(){
|
||||
var uris = '';
|
||||
for( var i = 0; i < this.props.context_menu.data.selected_tracks.length; i++ ){
|
||||
if( i > 0 ) uris += ','
|
||||
uris += this.props.context_menu.data.selected_tracks[i].uri
|
||||
}
|
||||
console.log('Yet to be implemented', uris)
|
||||
this.props.uiActions.hideContextMenu()
|
||||
}
|
||||
|
||||
renderPlaylistSubmenu(){
|
||||
var playlists = []
|
||||
for( var i = 0; i < this.props.playlists.length; i++ ){
|
||||
@ -135,6 +145,7 @@ class ContextMenu extends React.Component{
|
||||
items = [
|
||||
{ handleClick: 'playQueueItem', label: 'Play' },
|
||||
{ handleClick: 'addToPlaylist', label: 'Add to playlist', playlists: true },
|
||||
{ handleClick: 'copyURIs', label: 'Copy URIs' },
|
||||
{ handleClick: 'removeFromQueue', label: 'Remove' }
|
||||
];
|
||||
break;
|
||||
@ -145,6 +156,7 @@ class ContextMenu extends React.Component{
|
||||
{ handleClick: 'playItemsNext', label: 'Play next' },
|
||||
{ handleClick: 'addToQueue', label: 'Add to queue' },
|
||||
{ handleClick: 'addToPlaylist', label: 'Add to playlist', playlists: true },
|
||||
{ handleClick: 'copyURIs', label: 'Copy URIs' },
|
||||
{ handleClick: 'removeFromPlaylist', label: 'Remove' }
|
||||
];
|
||||
break;
|
||||
@ -154,7 +166,8 @@ class ContextMenu extends React.Component{
|
||||
{ handleClick: 'playItems', label: 'Play' },
|
||||
{ handleClick: 'playItemsNext', label: 'Play next' },
|
||||
{ handleClick: 'addToQueue', label: 'Add to queue' },
|
||||
{ handleClick: 'addToPlaylist', label: 'Add to playlist', playlists: true }
|
||||
{ handleClick: 'addToPlaylist', label: 'Add to playlist', playlists: true },
|
||||
{ handleClick: 'copyURIs', label: 'Copy URIs' }
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
@ -15,7 +15,9 @@ class FollowButton extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
this.props.spotifyActions.following(this.props.uri)
|
||||
if( this.props.spotify_authorized && this.props.uri ){
|
||||
this.props.spotifyActions.following(this.props.uri)
|
||||
}
|
||||
}
|
||||
|
||||
remove(){
|
||||
|
||||
@ -12,11 +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
|
||||
var actions_to_log = null
|
||||
//actions_to_log = 'SPOTIFY'
|
||||
//actions_to_log = 'MOPIDY'
|
||||
actions_to_log = 'ALBUM_'
|
||||
if( action.type.startsWith(actions_to_log) ) console.log(action)
|
||||
console.log(action)
|
||||
|
||||
switch( action.type ){
|
||||
|
||||
|
||||
@ -9,16 +9,6 @@ export default function reducer(spotify = {}, action){
|
||||
case 'SPOTIFY_CONNECTED':
|
||||
return Object.assign({}, spotify, { connected: true, connecting: false });
|
||||
|
||||
case 'SPOTIFY_AUTHORIZATION_GRANTED':
|
||||
return Object.assign({}, spotify, {
|
||||
authorizing: false,
|
||||
authorized: true,
|
||||
authorization: action.data,
|
||||
access_token: action.data.access_token,
|
||||
refresh_token: action.data.refresh_token,
|
||||
token_expiry: action.data.token_expiry
|
||||
});
|
||||
|
||||
case 'PUSHER_SPOTIFY_TOKEN':
|
||||
if( spotify.authorized ) return spotify;
|
||||
return Object.assign({}, spotify, {
|
||||
@ -29,12 +19,24 @@ export default function reducer(spotify = {}, action){
|
||||
token_expiry: action.data.token_expiry
|
||||
});
|
||||
|
||||
case 'SPOTIFY_AUTHORIZATION_GRANTED':
|
||||
return Object.assign({}, spotify, {
|
||||
authorizing: false,
|
||||
authorized: true,
|
||||
authorization: action.data,
|
||||
access_token: action.data.access_token,
|
||||
refresh_token: action.data.refresh_token,
|
||||
token_expiry: action.data.token_expiry
|
||||
});
|
||||
|
||||
case 'SPOTIFY_AUTHORIZATION_REVOKED':
|
||||
return Object.assign({}, spotify, {
|
||||
authorizing: false,
|
||||
authorization: false,
|
||||
authorized: false,
|
||||
access_token: false,
|
||||
refresh_token: false,
|
||||
token_expiry: 0,
|
||||
me: false
|
||||
});
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ class User extends React.Component{
|
||||
|
||||
loadMore(){
|
||||
if( !this.props.user.playlists_more ) return
|
||||
this.props.spotifyActions.getURL( this.props.user.playlists_more, 'SPOTIFY_USER_PLAYLISTS_LOADED_MORE' );
|
||||
this.props.spotifyActions.getURL( this.props.user.playlists_more, 'SPOTIFY_USER_PLAYLISTS_LOADED_MORE' )
|
||||
}
|
||||
|
||||
renderMeFlag(){
|
||||
@ -61,7 +61,7 @@ class User extends React.Component{
|
||||
</div>
|
||||
|
||||
<ul className="details">
|
||||
<li>{ this.props.user.playlists_total } playlists</li>
|
||||
<li>{ this.props.user.playlists_total.toLocaleString() } playlists</li>
|
||||
<li>{ this.props.user.followers.total.toLocaleString() } followers</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user