hook options to Options render

This commit is contained in:
Sorrel Bri 2019-12-18 21:24:26 -08:00
parent 2c98a28624
commit 77ebc5e1b9
4 changed files with 14 additions and 9 deletions

View file

@ -124,10 +124,8 @@ const PhonoChangeApplier = () => {
<div className="PhonoChangeApplier" data-testid="PhonoChangeApplier"> <div className="PhonoChangeApplier" data-testid="PhonoChangeApplier">
<ProtoLang lexicon={state.lexicon} dispatch={dispatch}/> <ProtoLang lexicon={state.lexicon} dispatch={dispatch}/>
<Features phones={state.phones} features={state.features} dispatch={dispatch}/> <Features phones={state.phones} features={state.features} dispatch={dispatch}/>
<Epochs epochs={state.epochs} dispatch={dispatch} <Epochs epochs={state.epochs} dispatch={dispatch} />
// setEpochs={setEpochs} <Options options={state.options} dispatch={dispatch}/>
/>
<Options options={options} setOptions={setOptions} runChanges={runChanges}/>
<Output results={results} setResults={setResults}/> <Output results={results} setResults={setResults}/>
</div> </div>
); );

View file

@ -6,17 +6,22 @@ const Options = props => {
const [ load, setLoad ] = useState(''); const [ load, setLoad ] = useState('');
const handleRadioChange = e => { const handleRadioChange = e => {
props.setOptions({...props.options, [e.target.name]: e.target.id}) // props.setOptions({...props.options, [e.target.name]: e.target.id})
} }
const handleCheckChange = e => { const handleCheckChange = e => {
props.setOptions({...props.options, [e.target.name]: e.target.checked}) // props.setOptions({...props.options, [e.target.name]: e.target.checked})
} }
const handleFormSubmit = e => {
e.preventDefault();
}
return ( return (
<div className="Options" data-testid="Options"> <div className="Options" data-testid="Options">
<h3>Modeling Options</h3> <h3>Modeling Options</h3>
<form onSubmit={e=>props.runChanges(e)} data-testid="Options-form"> <form onSubmit={e=>handleFormSubmit(e)} data-testid="Options-form">
{/* <h5>Output</h5> */} {/* <h5>Output</h5> */}

View file

@ -57,7 +57,9 @@ export const initState = (changesArgument: number = -1): stateType => {
} }
} }
}, },
options: {}, options: {
output: 'default', save: false
},
results: {}, results: {},
errors: {}, errors: {},
features: {}, features: {},

View file

@ -14,7 +14,7 @@ export type stateType = {
lexicon: Array<{lexeme: string, epoch: epochType}>, lexicon: Array<{lexeme: string, epoch: epochType}>,
epochs: Array<epochType>, epochs: Array<epochType>,
phones: {[key: string]: phoneType}, phones: {[key: string]: phoneType},
options: {}, options: {output: string, save: boolean},
results: {}, results: {},
errors: {}, errors: {},
features: featureType features: featureType