diff --git a/src/components/Epochs.js b/src/components/Epochs.js index 4378621..66f8e5f 100644 --- a/src/components/Epochs.js +++ b/src/components/Epochs.js @@ -3,23 +3,32 @@ import './Epochs.scss'; import SoundChangeSuite from './SoundChangeSuite'; -const addEpoch = (e, props) => { - e.preventDefault() - let index = props.epochs.length + 1; - props.setEpochs([...props.epochs, {name: `epoch ${index}`, changes:['[+ feature]>[- feature]/_#']}]) -} const Epochs = props => { + + const addEpoch = (e, props) => { + e.preventDefault() + let index = props.epochs.length + 1; + props.setEpochs([...props.epochs, {name: `epoch ${index}`, changes:['[+ feature]>[- feature]/_#']}]) + } + const removeEpoch = (e, epochName) => { e.preventDefault() let newEpochs = props.epochs.filter(epoch => epoch.name !== epochName); props.setEpochs(newEpochs) } + + const updateEpoch = (epoch, epochIndex) => { + let updatedEpochs = [...props.epochs] + updatedEpochs[epochIndex] = epoch + props.setEpochs(updatedEpochs) + } + return (