Modals, including sharing auth

This commit is contained in:
James Barnsley
2018-07-13 16:48:41 +12:00
parent 2f6e8c2a74
commit 5f8956b376
26 changed files with 720 additions and 353 deletions

View File

@ -89,7 +89,13 @@ const PusherMiddleware = (function(){
store.dispatch(spotifyActions.tokenChanged(message.params.spotify_token));
break;
case 'spotify_authorization_received':
store.dispatch(uiActions.openModal('receive_authorization', message.params));
console.log(message);
store.dispatch(uiActions.createNotification({
type: 'spotify-authorization-received',
authorization: message.params.authorization,
user: message.params.user,
sticky: true
}));
break;
case 'notification':
store.dispatch(uiActions.createNotification(message.params.notification));

View File

@ -239,17 +239,11 @@ export function tokenChanged(spotify_token){
}
}
export function authorizationReceived(data){
// This is just an alias to open the modal
return uiActions.openModal('receive_authorization', data);
}
export function importAuthorization(data){
export function importAuthorization(user, authorization){
return {
type: 'SPOTIFY_IMPORT_AUTHORIZATION',
user: data.user,
authorization: data.authorization
user: user,
authorization: authorization
}
}

View File

@ -150,8 +150,6 @@ export function createBrowserNotification(data){
}
}
// content, type = 'default', key = null, title = null, description = null, sticky = false
export function createNotification(data){
return {
type: 'CREATE_NOTIFICATION',
@ -164,7 +162,8 @@ export function createNotification(data){
content: null,
description: null,
sticky: false,
closing: false
closing: false,
render_content: false
},
data
)

View File

@ -147,7 +147,7 @@ const UIMiddleware = (function(){
case 'BROADCASTS_LOADED':
var suppressed_broadcasts = []
if (typeof(store.getState().ui.suppressed_broadcasts) !== 'undefined'){
if (store.getState().ui.suppressed_broadcasts !== undefined){
suppressed_broadcasts = store.getState().ui.suppressed_broadcasts
}
@ -160,7 +160,7 @@ const UIMiddleware = (function(){
key: (broadcast.key ? broadcast.key : null),
title: (broadcast.title ? broadcast.title : null),
content: broadcast.message,
type: 'broadcast',
type: 'info',
sticky: true
}
store.dispatch(uiActions.createNotification(data));