import React, { PropTypes } from 'react' import FontAwesome from 'react-fontawesome' import Icon from '../Icon' import * as helpers from '../../helpers' export default class SearchSettingsModal extends React.Component{ constructor(props){ super(props) this.state = { spotify: true, uri_schemes: [] } } componentDidMount(){ if (this.props.search_settings){ this.setState(Object.assign({},this.props.search_settings)) } else { this.setState({ spotify: true, uri_schemes: Object.assign([],this.props.uri_schemes) }) } } handleSubmit(e){ this.props.uiActions.set({search_settings: this.state}) this.props.uiActions.closeModal() this.props.coreActions.startSearch(this.props.data.type, this.props.data.query) } handleToggle(scheme){ var uri_schemes = this.state.uri_schemes var index = uri_schemes.indexOf(scheme) if (index > -1){ uri_schemes.splice(index,1) } else { uri_schemes.push(scheme) } this.setState({uri_schemes: uri_schemes}) } render(){ return (