Skip to content

Commit 1b960f7

Browse files
committed
wip: test
1 parent ec69743 commit 1b960f7

24 files changed

Lines changed: 170 additions & 70 deletions

File tree

apps/nuxt/app/components/practice-words-v2/FooterV2.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const status = computed(() => {
5959
const step = node.steps[cursor.stepIndex]
6060
const stepLabel = step?.label ?? step?.templateId ?? ''
6161
if (nodes.length === 1 && nodes[0].steps.length === 1) return config.label
62-
return node.label + (stepLabel ? ' · ' + stepLabel : '')
62+
return $t(node.label) + (stepLabel ? ' · ' + $t(stepLabel) : '')
6363
})
6464
6565
/**
@@ -107,7 +107,7 @@ const stages = computed(() => {
107107
const isCurrentStep = si === stepIndex
108108
const isCompletedStep = si < stepIndex
109109
return {
110-
name: step.label ?? step.templateId,
110+
name: $t(step.label ?? step.templateId),
111111
ratio: Math.floor(100 / node.steps.length),
112112
percentage: isCompletedStep ? 100 : isCurrentStep ? currentProgress : 0,
113113
active: isCurrentStep,
@@ -116,7 +116,7 @@ const stages = computed(() => {
116116
: undefined
117117
118118
return {
119-
name: node.label,
119+
name: $t(node.label),
120120
ratio: nodeRatio,
121121
percentage: isCompleted ? 100 : isCurrentNode ? currentProgress : 0,
122122
active: isCurrentNode,

apps/nuxt/app/composables/practice-words/practice-flow-config.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export const GROUP_SIZE = PRACTICE_WORD_GROUP_SIZE
1515
export const CURRENT_FLOW_VERSION = 6
1616

1717
export const STEP_TEMPLATE_META: Record<PracticeStepTemplateId, PracticeStepTemplate> = {
18-
followWrite: { id: 'followWrite', label: '跟写', practiceType: WordPracticeType.FollowWrite },
19-
spell: { id: 'spell', label: '拼写', practiceType: WordPracticeType.Spell },
20-
listen: { id: 'listen', label: '听写', practiceType: WordPracticeType.Listen },
21-
dictation: { id: 'dictation', label: '默写', practiceType: WordPracticeType.Dictation },
22-
identify: { id: 'identify', label: '自测', practiceType: WordPracticeType.Identify },
18+
followWrite: { id: 'followWrite', label: 'followWrite', practiceType: WordPracticeType.FollowWrite },
19+
spell: { id: 'spell', label: 'spell', practiceType: WordPracticeType.Spell },
20+
listen: { id: 'listen', label: 'listen', practiceType: WordPracticeType.Listen },
21+
dictation: { id: 'dictation', label: 'dictation', practiceType: WordPracticeType.Dictation },
22+
identify: { id: 'identify', label: 'identify', practiceType: WordPracticeType.Identify },
2323
}
2424

2525
export function materializeWordAdvance(config?: PracticeWordAdvanceConfig): WordAdvanceRule {
@@ -58,11 +58,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
5858
id: 'system',
5959
version: CURRENT_FLOW_VERSION,
6060
mode: WordPracticeMode.System,
61-
label: '学习',
61+
label: 'smart_learning',
6262
nodes: [
6363
{
6464
id: 'new',
65-
label: '新词',
65+
label: 'new_words',
6666
source: 'taskNew',
6767
steps: [
6868
{
@@ -85,7 +85,7 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
8585
},
8686
{
8787
id: 'review',
88-
label: '复习',
88+
label: 'review',
8989
source: 'taskReview',
9090
steps: [
9191
{
@@ -113,11 +113,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
113113
id: 'free',
114114
version: CURRENT_FLOW_VERSION,
115115
mode: WordPracticeMode.Free,
116-
label: '自由练习',
116+
label: 'free_practice',
117117
nodes: [
118118
{
119119
id: 'practice',
120-
label: '自由练习',
120+
label: 'free_practice',
121121
source: 'current',
122122
steps: [
123123
{
@@ -137,11 +137,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
137137
id: 'review',
138138
version: CURRENT_FLOW_VERSION,
139139
mode: WordPracticeMode.Review,
140-
label: '复习',
140+
label: 'review',
141141
nodes: [
142142
{
143143
id: 'review',
144-
label: '复习',
144+
label: 'review',
145145
source: 'taskReview',
146146
steps: [
147147
{
@@ -169,11 +169,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
169169
id: 'identifyOnly',
170170
version: CURRENT_FLOW_VERSION,
171171
mode: WordPracticeMode.IdentifyOnly,
172-
label: '自测',
172+
label: 'identify',
173173
nodes: [
174174
{
175175
id: 'new',
176-
label: '新词',
176+
label: 'new_words',
177177
source: 'taskNew',
178178
steps: [
179179
{
@@ -184,7 +184,7 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
184184
},
185185
{
186186
id: 'review',
187-
label: '复习',
187+
label: 'review',
188188
source: 'taskReview',
189189
steps: [
190190
{
@@ -202,11 +202,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
202202
id: 'dictationOnly',
203203
version: CURRENT_FLOW_VERSION,
204204
mode: WordPracticeMode.DictationOnly,
205-
label: '默写',
205+
label: 'dictation',
206206
nodes: [
207207
{
208208
id: 'new',
209-
label: '新词',
209+
label: 'new_words',
210210
source: 'taskNew',
211211
steps: [
212212
{
@@ -218,7 +218,7 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
218218
},
219219
{
220220
id: 'review',
221-
label: '复习',
221+
label: 'review',
222222
source: 'taskReview',
223223
steps: [
224224
{
@@ -237,11 +237,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
237237
id: 'listenOnly',
238238
version: CURRENT_FLOW_VERSION,
239239
mode: WordPracticeMode.ListenOnly,
240-
label: '听写',
240+
label: 'listen',
241241
nodes: [
242242
{
243243
id: 'new',
244-
label: '新词',
244+
label: 'new_words',
245245
source: 'taskNew',
246246
steps: [
247247
{
@@ -253,7 +253,7 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
253253
},
254254
{
255255
id: 'review',
256-
label: '复习',
256+
label: 'review',
257257
source: 'taskReview',
258258
steps: [
259259
{
@@ -272,11 +272,11 @@ export const BUILTIN_FLOWS: Record<string, PracticeFlowConfig> = {
272272
id: 'shuffle',
273273
version: CURRENT_FLOW_VERSION,
274274
mode: WordPracticeMode.Shuffle,
275-
label: '随机复习',
275+
label: 'random_review',
276276
nodes: [
277277
{
278278
id: 'practice',
279-
label: '随机复习',
279+
label: 'random_review',
280280
source: 'taskReview',
281281
steps: [
282282
{

apps/nuxt/app/composables/practice-words/usePracticeIdleTimer.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ import { ref } from 'vue'
1010
import type { Ref } from 'vue'
1111
import { Toast } from '@typewords/base'
1212

13+
export function canAutoResumeVisibilityTimer(timer: {
14+
timerPaused: boolean
15+
timerPauseReason: string | null
16+
}) {
17+
return timer.timerPaused && timer.timerPauseReason === 'auto_visibility'
18+
}
19+
1320
export function usePracticeIdleTimer(options: {
1421
isFocus: Ref<boolean>
1522
statStore: {

apps/nuxt/app/pages/(words)/practice-words-v2/[id].vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ import { useGetGradeByWrongTimes, useNextCard } from '@typewords/core/hooks/fsrs
5050
import WordMarkPickList, { type WordMarkPickResult } from '@typewords/core/components/word/WordMarkPickList.vue'
5151
import { buildQuestion } from '@typewords/core/utils/word-test.ts'
5252
import type { PracticeSessionSnapshot } from '~/composables/practice-words/practice-flow-types.ts'
53-
import { usePracticeIdleTimer } from '~/composables/practice-words/usePracticeIdleTimer.ts'
53+
import {
54+
canAutoResumeVisibilityTimer,
55+
usePracticeIdleTimer,
56+
} from '~/composables/practice-words/usePracticeIdleTimer.ts'
5457
5558
const { isWordSimple, toggleWordSimple } = useWordOptions()
5659
const settingStore = useSettingStore()
@@ -196,11 +199,12 @@ function clearVisibilityResumeTimer() {
196199
function scheduleVisibilityResume() {
197200
clearVisibilityResumeTimer()
198201
if (document.hidden || showRemoteReloadDialog) return
199-
if (statStore.timerPaused && statStore.timerPauseReason === 'auto_visibility') {
202+
if (canAutoResumeVisibilityTimer(statStore)) {
200203
// 特意延迟提示用户,让用户看到,免得用户焦虑,以为没暂停。
201204
visibilityResumeTimer = setTimeout(() => {
202205
visibilityResumeTimer = null
203206
if (document.hidden || showRemoteReloadDialog) return
207+
if (!canAutoResumeVisibilityTimer(statStore)) return
204208
statStore.resumeTimer()
205209
Toast.success('已自动恢复计时')
206210
}, 1500)

apps/nuxt/i18n/i18n.xlsx

627 Bytes
Binary file not shown.

apps/nuxt/i18n/locales/de.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"more": "Mehr",
4747
"loading": "Laden",
4848
"introduction": "Einführung",
49-
"learn": "Lernen",
49+
"learn": "Learn",
5050
"practice": "Üben",
5151
"test": "Test",
5252
"feedback": "Feedback",
@@ -805,5 +805,10 @@
805805
"expand_detail_settings": "展开详细设置",
806806
"sentence_pronunciation": "例句发音",
807807
"sentence_volume": "例句音量",
808-
"sentence_speed": "例句倍速"
808+
"sentence_speed": "例句倍速",
809+
"followWrite": "Follow Write",
810+
"spell": "Spell",
811+
"listen": "Listen",
812+
"dictation": "Dictation",
813+
"identify": "Identify"
809814
}

apps/nuxt/i18n/locales/en.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,5 +805,10 @@
805805
"expand_detail_settings": "展开详细设置",
806806
"sentence_pronunciation": "例句发音",
807807
"sentence_volume": "例句音量",
808-
"sentence_speed": "例句倍速"
808+
"sentence_speed": "例句倍速",
809+
"followWrite": "Follow Write",
810+
"spell": "Spell",
811+
"listen": "Listen",
812+
"dictation": "Dictation",
813+
"identify": "Identify"
809814
}

apps/nuxt/i18n/locales/es.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"more": "Más",
4747
"loading": "Cargando",
4848
"introduction": "Introducción",
49-
"learn": "Aprender",
49+
"learn": "Learn",
5050
"practice": "Practicar",
5151
"test": "Prueba",
5252
"feedback": "Comentarios",
@@ -805,5 +805,10 @@
805805
"expand_detail_settings": "展开详细设置",
806806
"sentence_pronunciation": "例句发音",
807807
"sentence_volume": "例句音量",
808-
"sentence_speed": "例句倍速"
808+
"sentence_speed": "例句倍速",
809+
"followWrite": "Follow Write",
810+
"spell": "Spell",
811+
"listen": "Listen",
812+
"dictation": "Dictation",
813+
"identify": "Identify"
809814
}

apps/nuxt/i18n/locales/fr.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"more": "Plus",
4747
"loading": "Chargement",
4848
"introduction": "Introduction",
49-
"learn": "Apprendre",
49+
"learn": "Learn",
5050
"practice": "Pratiquer",
5151
"test": "Test",
5252
"feedback": "Retour",
@@ -805,5 +805,10 @@
805805
"expand_detail_settings": "展开详细设置",
806806
"sentence_pronunciation": "例句发音",
807807
"sentence_volume": "例句音量",
808-
"sentence_speed": "例句倍速"
808+
"sentence_speed": "例句倍速",
809+
"followWrite": "Follow Write",
810+
"spell": "Spell",
811+
"listen": "Listen",
812+
"dictation": "Dictation",
813+
"identify": "Identify"
809814
}

apps/nuxt/i18n/locales/id.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"more": "Lebih",
4747
"loading": "Memuat",
4848
"introduction": "Pengantar",
49-
"learn": "Belajar",
49+
"learn": "Learn",
5050
"practice": "Latihan",
5151
"test": "Tes",
5252
"feedback": "Umpan balik",
@@ -805,5 +805,10 @@
805805
"expand_detail_settings": "展开详细设置",
806806
"sentence_pronunciation": "例句发音",
807807
"sentence_volume": "例句音量",
808-
"sentence_speed": "例句倍速"
808+
"sentence_speed": "例句倍速",
809+
"followWrite": "Follow Write",
810+
"spell": "Spell",
811+
"listen": "Listen",
812+
"dictation": "Dictation",
813+
"identify": "Identify"
809814
}

0 commit comments

Comments
 (0)