From d79fd239638a5fff6d305a755dfd0ced99c8cba5 Mon Sep 17 00:00:00 2001 From: Zane Helton Date: Sun, 17 Jul 2022 12:43:04 -0400 Subject: [PATCH] Fixes to Quiz mode --- src-tauri/tauri.conf.json | 2 +- src/components/Quiz/Quiz.tsx | 14 ++++++++++++++ src/components/Quiz/QuizHeader.tsx | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 83c997b..ba857d3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Piano Trainer", - "version": "1.0.6" + "version": "1.0.7" }, "tauri": { "allowlist": { diff --git a/src/components/Quiz/Quiz.tsx b/src/components/Quiz/Quiz.tsx index 30103e1..66b6f64 100644 --- a/src/components/Quiz/Quiz.tsx +++ b/src/components/Quiz/Quiz.tsx @@ -342,9 +342,23 @@ const Quiz = () => { { + 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) diff --git a/src/components/Quiz/QuizHeader.tsx b/src/components/Quiz/QuizHeader.tsx index d581b02..d39a59b 100644 --- a/src/components/Quiz/QuizHeader.tsx +++ b/src/components/Quiz/QuizHeader.tsx @@ -55,7 +55,7 @@ const QuizHeader = () => { > -

Quiz Mode

+

Quiz

setIsOpen?.(true)}>