Skip to content

Commit

Permalink
Restore timer for Snap, Instructions shown by default (#25)
Browse files Browse the repository at this point in the history
* Restore timer for Snap, Instructions shown by default

* Bump version
  • Loading branch information
yell0wsuit authored Dec 22, 2024
1 parent dc4a558 commit 8a30d65
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "yell0wsuit",
"description": "An English-learning interactive tool written in React, designed to help learners practice speaking and listening",
"private": true,
"version": "3.0.4",
"version": "3.0.5",
"type": "module",
"main": "main.cjs",
"license": "Apache-2.0",
Expand Down
3 changes: 3 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,19 @@
"snap": {
"reading-phonetics": [
"Does the phonetic transcription match the word? Select “Yes” if the two match, or “No” if not.",
"Can you complete the game before the timer runs out?",
"When you want to stop, select “Quit” to see your score in this session."
],
"homophones": [
"Look at the two words. Are they pronounced the same or different?",
"Select “Yes” if you think the pronunciation is the same, and “No” if you think it's different.",
"Can you complete the game before the timer runs out?",
"When you want to stop, select “Quit” to see your score in this session."
],
"random": [
"Look at the two words. Do they match or not? Either the pronunciation should be the same, or the phonetic transcription should match the word.",
"Select “Yes” if they match, or “No” if not.",
"Can you complete the game before the timer runs out?",
"When you want to stop, select “Quit” to see your score in this session."
]
},
Expand Down
15 changes: 9 additions & 6 deletions src/components/exercise_page/ExerciseDetailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ const ExerciseDetailPage = ({ heading, id, title, accent, file, onBack }) => {
const handleExerciseData = useCallback(
(exerciseDetails, data, exerciseKey) => {
const savedSettings = JSON.parse(localStorage.getItem("ispeaker"));
const fixedTimers = {
memory_match: 4,
snap: 2,
};
const timerValue =
exerciseKey === "memory_match"
? savedSettings?.timerSettings?.memory_match || 4 // Use a default value for memory match
: (savedSettings?.timerSettings?.enabled === true &&
savedSettings?.timerSettings?.[exerciseKey]) ||
0; // For other exercises
fixedTimers[exerciseKey] ??
((savedSettings?.timerSettings?.enabled === true &&
savedSettings?.timerSettings?.[exerciseKey]) ||
0);

setTimer(timerValue);

Expand Down Expand Up @@ -363,7 +366,7 @@ const ExerciseDetailPage = ({ heading, id, title, accent, file, onBack }) => {
</button>

<div className="collapse collapse-arrow hidden bg-base-200 md:grid dark:bg-slate-700">
<input type="checkbox" />
<input type="checkbox" defaultChecked />
<button
type="button"
className="collapse-title text-start font-semibold"
Expand Down
2 changes: 0 additions & 2 deletions src/components/setting_page/ExerciseTimer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const defaultTimerSettings = {
sound_n_spelling: 5,
sorting: 5,
odd_one_out: 5,
snap: 5,
};

const ExerciseTimer = () => {
Expand Down Expand Up @@ -100,7 +99,6 @@ const ExerciseTimer = () => {
sound_n_spelling: t("exercise_page.soundSpellingHeading"),
sorting: t("exercise_page.sortingHeading"),
odd_one_out: t("exercise_page.oddOneOutHeading"),
snap: t("exercise_page.snapHeading"),
};

return (
Expand Down

0 comments on commit 8a30d65

Please sign in to comment.