add starting sound change rule for empty rules
This commit is contained in:
parent
2f989364fa
commit
07100ccaa9
3 changed files with 5 additions and 4 deletions
|
@ -10,7 +10,7 @@ const PhonoChangeApplier = () => {
|
||||||
const [ phonemes, setPhonemes ] = useState(
|
const [ phonemes, setPhonemes ] = useState(
|
||||||
{ phoneme: [ 'feature' ] }
|
{ phoneme: [ 'feature' ] }
|
||||||
);
|
);
|
||||||
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ feature]>[+ new feature]/[]_[]']}]);
|
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ feature]>[- feature]/_#']}]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="PhonoChangeApplier" data-testid="PhonoChangeApplier">
|
<div className="PhonoChangeApplier" data-testid="PhonoChangeApplier">
|
||||||
|
|
|
@ -6,7 +6,7 @@ import SoundChangeSuite from './SoundChangeSuite';
|
||||||
const addEpoch = (e, props) => {
|
const addEpoch = (e, props) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
let index = props.epochs.length + 1;
|
let index = props.epochs.length + 1;
|
||||||
props.setEpochs([...props.epochs, {name: `epoch ${index}`, changes:['[+ feature]>[+ new feature]/[]_[]']}])
|
props.setEpochs([...props.epochs, {name: `epoch ${index}`, changes:['[+ feature]>[- feature]/_#']}])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ import React, { useState } from 'react';
|
||||||
import './SoundChangeSuite.scss';
|
import './SoundChangeSuite.scss';
|
||||||
|
|
||||||
const SoundChangeSuite = props => {
|
const SoundChangeSuite = props => {
|
||||||
const [ epoch, setEpoch ] = useState(props.epoch ? props.epoch : {name:'', changes:['']})
|
const [ epoch, setEpoch ] = useState(props.epoch ? props.epoch : {name:'', changes:['']});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="SoundChangeSuite" data-testid={`${epoch.name}_SoundChangeSuite`}>
|
<div className="SoundChangeSuite" data-testid={`${epoch.name}_SoundChangeSuite`}>
|
||||||
<h4>{epoch.name}</h4>
|
<h4>{epoch.name}</h4>
|
||||||
|
@ -10,7 +11,7 @@ const SoundChangeSuite = props => {
|
||||||
<textarea name="epoch" id="" cols="30" rows="1" value={epoch.name} onChange={e=>setEpoch({...epoch, name:e.target.value})} ></textarea>
|
<textarea name="epoch" id="" cols="30" rows="1" value={epoch.name} onChange={e=>setEpoch({...epoch, name:e.target.value})} ></textarea>
|
||||||
<textarea name="changes" id="" cols="30" rows="10"
|
<textarea name="changes" id="" cols="30" rows="10"
|
||||||
value={epoch.changes.join('\n')}
|
value={epoch.changes.join('\n')}
|
||||||
onChange={e=>setEpoch({...epoch, changes:e.target.value.split(/\n/)})}
|
onChange={e=>setEpoch({...epoch, changes:e.target.value.split(/\n/).map(change=>change === '' ? '[+ feature]>[- feature]/_#' : change)})}
|
||||||
></textarea>
|
></textarea>
|
||||||
</form>
|
</form>
|
||||||
<form onSubmit={e=>props.removeEpoch(e, epoch.name)}>
|
<form onSubmit={e=>props.removeEpoch(e, epoch.name)}>
|
||||||
|
|
Loading…
Reference in a new issue