diff --git a/messages/en-US.json b/messages/en-US.json index 2e63b84..f1b629d 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -94,7 +94,6 @@ "reverse": "Reverse", "dictation": "Dictation", "noTextPairs": "No text pairs available", - "progress": "{current}/{total}", "disorder": "Disorder", "previous": "Previous" }, diff --git a/messages/zh-CN.json b/messages/zh-CN.json index b5cd9c7..bdaa5fb 100644 --- a/messages/zh-CN.json +++ b/messages/zh-CN.json @@ -98,7 +98,6 @@ "reverse": "反向", "dictation": "听写", "noTextPairs": "没有可用的文本对", - "progress": "{current}/{total}", "disorder": "乱序", "previous": "上一个" }, diff --git a/src/app/(features)/memorize/Memorize.tsx b/src/app/(features)/memorize/Memorize.tsx index 3c095db..c100718 100644 --- a/src/app/(features)/memorize/Memorize.tsx +++ b/src/app/(features)/memorize/Memorize.tsx @@ -10,6 +10,7 @@ import { getTTSAudioUrl } from "@/lib/browser/tts"; import { VOICES } from "@/config/locales"; import { useTranslations } from "next-intl"; import localFont from "next/font/local"; +import { isNonNegativeInteger } from "@/lib/utils"; const myFont = localFont({ src: "../../../../public/fonts/NotoNaskhArabic-VariableFont_wght.ttf", @@ -51,11 +52,22 @@ const Memorize: React.FC = ({ textPairs }) => {
-
- {t("progress", { - current: index + 1, - total: getTextPairs().length, - })} +
{ + const newIndex = prompt("Input a index number.")?.trim(); + if ( + newIndex && + isNonNegativeInteger(newIndex) && + parseInt(newIndex) <= textPairs.length && + parseInt(newIndex) > 0 + ) { + setIndex(parseInt(newIndex) - 1); + } + }} + > + {index + 1} + {"/" + getTextPairs().length}
{dictation ? ( show === "question" ? (