'use client'; import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; import { Target, FlaskConical, Sparkles, Play, Pause, X } from 'lucide-react'; import { fmt } from '@/lib/game/store'; import { formatStudyTime } from '@/lib/game/formatting'; import type { EquipmentInstance, EnchantmentDesign } from '@/lib/game/types'; interface CraftingProgressProps { designProgress: { designId: string; progress: number; required: number } | null; preparationProgress: { equipmentInstanceId: string; progress: number; required: number; manaCostPaid: number } | null; applicationProgress: { equipmentInstanceId: string; designId: string; progress: number; required: number; manaPerHour: number; paused: boolean } | null; equipmentInstances: Record; enchantmentDesigns: EnchantmentDesign[]; cancelDesign: () => void; cancelPreparation: () => void; pauseApplication: () => void; resumeApplication: () => void; cancelApplication: () => void; } export function CraftingProgress({ designProgress, preparationProgress, applicationProgress, equipmentInstances, enchantmentDesigns, cancelDesign, cancelPreparation, pauseApplication, resumeApplication, cancelApplication, }: CraftingProgressProps) { const progressSections: React.ReactNode[] = []; // Design progress if (designProgress) { const progressPct = Math.min(100, (designProgress.progress / designProgress.required) * 100); progressSections.push(
Designing Enchantment
{formatStudyTime(designProgress.progress)} / {formatStudyTime(designProgress.required)} Design Time
); } // Preparation progress if (preparationProgress) { const progressPct = Math.min(100, (preparationProgress.progress / preparationProgress.required) * 100); const instance = equipmentInstances[preparationProgress.equipmentInstanceId]; progressSections.push(
Preparing {instance?.name || 'Equipment'}
{formatStudyTime(preparationProgress.progress)} / {formatStudyTime(preparationProgress.required)} Mana spent: {fmt(preparationProgress.manaCostPaid)}
); } // Application progress if (applicationProgress) { const progressPct = Math.min(100, (applicationProgress.progress / applicationProgress.required) * 100); const instance = equipmentInstances[applicationProgress.equipmentInstanceId]; const design = enchantmentDesigns.find(d => d.id === applicationProgress.designId); progressSections.push(
Enchanting {instance?.name || 'Equipment'}
{applicationProgress.paused ? ( ) : ( )}
{formatStudyTime(applicationProgress.progress)} / {formatStudyTime(applicationProgress.required)} Mana/hr: {fmt(applicationProgress.manaPerHour)}
{design && (
Applying: {design.name}
)}
); } return progressSections.length > 0 ? (
{progressSections}
) : null; }