dramaling-vocab-learning/frontend/lib/mock/reviewMockData.ts

115 lines
3.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Mock 數據用於複習功能測試
import { ExtendedFlashcard } from '@/lib/types/review'
export const mockDueCards: ExtendedFlashcard[] = [
{
// 基礎 Flashcard 欄位
id: 'mock-1',
word: 'hello',
translation: '你好',
definition: 'used as a greeting or to begin a phone conversation',
partOfSpeech: 'interjection',
pronunciation: '/həˈloʊ/',
example: 'Hello, how are you today?',
exampleTranslation: '你好,你今天好嗎?',
masteryLevel: 0,
timesReviewed: 0,
isFavorite: false,
nextReviewDate: '2025-10-03T00:00:00Z',
cefr: 'A1',
createdAt: '2024-01-01T00:00:00Z',
updatedAt: '2024-01-01T00:00:00Z',
// 圖片相關欄位
exampleImages: [],
hasExampleImage: false,
primaryImageUrl: undefined,
// ExtendedFlashcard 的額外欄位
synonyms: ['hi', 'greetings'],
reviewCount: 0,
lastReviewDate: undefined,
successRate: 0
},
{
// 基礎 Flashcard 欄位
id: 'mock-2',
word: 'beautiful',
translation: '美麗的',
definition: 'pleasing the senses or mind aesthetically',
partOfSpeech: 'adjective',
pronunciation: '/ˈbjuːtɪfl/',
example: 'She has a beautiful smile.',
exampleTranslation: '她有一個美麗的笑容。',
masteryLevel: 1,
timesReviewed: 2,
isFavorite: true,
nextReviewDate: '2025-10-03T00:00:00Z',
cefr: 'A2',
createdAt: '2024-01-02T00:00:00Z',
updatedAt: '2024-01-02T00:00:00Z',
// 圖片相關欄位
exampleImages: [],
hasExampleImage: false,
primaryImageUrl: undefined,
// ExtendedFlashcard 的額外欄位
synonyms: ['pretty', 'lovely', 'gorgeous'],
reviewCount: 2,
lastReviewDate: '2024-01-01T12:00:00Z',
successRate: 0.8
},
{
// 基礎 Flashcard 欄位
id: 'mock-3',
word: 'important',
translation: '重要的',
definition: 'of great significance or value',
partOfSpeech: 'adjective',
pronunciation: '/ɪmˈːrtənt/',
example: 'It is important to study hard.',
exampleTranslation: '努力學習是很重要的。',
masteryLevel: 2,
timesReviewed: 5,
isFavorite: false,
nextReviewDate: '2025-10-03T00:00:00Z',
cefr: 'B1',
createdAt: '2024-01-03T00:00:00Z',
updatedAt: '2024-01-03T00:00:00Z',
// 圖片相關欄位
exampleImages: [],
hasExampleImage: false,
primaryImageUrl: undefined,
// ExtendedFlashcard 的額外欄位
synonyms: ['significant', 'crucial', 'vital'],
reviewCount: 5,
lastReviewDate: '2024-01-02T15:30:00Z',
successRate: 0.9
}
]
// Mock 已完成的測驗數據
export const mockCompletedTests = [
// 空數組表示沒有已完成的測驗
]
// 檢查是否啟用測試模式
export const isTestMode = () => {
if (typeof window === 'undefined') return false
return process.env.NODE_ENV === 'development' &&
window.location.search.includes('test=true')
}
// 測試模式下的簡化 CEFR 邏輯
export const getTestModeReviewTypes = (_userCEFR: string, _wordCEFR: string): string[] => {
// 🧪 測試模式:只返回兩種最基本的測驗類型
console.log('🧪 [測試模式] 使用簡化的測驗類型分配')
return ['flip-memory', 'vocab-choice']
}
// 獲取 Mock 數據的函數
export const getMockDueCards = () => mockDueCards
export const getMockCompletedTests = () => mockCompletedTests