Files
Iris/src/js/components/Modal/CreatePlaylistModal.js

103 lines
2.8 KiB
JavaScript
Raw Normal View History

2016-11-14 17:32:36 +13:00
import React, { PropTypes } from 'react'
import Icon from '../Icon'
import * as helpers from '../../helpers'
export default class CreatePlaylistModal extends React.Component{
constructor(props){
super(props)
this.state = {
name: '',
description: '',
2016-11-14 17:32:36 +13:00
scheme: 'spotify',
is_public: true,
is_collaborative: false
2016-11-14 17:32:36 +13:00
}
}
createPlaylist(e){
e.preventDefault();
if (!this.state.name || this.state.name == ''){
this.setState({error: 'Name is required'})
return false
} else {
this.props.uiActions.createPlaylist( this.state.scheme, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative )
this.props.uiActions.closeModal()
}
2016-11-14 17:32:36 +13:00
return false
2016-11-14 17:32:36 +13:00
}
render(){
return (
<div>
2017-06-21 09:16:26 +12:00
<h1>Create playlist</h1>
2016-11-14 17:32:36 +13:00
<form onSubmit={(e) => this.createPlaylist(e)}>
<div className="field text">
<span className="label">Name</span>
2016-11-14 17:32:36 +13:00
<input
type="text"
onChange={ e => this.setState({ name: e.target.value })}
2016-11-14 17:32:36 +13:00
value={ this.state.name } />
</div>
<div className="field text">
<span className="label">Description</span>
<input
type="text"
onChange={ e => this.setState({ description: e.target.value })}
value={ this.state.description } />
</div>
2016-11-14 17:32:36 +13:00
<div className="field radio white">
<span className="label">Provider</span>
2016-11-14 17:32:36 +13:00
<label>
<input
type="radio"
name="scheme"
value="spotify"
checked={ this.state.scheme == 'spotify' }
onChange={ e => this.setState({ scheme: e.target.value })} />
<span className="label">Spotify</span>
</label>
<label>
<input
type="radio"
name="scheme"
value="m3u"
checked={ this.state.scheme == 'm3u' }
onChange={ e => this.setState({ scheme: e.target.value })} />
<span className="label">Mopidy</span>
2016-11-14 17:32:36 +13:00
</label>
</div>
<div className="field checkbox white">
<span className="label">Options</span>
2016-11-14 17:32:36 +13:00
<label>
<input
type="checkbox"
name="is_public"
checked={ this.state.is_public }
onChange={ e => this.setState({ is_public: !this.state.is_public })} />
<span className="label">Public</span>
</label>
<label>
<input
type="checkbox"
name="is_collaborative"
checked={ this.state.is_collaborative }
onChange={ e => this.setState({ is_collaborative: !this.state.is_collaborative })} />
<span className="label">Collaborative</span>
</label>
2016-11-14 17:32:36 +13:00
</div>
2017-02-05 19:57:29 +13:00
<div className="actions centered-text">
<button type="submit" className="primary wide">Create</button>
2017-02-05 19:57:29 +13:00
</div>
2016-11-14 17:32:36 +13:00
</form>
</div>
)
}
}