stub parse_latl reducer action

This commit is contained in:
Sorrel Bri 2020-03-01 20:55:23 -08:00
parent 6bdd0a9d65
commit d5d1eb2fa2
4 changed files with 15 additions and 6 deletions

View file

@ -5,20 +5,21 @@ const Latl = ({latl, dispatch}) => {
const { innerWidth, innerHeight } = window; const { innerWidth, innerHeight } = window;
const handleChange = e => { const handleChange = e => {
console.log(e.target.value)
const setLatlAction = { const setLatlAction = {
type: 'SET_LATL', type: 'SET_LATL',
value: e.target.value value: e.target.value
} }
dispatch(setLatlAction) dispatch(setLatlAction);
} }
return ( return (
<div className="Latl"> <div className="Latl">
<h3>.LATL</h3> <h3>.LATL</h3>
<textarea name="latl" id="latl" <textarea name="latl" id="latl"
cols={'' + Math.floor(innerWidth / 15)} rows={'' + Math.floor(innerHeight / 30)} value={latl}
onChange={e => dispatch({type:'SET_LATL', value: e.target.value})} cols={'' + Math.floor(innerWidth / 15)}
rows={'' + Math.floor(innerHeight / 30)}
onChange={handleChange}
/> />
</div> </div>
); );

View file

@ -2,10 +2,11 @@ import React from 'react';
import './LatlOutput.scss'; import './LatlOutput.scss';
const LatlOutput = ({results, options, dispatch}) => { const LatlOutput = ({results, options, dispatch}) => {
return ( return (
<div className="LatlOutput"> <div className="LatlOutput">
<h3>Output</h3> <h3>Output</h3>
<form action={() => {}}> <form>
<input <input
className="form form--remove" className="form form--remove"
type="submit" type="submit"

View file

@ -12,7 +12,7 @@ import type { resultsAction } from './reducer.results'
import { initState } from './reducer.init'; import { initState } from './reducer.init';
import type { initAction } from './reducer.init'; import type { initAction } from './reducer.init';
import { clearOutput } from './reducer.clear'; import { clearOutput } from './reducer.clear';
import { setLatl } from './reducer.latl'; import { setLatl, parseLatl } from './reducer.latl';
export type stateType = { export type stateType = {
lexicon: Array<{lexeme: string, epoch: epochType}>, lexicon: Array<{lexeme: string, epoch: epochType}>,
@ -63,6 +63,8 @@ export const stateReducer = (state: stateType, action: actionType): stateType =>
case 'SET_LATL': return setLatl(state, action); case 'SET_LATL': return setLatl(state, action);
case 'PARSE_LATL': return parseLatl(state, action);
case 'CLEAR': return clearOutput(state, action); case 'CLEAR': return clearOutput(state, action);
case 'RUN': return run(state, action); case 'RUN': return run(state, action);

View file

@ -4,3 +4,8 @@ export const setLatl = (state, action) => {
let latl = action.value; let latl = action.value;
return {...state, latl}; return {...state, latl};
} }
export const parseLatl = (state, action) => {
let latl = state.action;
return { ...state }
}