'use client'; import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; import { BookOpen, X } from 'lucide-react'; import { SPELLS_DEF } from '@/lib/game/constants'; import { formatStudyTime } from '@/lib/game/utils/formatting'; import type { StudyTarget } from '@/lib/game/types'; interface StudyProgressProps { currentStudyTarget: StudyTarget | null; skills: Record; studySpeedMult: number; cancelStudy: () => void; } export function StudyProgress({ currentStudyTarget, skills, studySpeedMult, cancelStudy, }: StudyProgressProps) { if (!currentStudyTarget) return null; const target = currentStudyTarget; const progressPct = Math.min(100, (target.progress / target.required) * 100); const isSkill = target.type === 'skill'; const def = isSkill ? undefined : SPELLS_DEF[target.id]; const currentLevel = isSkill ? (skills[target.id] || 0) : 0; return (
{def?.name ?? target.id} {isSkill && ` Lv.${currentLevel + 1}`}
{formatStudyTime(target.progress)} / {formatStudyTime(target.required)} {studySpeedMult.toFixed(1)}x speed
); } StudyProgress.displayName = "StudyProgress";