背单词可以设置索引
This commit is contained in:
@@ -94,7 +94,6 @@
|
|||||||
"reverse": "Reverse",
|
"reverse": "Reverse",
|
||||||
"dictation": "Dictation",
|
"dictation": "Dictation",
|
||||||
"noTextPairs": "No text pairs available",
|
"noTextPairs": "No text pairs available",
|
||||||
"progress": "{current}/{total}",
|
|
||||||
"disorder": "Disorder",
|
"disorder": "Disorder",
|
||||||
"previous": "Previous"
|
"previous": "Previous"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -98,7 +98,6 @@
|
|||||||
"reverse": "反向",
|
"reverse": "反向",
|
||||||
"dictation": "听写",
|
"dictation": "听写",
|
||||||
"noTextPairs": "没有可用的文本对",
|
"noTextPairs": "没有可用的文本对",
|
||||||
"progress": "{current}/{total}",
|
|
||||||
"disorder": "乱序",
|
"disorder": "乱序",
|
||||||
"previous": "上一个"
|
"previous": "上一个"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { getTTSAudioUrl } from "@/lib/browser/tts";
|
|||||||
import { VOICES } from "@/config/locales";
|
import { VOICES } from "@/config/locales";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import localFont from "next/font/local";
|
import localFont from "next/font/local";
|
||||||
|
import { isNonNegativeInteger } from "@/lib/utils";
|
||||||
|
|
||||||
const myFont = localFont({
|
const myFont = localFont({
|
||||||
src: "../../../../public/fonts/NotoNaskhArabic-VariableFont_wght.ttf",
|
src: "../../../../public/fonts/NotoNaskhArabic-VariableFont_wght.ttf",
|
||||||
@@ -51,11 +52,22 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
|
|||||||
<div
|
<div
|
||||||
className={`h-36 flex flex-col gap-2 justify-start items-center ${myFont.className} text-3xl`}
|
className={`h-36 flex flex-col gap-2 justify-start items-center ${myFont.className} text-3xl`}
|
||||||
>
|
>
|
||||||
<div className="text-sm text-gray-500">
|
<div
|
||||||
{t("progress", {
|
className="text-sm text-gray-500"
|
||||||
current: index + 1,
|
onClick={() => {
|
||||||
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}
|
||||||
</div>
|
</div>
|
||||||
{dictation ? (
|
{dictation ? (
|
||||||
show === "question" ? (
|
show === "question" ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user