import * as Icons from 'lucide-react' import type { NewPlanWizardState, ModoCreacion, SubModoClonado, } 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: ModoCreacion) => wizard.modoCreacion === m const isSubSelected = (s: SubModoClonado) => wizard.subModoClonado === s 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) => ({ ...w, modoCreacion: 'MANUAL', subModoClonado: undefined, })) } onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange((w) => ({ ...w, modoCreacion: 'MANUAL', subModoClonado: undefined, })), ) } role="button" tabIndex={0} > Manual Plan vacío con estructura mínima. onChange((w) => ({ ...w, modoCreacion: 'IA', subModoClonado: undefined, })) } onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange((w) => ({ ...w, modoCreacion: 'IA', subModoClonado: undefined, })), ) } role="button" tabIndex={0} > Con IA Borrador completo a partir de datos base. onChange((w) => ({ ...w, modoCreacion: 'CLONADO' }))} onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange((w) => ({ ...w, modoCreacion: 'CLONADO' })), ) } role="button" tabIndex={0} > Clonado Desde un plan existente o archivos. {wizard.modoCreacion === 'CLONADO' && (
{ e.stopPropagation() onChange((w) => ({ ...w, subModoClonado: 'INTERNO' })) }} onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange((w) => ({ ...w, subModoClonado: '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 ${ isSubSelected('INTERNO') ? 'border-primary bg-primary/5 ring-primary text-primary ring-1' : 'border-border text-muted-foreground' } `} > Del sistema
{ e.stopPropagation() onChange((w) => ({ ...w, subModoClonado: 'TRADICIONAL' })) }} onKeyDown={(e: React.KeyboardEvent) => handleKeyActivate(e, () => onChange((w) => ({ ...w, subModoClonado: '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 ${ isSubSelected('TRADICIONAL') ? 'border-primary bg-primary/5 ring-primary text-primary ring-1' : 'border-border text-muted-foreground' } `} > Desde archivos
)}
) }