import { CardState } from '../data' interface SimpleProgressProps { current: number total: number score: { correct: number; total: number } cards?: CardState[] // 可選:用於顯示延遲統計 } export function SimpleProgress({ current, total, score, cards }: 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}
)}
) }