Skip to content

Commit

Permalink
Fixes to Quiz mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaneH committed Jul 17, 2022
1 parent 910e2dc commit d79fd23
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "Piano Trainer",
"version": "1.0.6"
"version": "1.0.7"
},
"tauri": {
"allowlist": {
Expand Down
14 changes: 14 additions & 0 deletions src/components/Quiz/Quiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,23 @@ const Quiz = () => {
<Piano
noteRange={{ first: firstNote, last: lastNote }}
playNote={(midiNumber: number) => {
setActiveNotes((an) => ({ ...an, [midiNumber]: true }))
setChordStack?.((cs) => [...cs, midiNumber])
!muteSound && playNote(midiNumber)
}}
stopNote={(midiNumber: number) => {
setActiveNotes((an) => ({ ...an, [midiNumber]: false }))

// remove midiNumber from chordStack
setChordStack?.((cs) => {
const removalIdx = cs.indexOf(midiNumber)
if (removalIdx > -1) {
cs.splice(removalIdx, 1)
}

return cs
})

stopNote(midiNumber)
}}
activeNotes={Object.keys(activeNotes)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Quiz/QuizHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const QuizHeader = () => {
>
<ArrowBack color='#1f1f20' />
</BackIconContainer>
<h1>Quiz Mode</h1>
<h1>Quiz</h1>
<SettingsIconContainer onClick={() => setIsOpen?.(true)}>
<SettingsIcon color='#1f1f20' />
</SettingsIconContainer>
Expand Down

0 comments on commit d79fd23

Please sign in to comment.