'use client' import { motion } from 'motion/react' import { cn } from '@/lib/utils' import { Check, Loader2, AlertCircle, RotateCcw } from 'lucide-react' import { DESIGN_PHASES, designPhases, type DesignPhase, type PhaseStatus } from '@/types/design-thinking' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' interface PhaseNavigatorProps { currentPhase: DesignPhase phaseStatuses: Record onPhaseClick?: (phase: DesignPhase) => void onLoopBack?: (fromPhase: DesignPhase, toPhase: DesignPhase) => void className?: string variant?: 'horizontal' | 'compact' } const colorMap: Record = { purple: { bg: 'bg-purple-500/10', border: 'border-purple-500/50', text: 'text-purple-500', ring: 'ring-purple-500/30' }, blue: { bg: 'bg-blue-500/10', border: 'border-blue-500/50', text: 'text-blue-500', ring: 'ring-blue-500/30' }, amber: { bg: 'bg-amber-500/10', border: 'border-amber-500/50', text: 'text-amber-500', ring: 'ring-amber-500/30' }, orange: { bg: 'bg-orange-500/10', border: 'border-orange-500/50', text: 'text-orange-500', ring: 'ring-orange-500/30' }, emerald: { bg: 'bg-emerald-500/10', border: 'border-emerald-500/50', text: 'text-emerald-500', ring: 'ring-emerald-500/30' }, } export function PhaseNavigator({ currentPhase, phaseStatuses, onPhaseClick, onLoopBack, className, variant = 'horizontal' }: PhaseNavigatorProps) { const currentIndex = DESIGN_PHASES.indexOf(currentPhase) const progress = ((currentIndex + 1) / DESIGN_PHASES.length) * 100 const getStatusIcon = (status: PhaseStatus) => { switch (status) { case 'completed': return case 'in_progress': return case 'blocked': case 'needs_review': return default: return null } } return (
{/* Progress bar */}
{/* Phase nodes */}
{designPhases.map((phase, index) => { const status = phaseStatuses[phase.id] const isCurrent = phase.id === currentPhase const isCompleted = status === 'completed' const isBlocked = status === 'blocked' || status === 'needs_review' const colors = colorMap[phase.color] return (
{/* Connector line */} {index > 0 && (
)} {/* Phase node */} onPhaseClick?.(phase.id)} className={cn( 'relative w-12 h-12 rounded-full flex items-center justify-center text-xl transition-all duration-300 border-2', isCurrent && `${colors.bg} ${colors.border} ring-4 ${colors.ring}`, isCompleted && 'bg-emerald-500/10 border-emerald-500/50', isBlocked && 'bg-red-500/10 border-red-500/50', !isCurrent && !isCompleted && !isBlocked && 'bg-muted border-transparent' )} whileHover={{ scale: 1.1 }} whileTap={{ scale: 0.95 }} animate={isCurrent ? { scale: [1, 1.05, 1] } : {}} transition={{ repeat: isCurrent ? Infinity : 0, duration: 2 }} > {phase.icon} {/* Status indicator */} {(isCompleted || status === 'in_progress' || isBlocked) && (
{getStatusIcon(status)}
)}

{phase.label}

{phase.fullDescription}

{phase.commands.map(cmd => ( {cmd} ))}
{/* Labels */} {phase.label} {phase.shortDescription}
) })}
{/* Loop back indicator */} {onLoopBack && currentIndex > 0 && (
)}
) }