import * as Icons from 'lucide-react' import type { TipoOrigen } from '@/data/types/domain' import type { NewPlanWizardState } from '@/features/planes/nuevo/types' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' export function PasoModoCardGroup({ wizard, onChange, }: { wizard: NewPlanWizardState onChange: React.Dispatch> }) { const isSelected = (m: TipoOrigen) => wizard.tipoOrigen === m const handleKeyActivate = (e: React.KeyboardEvent, cb: () => void) => { const key = e.key if ( key === 'Enter' || key === ' ' || key === 'Spacebar' || key === 'Space' ) { e.preventDefault() e.stopPropagation() cb() } } return (
onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'MANUAL', }), ) } onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'MANUAL', }), ), ) } role="button" tabIndex={0} > Manual Plan vacío con estructura mínima. onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'IA', }), ) } onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'IA', }), ), ) } role="button" tabIndex={0} > Con IA Borrador completo a partir de datos base. onChange((w): NewPlanWizardState => ({ ...w, tipoOrigen: 'OTRO' })) } onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange((w): NewPlanWizardState => ({ ...w, tipoOrigen: 'OTRO' })), ) } role="button" tabIndex={0} > Clonado Desde un plan existente o archivos. {(wizard.tipoOrigen === 'OTRO' || wizard.tipoOrigen === 'CLONADO_INTERNO' || wizard.tipoOrigen === 'CLONADO_TRADICIONAL') && (
{ e.stopPropagation() onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'CLONADO_INTERNO', }), ) }} onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'CLONADO_INTERNO', }), ), ) } className={`hover:border-primary/50 hover:bg-accent flex cursor-pointer flex-row items-center justify-center gap-2 rounded-lg border p-4 text-center transition-all sm:flex-col ${ isSelected('CLONADO_INTERNO') ? 'border-primary bg-primary/5 ring-primary text-primary ring-1' : 'border-border text-muted-foreground' } `} > Del sistema
{ e.stopPropagation() onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'CLONADO_TRADICIONAL', }), ) }} onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange( (w): NewPlanWizardState => ({ ...w, tipoOrigen: 'CLONADO_TRADICIONAL', }), ), ) } className={`hover:border-primary/50 hover:bg-accent flex cursor-pointer flex-row items-center justify-center gap-2 rounded-lg border p-4 text-center transition-all sm:flex-col ${ isSelected('CLONADO_TRADICIONAL') ? 'border-primary bg-primary/5 ring-primary text-primary ring-1' : 'border-border text-muted-foreground' } `} > Desde archivos
)}
) }