import React from 'react'; import Icon from '../Icon'; import * as helpers from '../../helpers'; export default class EditPlaylistModal extends React.Component{ constructor(props){ super(props) this.state = { error: null, name: this.props.data.name, description: (this.props.data.description ? this.props.data.description : ''), public: this.props.data.public, collaborative: this.props.data.collaborative } } savePlaylist(e){ e.preventDefault(); if (!this.state.name || this.state.name == ''){ 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.public, this.state.collaborative) this.props.uiActions.closeModal() return false } } renderFields(){ switch (helpers.uriSource(this.props.data.uri)){ case 'spotify': return (