Remaining modals; Error boundaries; Notification styles

This commit is contained in:
James Barnsley
2018-07-21 11:43:40 +12:00
parent 5f8956b376
commit 3af47a7903
17 changed files with 23207 additions and 25074 deletions

View File

@ -20,8 +20,8 @@ export default class AddToPlaylistModal extends React.Component{
}
playlistSelected(playlist_uri){
this.props.coreActions.addTracksToPlaylist(playlist_uri, this.props.tracks_uris )
this.props.uiActions.closeModal()
this.props.coreActions.addTracksToPlaylist(playlist_uri, this.props.tracks_uris);
window.history.back();
}
render(){

View File

@ -1,53 +0,0 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { createStore, bindActionCreators } from 'redux';
import * as uiActions from '../../services/ui/actions'
import * as helpers from '../../helpers'
import Icon from '../Icon'
import Thumbnail from '../Thumbnail'
export default class extends React.Component{
constructor(props){
super(props)
}
handleImport(e){
this.props.spotifyActions.importAuthorization(this.props.data)
this.props.uiActions.closeModal()
}
render(){
console.log(this.props.data)
if (!this.props.data || !this.props.data.user || !this.props.data.authorization){
return null
}
var user = this.props.data.user
return (
<div>
<h1>Spotify authorization received</h1>
<h2 className="grey-text">{user.display_name ? user.display_name : user.id} has shared their Spotify authorization with you. Importing this will overwrite your existing Spotify Authorization.</h2>
<div className="user-details">
<Thumbnail images={user.images} circle />
<h2>{user.display_name ? user.display_name : user.id}</h2>
<ul className="details">
<li>{user.id}</li>
<li>{user.followers.total} followers</li>
</ul>
</div>
<div className="actions centered-text">
<button className="large" onClick={e => this.props.uiActions.closeModal()}>Ignore</button>
<button className="primary large" onClick={e => this.handleImport(e)}>Import authorization</button>
</div>
</div>
)
}
}

View File

@ -73,8 +73,15 @@ class EditPlaylist extends React.Component{
this.setState({error: 'Name is required'})
return false
} else {
this.props.coreActions.savePlaylist(this.props.params.uri, this.state.name, this.state.description, this.state.public, this.state.collaborative, this.state.image);
this.props.uiActions.closeModal();
this.props.coreActions.savePlaylist(
this.props.params.uri,
this.state.name,
this.state.description,
this.state.public,
this.state.collaborative,
this.state.image
);
window.history.back();
return false;
}
}

View File

@ -49,7 +49,7 @@ class EditRadio extends React.Component{
if (valid_seeds){
this.props.pusherActions.startRadio(this.state.seeds);
this.props.uiActions.closeModal();
window.history.back();
} else {
this.setState({error_message: "Invalid seed URI(s)"});
}

View File

@ -56,11 +56,11 @@ class InitialSetup extends React.Component{
// We've changed a connection setting, so need to reload
if (self.state.host !== self.props.host || self.state.port !== self.props.port || self.state.ssl !== self.props.ssl){
window.location.reload(true);
window.location = global.baseURL;
// Safe to just close modal
} else {
self.props.uiActions.closeModal();
window.history.back();
}
}, 1000);

View File

@ -17,6 +17,10 @@ class ShareAuthorization_Send extends React.Component {
super(props)
}
componentDidMount(){
this.props.uiActions.setWindowTitle("Share Spotify authorization");
}
handleClick(e, connection_id){
e.preventDefault()
this.props.pusherActions.deliverMessage(
@ -27,14 +31,14 @@ class ShareAuthorization_Send extends React.Component {
user: this.props.me
}
);
this.props.uiActions.closeModal()
return false;
window.history.back();
return;
}
renderConnectionsList(){
var connections = []
for (var connection_id in this.props.connections){
if (this.props.connections.hasOwnProperty(connection_id) && connection_id !== this.props.connection_id){
if (this.props.connections.hasOwnProperty(connection_id) && connection_id != this.props.connection_id){
connections.push(this.props.connections[connection_id])
}
}
@ -62,7 +66,7 @@ class ShareAuthorization_Send extends React.Component {
render(){
return (
<Modal className="modal--share-authorization--send">
<Modal className="modal--share-authorization">
<h1>Share Spotify authentication</h1>
<h2 className="grey-text">Send your authentication tokens to another client. When the recipient client imports this, their Iris will have full access to your Spotify account ({this.props.me.id}).</h2>
{this.renderConnectionsList()}