ar-saas 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +107 -25
  2. package/dist/cli.js +33 -1
  3. package/dist/generator.js +12 -3
  4. package/package.json +7 -3
  5. package/templates/frontend/package.json +21 -13
  6. package/templates/frontend/pnpm-lock.yaml +5012 -0
  7. package/templates/frontend/pnpm-workspace.yaml +3 -0
  8. package/templates/frontend/src/app/(auth)/register/page.tsx +49 -7
  9. package/templates/frontend/src/app/(dashboard)/billing/page.tsx +111 -0
  10. package/templates/frontend/src/app/(dashboard)/dashboard/page.tsx +81 -12
  11. package/templates/frontend/src/app/(dashboard)/layout.tsx +11 -32
  12. package/templates/frontend/src/app/(dashboard)/profile/page.tsx +226 -0
  13. package/templates/frontend/src/app/(dashboard)/settings/page.tsx +156 -0
  14. package/templates/frontend/src/app/(dashboard)/team/page.tsx +178 -0
  15. package/templates/frontend/src/app/(legal)/privacy/page.tsx +127 -0
  16. package/templates/frontend/src/app/(legal)/terms/page.tsx +118 -0
  17. package/templates/frontend/src/app/page.tsx +43 -3
  18. package/templates/frontend/src/app/setup/page.tsx +1 -4
  19. package/templates/frontend/src/components/dashboard/header.tsx +89 -0
  20. package/templates/frontend/src/components/dashboard/sidebar.tsx +71 -0
  21. package/templates/frontend/src/components/dashboard/stat-card.tsx +34 -0
  22. package/templates/frontend/src/components/landing/faq.tsx +39 -0
  23. package/templates/frontend/src/components/landing/features.tsx +54 -0
  24. package/templates/frontend/src/components/landing/footer.tsx +76 -0
  25. package/templates/frontend/src/components/landing/hero.tsx +72 -0
  26. package/templates/frontend/src/components/landing/navbar.tsx +78 -0
  27. package/templates/frontend/src/components/landing/pricing.tsx +90 -0
  28. package/templates/frontend/src/components/ui/accordion.tsx +52 -0
  29. package/templates/frontend/src/components/ui/avatar.tsx +46 -0
  30. package/templates/frontend/src/components/ui/badge.tsx +30 -0
  31. package/templates/frontend/src/components/ui/checkbox.tsx +27 -0
  32. package/templates/frontend/src/components/ui/dialog.tsx +100 -0
  33. package/templates/frontend/src/components/ui/dropdown-menu.tsx +173 -0
  34. package/templates/frontend/src/components/ui/separator.tsx +25 -0
  35. package/templates/frontend/src/components/ui/skeleton.tsx +7 -0
  36. package/templates/frontend/src/components/ui/switch.tsx +28 -0
  37. package/templates/frontend/src/components/ui/tabs.tsx +54 -0
  38. package/templates/frontend/src/components/ui/textarea.tsx +20 -0
  39. package/templates/frontend/src/config/site.ts +197 -0
@@ -0,0 +1,3 @@
1
+ allowBuilds:
2
+ sharp: set this to true or false
3
+ unrs-resolver: set this to true or false
@@ -6,6 +6,7 @@ import { useForm } from 'react-hook-form'
6
6
  import { useAuth } from '@/lib/hooks/use-auth'
7
7
  import { Button } from '@/components/ui/button'
8
8
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
9
+ import { Checkbox } from '@/components/ui/checkbox'
9
10
  import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'
10
11
  import { Input } from '@/components/ui/input'
11
12
 
@@ -13,6 +14,7 @@ interface RegisterForm {
13
14
  name: string
14
15
  email: string
15
16
  password: string
17
+ terms: boolean
16
18
  }
17
19
 
