From d0fc6664f282e06f791be8366c6f76f5fa1d9b58 Mon Sep 17 00:00:00 2001
From: Richard Wong
Date: Sat, 10 Jan 2026 13:00:27 +0800
Subject: [PATCH] feat: added live validation toggle
---
public/locales/en/translation.json | 6 +++--
public/locales/kn/translation.json | 6 +++--
src/VerseSampler.jsx | 32 +++++++++++++++++++---
src/VerseValidator.jsx | 43 +++++++++++++-----------------
4 files changed, 55 insertions(+), 32 deletions(-)
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index a0dd9ca..07be8ba 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -10,8 +10,10 @@
"set_shuffle": "Set Shuffle:",
"note_set_shuffle": "(Otherwise cards will appear in sequential order)",
"hide_reference": "Set Hide Reference:",
- "note_hide_reference": "(If you also want to test the verse reference)",
- "pick_pack": "Pick Your Packs:",
+ "note_hide_reference": "Check this box to hide the verse reference and test your memory on the reference as well.",
+ "live_validation": "Enable live validation",
+ "note_live_validation": "Check this box to enable live validation feedback as you type. Uncheck to only show correctness upon completion.",
+ "pick_pack": "Pick your pack(s)",
"shuffle_card": "Shuffle Cards:",
"verses": "Verses:"
},
diff --git a/public/locales/kn/translation.json b/public/locales/kn/translation.json
index 473d0cc..30ebddd 100644
--- a/public/locales/kn/translation.json
+++ b/public/locales/kn/translation.json
@@ -10,8 +10,10 @@
"set_shuffle": "무작위 설정:",
"note_set_shuffle": "(Otherwise cards will appear in sequential order)",
"hide_reference": "Set Hide Reference:",
- "note_hide_reference": "(If you also want to test the verse reference)",
- "pick_pack": "Pick Your Packs:",
+ "note_hide_reference": "Check this box to hide the verse reference and test your memory on the reference as well.",
+ "live_validation": "Enable live validation",
+ "note_live_validation": "Check this box to enable live validation feedback as you type. Uncheck to only show correctness upon completion.",
+ "pick_pack": "Pick your pack(s)",
"shuffle_card": "Shuffle Cards:",
"verses": "Verses:"
},
diff --git a/src/VerseSampler.jsx b/src/VerseSampler.jsx
index 0867c36..06ff346 100644
--- a/src/VerseSampler.jsx
+++ b/src/VerseSampler.jsx
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
import logo from './assets/droplet.svg';
import { Suspense } from "react";
-const GenerateTestList = ({ VerseData, packs, testCount, toShuffle, toHideReference, translate}) => {
+const GenerateTestList = ({ VerseData, packs, testCount, toShuffle, toHideReference, liveValidation, translate}) => {
let testList = packs.reduce(
// grab all elements included checked in "packs"
(accumulator, currentValue) => accumulator.concat(VerseData[currentValue]),
@@ -26,18 +26,20 @@ const GenerateTestList = ({ VerseData, packs, testCount, toShuffle, toHideRefere
)
}
-const ArrayTester = ({ array, toHideReference, translate}) => {
+const ArrayTester = ({ array, toHideReference, liveValidation, translate}) => {
const list = array.map((element, index) => (
// key needs to be unique; chose 3 elements that will separate all elements
@@ -201,6 +203,14 @@ function Page() {
setHideReference(!toHideReference);
};
+ // state for liveValidation
+ const [liveValidation, setLiveValidation] = useState(true);
+ // Function to handle checkbox change
+ const handleLiveValidationCheckboxChange = () => {
+ // Toggle the state when the checkbox is changed
+ setLiveValidation(!liveValidation);
+ };
+
@@ -250,7 +260,7 @@ function Page() {
{!(toShuffle || toReview) ?
<>