'use client' import { motion, AnimatePresence } from 'motion/react' import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' import { CheckCircle2, AlertCircle, Loader2, Save, Rocket } from 'lucide-react' export type StepConfig = { title: string description?: string isValid?: boolean hasErrors?: boolean } type SidebarStepperProps = { steps: StepConfig[] currentStep: number onStepChange: (index: number) => void onSave?: () => void onSubmit?: () => void isSaving?: boolean isSubmitting?: boolean saveLabel?: string submitLabel?: string canSubmit?: boolean children: React.ReactNode className?: string } export function SidebarStepper({ steps, currentStep, onStepChange, onSave, onSubmit, isSaving = false, isSubmitting = false, saveLabel = 'Save Draft', submitLabel = 'Create Pipeline', canSubmit = true, children, className, }: SidebarStepperProps) { const direction = (prev: number, next: number) => (next > prev ? 1 : -1) return (
{/* Sidebar - hidden on mobile */}
{/* Actions */}
{onSave && ( )} {onSubmit && ( )}
{/* Mobile step indicator */}
{children}
{/* Mobile actions */}
{onSave && ( )} {onSubmit && ( )}
{/* Desktop content */}
{children}
) } function MobileStepIndicator({ steps, currentStep, onStepChange, }: { steps: StepConfig[] currentStep: number onStepChange: (index: number) => void }) { return (
{steps.map((step, index) => { const isCurrent = index === currentStep const isComplete = step.isValid === true return ( ) })}
) } function StepContent({ currentStep, direction, children, }: { currentStep: number direction: (prev: number, next: number) => number children: React.ReactNode }) { const childArray = Array.isArray(children) ? children : [children] const currentChild = childArray[currentStep] return (
{currentChild}
) }