From b34e1c69f05be68922ec244761c3cdcfcb0ff33b Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum <eric.rosenbaum@gmail.com> Date: Mon, 8 Jul 2019 13:02:45 -0400 Subject: [PATCH] Cleanup and connect trim button to delete --- src/components/sound-editor/sound-editor.jsx | 3 +++ src/containers/sound-editor.jsx | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/sound-editor/sound-editor.jsx b/src/components/sound-editor/sound-editor.jsx index ce25dc50b..57fc2149e 100644 --- a/src/components/sound-editor/sound-editor.jsx +++ b/src/components/sound-editor/sound-editor.jsx @@ -15,6 +15,8 @@ import styles from './sound-editor.css'; import playIcon from '../record-modal/icon--play.svg'; import stopIcon from '../record-modal/icon--stop-playback.svg'; +import trimIcon from './icon--trim.svg'; +import trimConfirmIcon from './icon--trim-confirm.svg'; import redoIcon from './icon--redo.svg'; import undoIcon from './icon--undo.svg'; import echoIcon from './icon--echo.svg'; @@ -251,6 +253,7 @@ SoundEditor.propTypes = { chunkLevels: PropTypes.arrayOf(PropTypes.number).isRequired, intl: intlShape, name: PropTypes.string.isRequired, + onActivateTrim: PropTypes.func.isRequired, onChangeName: PropTypes.func.isRequired, onContainerClick: PropTypes.func.isRequired, onEcho: PropTypes.func.isRequired, diff --git a/src/containers/sound-editor.jsx b/src/containers/sound-editor.jsx index d3c58f811..5e54f7e9c 100644 --- a/src/containers/sound-editor.jsx +++ b/src/containers/sound-editor.jsx @@ -28,7 +28,7 @@ class SoundEditor extends React.Component { 'handleEffect', 'handleUndo', 'handleRedo', - 'submitNewSamples' + 'submitNewSamples', 'handleContainerClick', 'setRef' ]); @@ -153,11 +153,6 @@ class SoundEditor extends React.Component { trimEnd: null }); } - handleUpdateTrimEnd (trimEnd) { - this.setState({trimEnd}); - } - handleUpdateTrimStart (trimStart) { - this.setState({trimStart}); handleUpdateTrim (trimStart, trimEnd) { this.setState({trimStart, trimEnd}); this.handleStopPlaying(); @@ -195,6 +190,8 @@ class SoundEditor extends React.Component { this.undoStack.push(this.copyCurrentBuffer()); this.submitNewSamples(samples, sampleRate, true); this.handlePlay(); + } + } setRef (element) { this.ref = element; } @@ -216,6 +213,7 @@ class SoundEditor extends React.Component { setRef={this.setRef} trimEnd={this.state.trimEnd} trimStart={this.state.trimStart} + onActivateTrim={this.handleDelete} onChangeName={this.handleChangeName} onContainerClick={this.handleContainerClick} onDelete={this.handleDelete} -- GitLab