18
20
  export default function RegisterPage() {
@@ -21,7 +23,7 @@ export default function RegisterPage() {
21
23
  const [apiError, setApiError] = useState('')
22
24
 
23
25
  const form = useForm<RegisterForm>({
24
- defaultValues: { name: '', email: '', password: '' },
26
+ defaultValues: { name: '', email: '', password: '', terms: false },
25
27
  })
26
28
 
27
29
  async function onSubmit(data: RegisterForm) {
@@ -30,9 +32,10 @@ export default function RegisterPage() {
30
32
  await register(data.name, data.email, data.password)
31
33
  setSuccess(true)
32
34
  } catch (err: unknown) {
33
- const msg = err instanceof Error
34
- ? err.message
35
- : (err as { message?: string })?.message ?? 'Error al crear la cuenta'
35
+ const msg =
36
+ err instanceof Error
37
+ ? err.message
38
+ : (err as { message?: string })?.message ?? 'Error al crear la cuenta'
36
39
  setApiError(msg)
37
40
  }
38
41
  }
@@ -62,7 +65,10 @@ export default function RegisterPage() {
62
65
  <FormField
63
66
  control={form.control}
64
67
  name="name"
65
- rules={{ required: 'El nombre es requerido', minLength: { value: 2, message: 'Mínimo 2 caracteres' } }}
68
+ rules={{
69
+ required: 'El nombre es requerido',
70
+ minLength: { value: 2, message: 'Mínimo 2 caracteres' },
71
+ }}
66
72
  render={({ field }) => (
67
73
  <FormItem>
68
74
  <FormLabel>Nombre completo</FormLabel>
@@ -76,7 +82,10 @@ export default function RegisterPage() {
76
82
  <FormField
77
83
  control={form.control}
78
84
  name="email"
79
- rules={{ required: 'El email es requerido', pattern: { value: /\S+@\S+\.\S+/, message: 'Email inválido' } }}
85
+ rules={{
86
+ required: 'El email es requerido',
87
+ pattern: { value: /\S+@\S+\.\S+/, message: 'Email inválido' },
88
+ }}
80
89
  render={({ field }) => (
81
90
  <FormItem>
82
91
  <FormLabel>Email</FormLabel>
@@ -90,7 +99,10 @@ export default function RegisterPage() {
90
99
  <FormField
91
100
  control={form.control}
92
101
  name="password"
93
- rules={{ required: 'La contraseña es requerida', minLength: { value: 8, message: 'Mínimo 8 caracteres' } }}
102
+ rules={{
103
+ required: 'La contraseña es requerida',
104
+ minLength: { value: 8, message: 'Mínimo 8 caracteres' },
105
+ }}
94
106
  render={({ field }) => (
95
107
  <FormItem>
96
108
  <FormLabel>Contraseña</FormLabel>
@@ -101,6 +113,36 @@ export default function RegisterPage() {
101
113
  </FormItem>
102
114
  )}
103
115
  />
116
+
117
+ <FormField
118
+ control={form.control}
119
+ name="terms"
120
+ rules={{ validate: (v) => v || 'Debés aceptar los términos para continuar' }}
121
+ render={({ field }) => (
122
+ <FormItem className="flex flex-row items-start space-x-3 space-y-0">
123
+ <FormControl>
124
+ <Checkbox
125
+ checked={field.value}
126
+ onCheckedChange={field.onChange}
127
+ />
128
+ </FormControl>
129
+ <div className="space-y-1 leading-none">
130
+ <FormLabel className="text-sm font-normal">
131
+ Acepto los{' '}
132
+ <Link href="/terms" target="_blank" className="underline underline-offset-4 hover:text-foreground">
133
+ Términos y Condiciones
134
+ </Link>{' '}
135
+ y la{' '}
136
+ <Link href="/privacy" target="_blank" className="underline underline-offset-4 hover:text-foreground">
137
+ Política de Privacidad
138
+ </Link>
139
+ </FormLabel>
140
+ <FormMessage />
141
+ </div>
142
+ </FormItem>
143
+ )}
144
+ />
145
+
104
146
  {apiError && <p className="text-sm text-destructive">{apiError}</p>}
105
147
  <Button type="submit" className="w-full" disabled={form.formState.isSubmitting}>
106
148
  {form.formState.isSubmitting ? 'Creando cuenta...' : 'Crear cuenta'}
@@ -0,0 +1,111 @@
1
+ 'use client'
2
+
3
+ import { CreditCard, CheckCircle2, ArrowUpRight } from 'lucide-react'
4
+ import { siteConfig } from '@/config/site'
5
+ import { Button } from '@/components/ui/button'
6
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
7
+ import { Badge } from '@/components/ui/badge'
8
+ import { Separator } from '@/components/ui/separator'
9
+
10
+ const currentPlan = siteConfig.pricing[0]
11
+
12
+ const invoiceHistory = [
13
+ { id: 'INV-001', date: '01/06/2024', amount: '$0', status: 'Pagado', plan: 'Free' },
14
+ { id: 'INV-002', date: '01/05/2024', amount: '$0', status: 'Pagado', plan: 'Free' },
15
+ { id: 'INV-003', date: '01/04/2024', amount: '$0', status: 'Pagado', plan: 'Free' },
16
+ ]
17
+
18
+ export default function BillingPage() {
19
+ return (
20
+ <div className="max-w-2xl space-y-6">
21
+ {/* Current plan */}
22
+ <Card>
23
+ <CardHeader>
24
+ <div className="flex items-start justify-between">
25
+ <div>
26
+ <CardTitle>Plan actual</CardTitle>
27
+ <CardDescription>Tus beneficios y límites vigentes.</CardDescription>
28
+ </div>
29
+ <Badge variant="secondary">{currentPlan.name}</Badge>
30
+ </div>
31
+ </CardHeader>
32
+ <CardContent className="space-y-4">
33
+ <div className="flex items-end gap-1">
34
+ <span className="text-3xl font-bold">{currentPlan.price}</span>
35
+ {currentPlan.period && (
36
+ <span className="mb-1 text-sm text-muted-foreground">{currentPlan.period}</span>
37
+ )}
38
+ </div>
39
+
40
+ <ul className="space-y-2">
41
+ {currentPlan.features.map((f) => (
42
+ <li key={f} className="flex items-center gap-2 text-sm">
43
+ <CheckCircle2 className="size-4 text-primary" />
44
+ {f}
45
+ </li>
46
+ ))}
47
+ </ul>
48
+
49
+ <Separator />
50
+
51
+ <div className="flex flex-col gap-2 sm:flex-row">
52
+ <Button className="gap-2">
53
+ <ArrowUpRight className="size-4" />
54
+ Actualizar a Pro
55
+ </Button>
56
+ <Button variant="outline" disabled>
57
+ Cancelar suscripción
58
+ </Button>
59
+ </div>
60
+ </CardContent>
61
+ </Card>
62
+
63
+ {/* Payment method */}
64
+ <Card>
65
+ <CardHeader>
66
+ <CardTitle>Método de pago</CardTitle>
67
+ <CardDescription>Administrá tus tarjetas guardadas.</CardDescription>
68
+ </CardHeader>
69
+ <CardContent>
70
+ <div className="flex items-center justify-between rounded-lg border p-4">
71
+ <div className="flex items-center gap-3">
72
+ <CreditCard className="size-5 text-muted-foreground" />
73
+ <div>
74
+ <p className="text-sm font-medium">Sin método de pago</p>
75
+ <p className="text-xs text-muted-foreground">Agregá una tarjeta para actualizar tu plan</p>
76
+ </div>
77
+ </div>
78
+ <Button variant="outline" size="sm" disabled>
79
+ Agregar tarjeta
80
+ </Button>
81
+ </div>
82
+ </CardContent>
83
+ </Card>
84
+
85
+ {/* History */}
86
+ <Card>
87
+ <CardHeader>
88
+ <CardTitle>Historial de facturación</CardTitle>
89
+ <CardDescription>Tus últimas facturas generadas.</CardDescription>
90
+ </CardHeader>
91
+ <CardContent>
92
+ <div className="space-y-2">
93
+ {invoiceHistory.map((inv) => (
94
+ <div key={inv.id} className="flex items-center justify-between rounded-md border p-3 text-sm">
95
+ <div className="flex items-center gap-4">
96
+ <span className="font-mono text-xs text-muted-foreground">{inv.id}</span>
97
+ <span>{inv.date}</span>
98
+ <Badge variant="outline">{inv.plan}</Badge>
99
+ </div>
100
+ <div className="flex items-center gap-4">
101
+ <span className="font-medium">{inv.amount}</span>
102
+ <Badge variant="secondary" className="text-xs">{inv.status}</Badge>
103
+ </div>
104
+ </div>
105
+ ))}
106
+ </div>
107
+ </CardContent>
108
+ </Card>
109
+ </div>
110
+ )
111
+ }
@@ -1,34 +1,103 @@
1
1
  'use client'
2
2
 
3
+ import { Users, BarChart3, TrendingUp, Activity } from 'lucide-react'
3
4
  import { useAuth } from '@/lib/hooks/use-auth'
5
+ import { StatCard } from '@/components/dashboard/stat-card'
4
6
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
5
- import { Rocket } from 'lucide-react'
7
+ import { Badge } from '@/components/ui/badge'
8
+ import { Skeleton } from '@/components/ui/skeleton'
9
+
10
+ const stats = [
11
+ {
12
+ title: 'Usuarios activos',
13
+ value: '—',
14
+ description: 'Total de cuentas registradas',
15
+ icon: Users,
16
+ trend: { value: '0%', positive: true },
17
+ },
18
+ {
19
+ title: 'Ingresos del mes',
20
+ value: '$—',
21
+ description: 'Facturación del período actual',
22
+ icon: TrendingUp,
23
+ trend: { value: '0%', positive: true },
24
+ },
25
+ {
26
+ title: 'Eventos totales',
27
+ value: '—',
28
+ description: 'Acciones registradas hoy',
29
+ icon: Activity,
30
+ trend: { value: '0%', positive: true },
31
+ },
32
+ {
33
+ title: 'Conversión',
34
+ value: '—%',
35
+ description: 'Free → plan de pago',
36
+ icon: BarChart3,
37
+ trend: { value: '0 pts', positive: true },
38
+ },
39
+ ]
40
+
41
+ const quickStart = [
42
+ { step: '1', title: 'Configurá el backend', description: 'Completá las variables en /backend/.env con tu cadena de MongoDB y las keys de JWT.' },
43
+ { step: '2', title: 'Personalizá la landing', description: 'Editá src/config/site.ts para cambiar nombre, tagline, precios y contenido.' },
44
+ { step: '3', title: 'Conectá tu dominio', description: 'Apuntá tu DNS al servidor y configurá SSL. Consultá la guía de deploy.' },
45
+ { step: '4', title: 'Activá los pagos', description: 'Integrá Stripe u otro procesador en el módulo de facturación.' },
46
+ ]
6
47
 
7
48
  export default function DashboardPage() {
8
49
  const { user } = useAuth()
9
50
 
51
+ if (!user) {
52
+ return (
53
+ <div className="space-y-6">
54
+ <Skeleton className="h-8 w-48" />
55
+ <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
56
+ {[...Array(4)].map((_, i) => <Skeleton key={i} className="h-28" />)}
57
+ </div>
58
+ </div>
59
+ )
60
+ }
61
+
10
62
  return (
11
63
  <div className="space-y-6">
12
64
  <div>
13
- <h1 className="text-2xl font-bold">Bienvenido, {user?.name}</h1>
14
- <p className="text-muted-foreground">{user?.email}</p>
65
+ <h2 className="text-2xl font-bold">Bienvenido, {user.name}</h2>
66
+ <p className="text-sm text-muted-foreground">{user.email}</p>
15
67
  </div>
16
- <Card className="max-w-md">
68
+
69
+ {/* Stats */}
70
+ <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
71
+ {stats.map((stat) => (
72
+ <StatCard key={stat.title} {...stat} />
73
+ ))}
74
+ </div>
75
+
76
+ {/* Quick start */}
77
+ <Card>
17
78
  <CardHeader>
18
79
  <div className="flex items-center gap-2">
19
- <Rocket className="size-5" />
20
- <CardTitle>Tu SaaS está listo para construir</CardTitle>
80
+ <CardTitle className="text-base">Primeros pasos</CardTitle>
81
+ <Badge variant="secondary" className="text-xs">Checklist</Badge>
21
82
  </div>
22
83
  <CardDescription>
23
- El backend y el frontend están configurados y funcionando. Agregá tus módulos de negocio.
84
+ Seguí estos pasos para tener tu SaaS listo para producción.
24
85
  </CardDescription>
25
86
  </CardHeader>
26
87
  <CardContent>
27
- <p className="text-sm text-muted-foreground">
28
- Consultá la documentación en{' '}
29
- <span className="font-mono text-foreground">.ai-docs/</span> para ver los patrones
30
- disponibles.
31
- </p>
88
+ <ol className="space-y-4">
89
+ {quickStart.map((item) => (
90
+ <li key={item.step} className="flex gap-4">
91
+ <span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary">
92
+ {item.step}
93
+ </span>
94
+ <div>
95
+ <p className="text-sm font-medium">{item.title}</p>
96
+ <p className="mt-0.5 text-xs text-muted-foreground">{item.description}</p>
97
+ </div>
98
+ </li>
99
+ ))}
100
+ </ol>
32
101
  </CardContent>
33
102
  </Card>
34
103
  </div>
@@ -1,14 +1,13 @@
1
1
  'use client'
2
2
 
3
3
  import { useEffect } from 'react'
4
- import Link from 'next/link'
5
4
  import { useRouter } from 'next/navigation'
6
- import { LayoutDashboard, LogOut } from 'lucide-react'
7
5
  import { useAuth } from '@/lib/hooks/use-auth'
8
- import { Button } from '@/components/ui/button'
6
+ import { DashboardSidebar } from '@/components/dashboard/sidebar'
7
+ import { DashboardHeader } from '@/components/dashboard/header'
9
8
 
10
9
  export default function DashboardLayout({ children }: { children: React.ReactNode }) {
11
- const { user, isAuthenticated, isLoading, logout } = useAuth()
10
+ const { isAuthenticated, isLoading } = useAuth()
12
11
  const router = useRouter()
13
12
 
14
13
  useEffect(() => {
@@ -19,8 +18,8 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
19
18
 
20
19
  if (isLoading) {
21
20
  return (
22
- <div className="min-h-screen flex items-center justify-center">
23
- <div className="text-muted-foreground text-sm">Cargando...</div>
21
+ <div className="flex min-h-screen items-center justify-center">
22
+ <div className="text-sm text-muted-foreground">Cargando...</div>
24
23
  </div>
25
24
  )
26
25
  }
@@ -28,32 +27,12 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
28
27
  if (!isAuthenticated) return null
29
28
 
30
29
  return (
31
- <div className="min-h-screen flex">
32
- <aside className="w-60 shrink-0 border-r flex flex-col bg-card">
33
- <div className="p-4 border-b">
34
- <p className="text-sm font-semibold truncate">{user?.name}</p>
35
- <p className="text-xs text-muted-foreground truncate">{user?.email}</p>
36
- </div>
37
- <nav className="flex-1 p-3 space-y-1">
38
- <Button asChild variant="ghost" className="w-full justify-start">
39
- <Link href="/dashboard">
40
- <LayoutDashboard className="mr-2 size-4" />
41
- Dashboard
42
- </Link>
43
- </Button>
44
- </nav>
45
- <div className="p-3 border-t">
46
- <Button
47
- variant="ghost"
48
- className="w-full justify-start text-muted-foreground hover:text-foreground"
49
- onClick={logout}
50
- >
51
- <LogOut className="mr-2 size-4" />
52
- Cerrar sesión
53
- </Button>
54
- </div>
55
- </aside>
56
- <main className="flex-1 p-8 overflow-auto">{children}</main>
30
+ <div className="flex min-h-screen">
31
+ <DashboardSidebar />
32
+ <div className="flex flex-1 flex-col overflow-hidden">
33
+ <DashboardHeader />
34
+ <main className="flex-1 overflow-auto p-6">{children}</main>
35
+ </div>
57
36
  </div>
58
37
  )
59
38
  }
@@ -0,0 +1,226 @@
1
+ 'use client'
2
+
3
+ import { useState } from 'react'
4
+ import { useForm } from 'react-hook-form'
5
+ import { useAuth } from '@/lib/hooks/use-auth'
6
+ import { Button } from '@/components/ui/button'
7
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
8
+ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'
9
+ import { Input } from '@/components/ui/input'
10
+ import { Avatar, AvatarFallback } from '@/components/ui/avatar'
11
+ import { Separator } from '@/components/ui/separator'
12
+ import {
13
+ Dialog,
14
+ DialogContent,
15
+ DialogDescription,
16
+ DialogFooter,
17
+ DialogHeader,
18
+ DialogTitle,
19
+ DialogTrigger,
20
+ } from '@/components/ui/dialog'
21
+
22
+ function getInitials(name: string) {
23
+ return name.split(' ').map((n) => n[0]).slice(0, 2).join('').toUpperCase()
24
+ }
25
+
26
+ interface ProfileForm {
27
+ name: string
28
+ email: string
29
+ }
30
+
31
+ interface PasswordForm {
32
+ currentPassword: string
33
+ newPassword: string
34
+ confirmPassword: string
35
+ }
36
+
37
+ export default function ProfilePage() {
38
+ const { user } = useAuth()
39
+ const [saved, setSaved] = useState(false)
40
+ const [passwordOpen, setPasswordOpen] = useState(false)
41
+
42
+ const form = useForm<ProfileForm>({
43
+ values: { name: user?.name ?? '', email: user?.email ?? '' },
44
+ })
45
+
46
+ const passwordForm = useForm<PasswordForm>({
47
+ defaultValues: { currentPassword: '', newPassword: '', confirmPassword: '' },
48
+ })
49
+
50
+ async function onSaveProfile(data: ProfileForm) {
51
+ // TODO: llamar a PATCH /users/me con data
52
+ console.log('Guardar perfil:', data)
53
+ setSaved(true)
54
+ setTimeout(() => setSaved(false), 2000)
55
+ }
56
+
57
+ async function onChangePassword(data: PasswordForm) {
58
+ if (data.newPassword !== data.confirmPassword) {
59
+ passwordForm.setError('confirmPassword', { message: 'Las contraseñas no coinciden' })
60
+ return
61
+ }
62
+ // TODO: llamar a POST /auth/change-password con data
63
+ console.log('Cambiar contraseña:', data)
64
+ setPasswordOpen(false)
65
+ passwordForm.reset()
66
+ }
67
+
68
+ return (
69
+ <div className="max-w-2xl space-y-6">
70
+ {/* Avatar */}
71
+ <Card>
72
+ <CardHeader>
73
+ <CardTitle>Foto de perfil</CardTitle>
74
+ <CardDescription>Tu avatar se genera automáticamente con tus iniciales.</CardDescription>
75
+ </CardHeader>
76
+ <CardContent className="flex items-center gap-4">
77
+ <Avatar className="size-16">
78
+ <AvatarFallback className="text-lg">
79
+ {user?.name ? getInitials(user.name) : 'U'}
80
+ </AvatarFallback>
81
+ </Avatar>
82
+ <div>
83
+ <p className="font-medium">{user?.name}</p>
84
+ <p className="text-sm text-muted-foreground">{user?.email}</p>
85
+ </div>
86
+ </CardContent>
87
+ </Card>
88
+
89
+ {/* Info */}
90
+ <Card>
91
+ <CardHeader>
92
+ <CardTitle>Información personal</CardTitle>
93
+ <CardDescription>Actualizá tu nombre y email de acceso.</CardDescription>
94
+ </CardHeader>
95
+ <CardContent>
96
+ <Form {...form}>
97
+ <form onSubmit={form.handleSubmit(onSaveProfile)} className="space-y-4">
98
+ <FormField
99
+ control={form.control}
100
+ name="name"
101
+ rules={{ required: 'El nombre es requerido' }}
102
+ render={({ field }) => (
103
+ <FormItem>
104
+ <FormLabel>Nombre completo</FormLabel>
105
+ <FormControl>
106
+ <Input {...field} />
107
+ </FormControl>
108
+ <FormMessage />
109
+ </FormItem>
110
+ )}
111
+ />
112
+ <FormField
113
+ control={form.control}
114
+ name="email"
115
+ rules={{ required: 'El email es requerido' }}
116
+ render={({ field }) => (
117
+ <FormItem>
118
+ <FormLabel>Email</FormLabel>
119
+ <FormControl>
120
+ <Input type="email" {...field} />
121
+ </FormControl>
122
+ <FormMessage />
123
+ </FormItem>
124
+ )}
125
+ />
126
+ <Button type="submit" disabled={form.formState.isSubmitting}>
127
+ {saved ? 'Guardado' : 'Guardar cambios'}
128
+ </Button>
129
+ </form>
130
+ </Form>
131
+ </CardContent>
132
+ </Card>
133
+
134
+ {/* Security */}
135
+ <Card>
136
+ <CardHeader>
137
+ <CardTitle>Seguridad</CardTitle>
138
+ <CardDescription>Gestioná tu contraseña y métodos de acceso.</CardDescription>
139
+ </CardHeader>
140
+ <CardContent className="space-y-4">
141
+ <div className="flex items-center justify-between">
142
+ <div>
143
+ <p className="text-sm font-medium">Contraseña</p>
144
+ <p className="text-xs text-muted-foreground">Última actualización: desconocida</p>
145
+ </div>
146
+ <Dialog open={passwordOpen} onOpenChange={setPasswordOpen}>
147
+ <DialogTrigger asChild>
148
+ <Button variant="outline" size="sm">Cambiar contraseña</Button>
149
+ </DialogTrigger>
150
+ <DialogContent>
151
+ <DialogHeader>
152
+ <DialogTitle>Cambiar contraseña</DialogTitle>
153
+ <DialogDescription>
154
+ Ingresá tu contraseña actual y la nueva para continuar.
155
+ </DialogDescription>
156
+ </DialogHeader>
157
+ <Form {...passwordForm}>
158
+ <form onSubmit={passwordForm.handleSubmit(onChangePassword)} className="space-y-4">
159
+ <FormField
160
+ control={passwordForm.control}
161
+ name="currentPassword"
162
+ rules={{ required: 'Requerido' }}
163
+ render={({ field }) => (
164
+ <FormItem>
165
+ <FormLabel>Contraseña actual</FormLabel>
166
+ <FormControl><Input type="password" {...field} /></FormControl>
167
+ <FormMessage />
168
+ </FormItem>
169
+ )}
170
+ />
171
+ <FormField
172
+ control={passwordForm.control}
173
+ name="newPassword"
174
+ rules={{ required: 'Requerido', minLength: { value: 8, message: 'Mínimo 8 caracteres' } }}
175
+ render={({ field }) => (
176
+ <FormItem>
177
+ <FormLabel>Nueva contraseña</FormLabel>
178
+ <FormControl><Input type="password" {...field} /></FormControl>
179
+ <FormMessage />
180
+ </FormItem>
181
+ )}
182
+ />
183
+ <FormField
184
+ control={passwordForm.control}
185
+ name="confirmPassword"
186
+ rules={{ required: 'Requerido' }}
187
+ render={({ field }) => (
188
+ <FormItem>
189
+ <FormLabel>Confirmar contraseña</FormLabel>
190
+ <FormControl><Input type="password" {...field} /></FormControl>
191
+ <FormMessage />
192
+ </FormItem>
193
+ )}
194
+ />
195
+ <DialogFooter>
196
+ <Button type="button" variant="ghost" onClick={() => setPasswordOpen(false)}>
197
+ Cancelar
198
+ </Button>
199
+ <Button type="submit" disabled={passwordForm.formState.isSubmitting}>
200
+ Guardar
201
+ </Button>
202
+ </DialogFooter>
203
+ </form>
204
+ </Form>
205
+ </DialogContent>
206
+ </Dialog>
207
+ </div>
208
+
209
+ <Separator />
210
+
211
+ <div className="flex items-center justify-between">
212
+ <div>
213
+ <p className="text-sm font-medium">Eliminar cuenta</p>
214
+ <p className="text-xs text-muted-foreground">
215
+ Esta acción es permanente e irreversible.
216
+ </p>
217
+ </div>
218
+ <Button variant="destructive" size="sm" disabled>
219
+ Eliminar cuenta
220
+ </Button>
221
+ </div>
222
+ </CardContent>
223
+ </Card>
224
+ </div>
225
+ )
226
+ }