Skip to content

Commit 49e1c77

Browse files
committed
UI improvements
1. Disable review button when an audio plays 2. Disable next button when an audio plays 3. Avoid jumping to next prompt when a user clicks for review
1 parent 6ddf000 commit 49e1c77

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

frontend/src/App/Record.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ class Record extends Component {
9191
? "btn-disabled"
9292
: this.state.blob === undefined
9393
? "btn-disabled"
94+
: this.state.play
95+
? "btn-disabled"
9496
: null
9597
} `}
96-
onClick={this.state.shouldRecord ? () => null : this.playWav}
98+
onClick={this.state.shouldRecord ? () => null : this.state.play ? () => null : this.playWav}
9799
>
98100
<i className="fas fa-play ibutton" />
99101
Review
@@ -105,9 +107,11 @@ class Record extends Component {
105107
? "btn-disabled"
106108
: this.state.blob === undefined
107109
? "btn-disabled"
110+
: this.state.play
111+
? "btn-disabled"
108112
: null
109113
}`}
110-
onClick={this.state.shouldRecord ? () => null : this.onNext}
114+
onClick={this.state.shouldRecord ? () => null : this.state.play ? () => null : this.onNext}
111115
>
112116
<i className="fas fa-forward ibutton-next" />
113117
Next
@@ -240,8 +244,10 @@ class Record extends Component {
240244

241245
// next prompt
242246
if (event.keyCode === 39) {
243-
this.onNext();
244-
}
247+
if (!this.state.play) {
248+
this.onNext();
249+
}
250+
}
245251
};
246252

247253
recordHandler = () => {

0 commit comments

Comments
 (0)