import React from 'react';
import Link from './Link';
import Icon from './Icon';
export default class Notifications extends React.Component{
constructor(props){
super(props)
}
importConfiguration(notification_key, configuration){
console.log("Importing configuration", configuration);
var configurations = "";
if (configuration.interface){
this.props.uiActions.set(configuration.interface);
}
if (configuration.spotify){
this.props.spotifyActions.importAuthorization(configuration.spotify.authorization, configuration.spotify.me);
}
if (configuration.lastfm){
this.props.lastfmActions.importAuthorization(configuration.lastfm.authorization, configuration.lastfm.me);
}
if (configuration.genius){
this.props.geniusActions.importAuthorization(configuration.genius.authorization, configuration.genius.me);
}
this.props.uiActions.removeNotification(notification_key, true);
this.props.uiActions.createNotification({type: 'info', content: 'Import successful'});
}
renderNotifications(){
if (!this.props.notifications || this.props.notifications.length <= 0) return null
var notifications = []
for (var key in this.props.notifications){
if (this.props.notifications.hasOwnProperty(key)){
notifications.push(this.props.notifications[key])
}
}
return (
{
notifications.map(notification => {
switch (notification.type){
case 'shortcut':
return (
Another user has shared their configuration with you. This includes: Do you want to import this?Configuration shared
{notification.configuration.ui ?
{notification.title}
: null}
{notification.content ?