import React, { Component } from "react"
import { connect } from "react-redux"
import * as modalAction from "../../ducks/ui/modal"
import Option from "./Option"
function PureOptionHelp({help}){
return
{help}
;
}
const OptionHelp = connect((state, {name}) => ({
help: state.options[name].help,
}))(PureOptionHelp);
function PureOptionError({error}){
if(!error) return null;
return {error}
;
}
const OptionError = connect((state, {name}) => ({
error: state.ui.optionsEditor[name] && state.ui.optionsEditor[name].error
}))(PureOptionError);
class PureOptionModal extends Component {
constructor(props, context) {
super(props, context)
this.state = { title: 'Options' }
}
render() {
const { hideModal, options } = this.props
const { title } = this.state
return (
{
hideModal()
}}>
{ title }
{
options.map(name =>
)
}
)
}
}
export default connect(
state => ({
options: Object.keys(state.options).sort()
}),
{
hideModal: modalAction.hideModal,
}
)(PureOptionModal)