添加记忆上一个
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2025-11-22 09:16:51 +08:00
parent bc0dab64c6
commit baf7265bf8
3 changed files with 21 additions and 7 deletions

View File

@@ -89,13 +89,14 @@
"folderInfo": "{id}. {name} ({count})"
},
"memorize": {
"showAnswer": "Show Answer",
"answer": "Answer",
"next": "Next",
"reverse": "Reverse",
"dictation": "Dictation",
"noTextPairs": "No text pairs available",
"progress": "{current}/{total}",
"disorder": "Disorder"
"disorder": "Disorder",
"previous": "Previous"
},
"page": {
"unauthorized": "You are not authorized to access this folder"

View File

@@ -93,13 +93,14 @@
"folderInfo": "{id}. {name} ({count})"
},
"memorize": {
"showAnswer": "显示答案",
"answer": "答案",
"next": "下一个",
"reverse": "反向",
"dictation": "听写",
"noTextPairs": "没有可用的文本对",
"progress": "{current}/{total}",
"disorder": "乱序"
"disorder": "乱序",
"previous": "上一个"
},
"page": {
"unauthorized": "您无权访问该文件夹"

View File

@@ -48,7 +48,9 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
<Container className="p-6 flex flex-col gap-8 h-96 justify-center items-center">
{(getTextPairs().length > 0 && (
<>
<div className={`h-36 flex flex-col gap-2 justify-start items-center ${myFont.className} text-3xl`}>
<div
className={`h-36 flex flex-col gap-2 justify-start items-center ${myFont.className} text-3xl`}
>
<div className="text-sm text-gray-500">
{t("progress", {
current: index + 1,
@@ -91,7 +93,7 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
</div>
<div className="flex flex-row gap-2 items-center justify-center">
<LightButton
className="w-32"
className="w-20"
onClick={async () => {
if (show === "answer") {
const newIndex = (index + 1) % getTextPairs().length;
@@ -114,7 +116,17 @@ const Memorize: React.FC<MemorizeProps> = ({ textPairs }) => {
setShow(show === "question" ? "answer" : "question");
}}
>
{show === "question" ? t("showAnswer") : t("next")}
{show === "question" ? t("answer") : t("next")}
</LightButton>
<LightButton
onClick={() => {
setIndex(
(index - 1 + getTextPairs().length) % getTextPairs().length,
);
setShow("question");
}}
>
{t("previous")}
</LightButton>
<LightButton
onClick={() => {