import { CardState } from '../data'
interface SimpleProgressProps {
current: number
total: number
score: { correct: number; total: number }
cards?: CardState[] // 可選:用於顯示延遲統計
sortedCards?: CardState[] // 智能排序後的卡片
currentCard?: CardState // 當前正在練習的卡片
}
export function SimpleProgress({ current, total, score, cards, sortedCards, currentCard }: SimpleProgressProps) {
const progress = (current - 1) / total * 100
const accuracy = score.total > 0 ? Math.round((score.correct / score.total) * 100) : 0
// 延遲統計計算
const delayStats = cards ? {
totalSkips: cards.reduce((sum, card) => sum + card.skipCount, 0),
totalWrongs: cards.reduce((sum, card) => sum + card.wrongCount, 0),
delayedCards: cards.filter(card => card.skipCount + card.wrongCount > 0).length
} : null
return (
學習進度
{current}/{total}
{score.total > 0 && (
準確率 {accuracy}%
)}
{/* 進度條 */}
{/* 詳細統計 */}
{score.total > 0 && (
<>
答對 {score.correct}
答錯 {score.total - score.correct}
>
)}
{/* 延遲統計 */}
{delayStats && (delayStats.totalSkips > 0 || delayStats.totalWrongs > 0) && (
<>
{score.total > 0 &&
|}
跳過次數 {delayStats.totalSkips}
跳過卡片 {delayStats.delayedCards}
>
)}
{/* 詞彙順序可視化 - 便於驗證延遲計數系統 */}
{sortedCards && currentCard && (
詞彙順序 (按延遲分數排序):
{sortedCards.map((card, index) => {
const isCompleted = card.isCompleted
const delayScore = card.skipCount + card.wrongCount
// 狀態顏色
let cardStyle = ''
let statusText = ''
if (isCompleted) {
cardStyle = 'bg-green-100 text-green-700 border-green-300'
statusText = '✓'
} else if (delayScore > 0) {
if (card.skipCount > 0 && card.wrongCount > 0) {
cardStyle = 'bg-red-100 text-red-700 border-red-300'
statusText = `跳${card.skipCount}錯${card.wrongCount}`
} else if (card.skipCount > 0) {
cardStyle = 'bg-yellow-100 text-yellow-700 border-yellow-300'
statusText = `跳${card.skipCount}`
} else {
cardStyle = 'bg-orange-100 text-orange-700 border-orange-300'
statusText = `錯${card.wrongCount}`
}
} else {
cardStyle = 'bg-gray-100 text-gray-600 border-gray-300'
statusText = ''
}
return (
{index + 1}.
{card.word}
{statusText && (
({statusText})
)}
)
})}
🟢完成、🟡跳過、🟠答錯、🔴跳過+答錯、⚪未開始
)}
)
}