ar-saas 0.3.0 → 0.3.2

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 (114) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +338 -314
  3. package/dist/cli.js +19 -0
  4. package/dist/generator.js +166 -55
  5. package/package.json +52 -50
  6. package/templates/backend/.env.example +67 -67
  7. package/templates/backend/.prettierrc +4 -4
  8. package/templates/backend/README.md +249 -168
  9. package/templates/backend/eslint.config.mjs +35 -35
  10. package/templates/backend/nest-cli.json +8 -8
  11. package/templates/backend/package-lock.json +10979 -10979
  12. package/templates/backend/package.json +88 -88
  13. package/templates/backend/src/app.controller.spec.ts +24 -24
  14. package/templates/backend/src/app.controller.ts +15 -15
  15. package/templates/backend/src/app.module.ts +40 -40
  16. package/templates/backend/src/app.service.ts +11 -11
  17. package/templates/backend/src/common/base/base.repository.ts +221 -221
  18. package/templates/backend/src/common/base/base.schema.ts +24 -24
  19. package/templates/backend/src/common/decorators/cookie.decorator.ts +9 -9
  20. package/templates/backend/src/common/decorators/current-user.decorator.ts +20 -20
  21. package/templates/backend/src/common/decorators/workspace-id.decorator.ts +14 -14
  22. package/templates/backend/src/common/filters/global-exception.filter.ts +61 -61
  23. package/templates/backend/src/common/guards/jwt-auth.guard.ts +5 -5
  24. package/templates/backend/src/common/interceptors/workspace-tenant.interceptor.ts +45 -45
  25. package/templates/backend/src/main.ts +51 -51
  26. package/templates/backend/src/modules/auth/auth.controller.ts +158 -158
  27. package/templates/backend/src/modules/auth/auth.module.ts +20 -20
  28. package/templates/backend/src/modules/auth/auth.service.ts +257 -257
  29. package/templates/backend/src/modules/auth/dto/forgot-password.dto.ts +9 -9
  30. package/templates/backend/src/modules/auth/dto/login.dto.ts +14 -14
  31. package/templates/backend/src/modules/auth/dto/refresh-token.dto.ts +12 -12
  32. package/templates/backend/src/modules/auth/dto/register.dto.ts +26 -26
  33. package/templates/backend/src/modules/auth/dto/reset-password.dto.ts +16 -16
  34. package/templates/backend/src/modules/auth/dto/verify-email.dto.ts +9 -9
  35. package/templates/backend/src/modules/auth/strategies/jwt.strategy.ts +43 -43
  36. package/templates/backend/src/modules/mail/mail.module.ts +9 -9
  37. package/templates/backend/src/modules/mail/mail.service.ts +141 -141
  38. package/templates/backend/src/modules/users/schemas/user.schema.ts +54 -54
  39. package/templates/backend/src/modules/users/users.module.ts +14 -14
  40. package/templates/backend/src/modules/users/users.repository.ts +51 -51
  41. package/templates/backend/src/modules/users/users.service.ts +104 -104
  42. package/templates/backend/src/modules/workspaces/schemas/workspace.schema.ts +26 -26
  43. package/templates/backend/src/modules/workspaces/workspaces.module.ts +16 -16
  44. package/templates/backend/src/modules/workspaces/workspaces.repository.ts +34 -34
  45. package/templates/backend/src/modules/workspaces/workspaces.service.ts +42 -42
  46. package/templates/backend/test/app.e2e-spec.ts +25 -25
  47. package/templates/backend/test/jest-e2e.json +9 -9
  48. package/templates/backend/tsconfig.build.json +4 -4
  49. package/templates/backend/tsconfig.json +26 -26
  50. package/templates/frontend/.env.local.example +1 -1
  51. package/templates/frontend/README.md +152 -0
  52. package/templates/frontend/components.json +20 -20
  53. package/templates/frontend/eslint.config.mjs +14 -14
  54. package/templates/frontend/next.config.ts +5 -5
  55. package/templates/frontend/package-lock.json +6722 -6722
  56. package/templates/frontend/package.json +48 -48
  57. package/templates/frontend/pnpm-lock.yaml +5012 -5012
  58. package/templates/frontend/pnpm-workspace.yaml +3 -3
  59. package/templates/frontend/postcss.config.mjs +7 -7
  60. package/templates/frontend/src/app/(auth)/forgot-password/page.tsx +84 -84
  61. package/templates/frontend/src/app/(auth)/layout.tsx +28 -28
  62. package/templates/frontend/src/app/(auth)/login/page.tsx +111 -111
  63. package/templates/frontend/src/app/(auth)/register/page.tsx +161 -161
  64. package/templates/frontend/src/app/(auth)/reset-password/page.tsx +120 -120
  65. package/templates/frontend/src/app/(auth)/verify-email/page.tsx +78 -78
  66. package/templates/frontend/src/app/(dashboard)/billing/page.tsx +111 -111
  67. package/templates/frontend/src/app/(dashboard)/dashboard/page.tsx +105 -105
  68. package/templates/frontend/src/app/(dashboard)/layout.tsx +38 -38
  69. package/templates/frontend/src/app/(dashboard)/profile/page.tsx +226 -226
  70. package/templates/frontend/src/app/(dashboard)/settings/page.tsx +156 -156
  71. package/templates/frontend/src/app/(dashboard)/team/page.tsx +178 -178
  72. package/templates/frontend/src/app/(legal)/privacy/page.tsx +127 -127
  73. package/templates/frontend/src/app/(legal)/terms/page.tsx +118 -118
  74. package/templates/frontend/src/app/globals.css +81 -81
  75. package/templates/frontend/src/app/layout.tsx +26 -26
  76. package/templates/frontend/src/app/page.tsx +5 -45
  77. package/templates/frontend/src/app/setup/page.tsx +371 -275
  78. package/templates/frontend/src/components/dashboard/header.tsx +89 -89
  79. package/templates/frontend/src/components/dashboard/sidebar.tsx +71 -71
  80. package/templates/frontend/src/components/dashboard/stat-card.tsx +34 -34
  81. package/templates/frontend/src/components/landing/faq.tsx +39 -39
  82. package/templates/frontend/src/components/landing/features.tsx +54 -54
  83. package/templates/frontend/src/components/landing/footer.tsx +76 -76
  84. package/templates/frontend/src/components/landing/hero.tsx +72 -72
  85. package/templates/frontend/src/components/landing/navbar.tsx +78 -78
  86. package/templates/frontend/src/components/landing/pricing.tsx +90 -90
  87. package/templates/frontend/src/components/ui/accordion.tsx +52 -52
  88. package/templates/frontend/src/components/ui/avatar.tsx +46 -46
  89. package/templates/frontend/src/components/ui/badge.tsx +30 -30
  90. package/templates/frontend/src/components/ui/button.tsx +52 -52
  91. package/templates/frontend/src/components/ui/card.tsx +50 -50
  92. package/templates/frontend/src/components/ui/checkbox.tsx +27 -27
  93. package/templates/frontend/src/components/ui/dialog.tsx +100 -100
  94. package/templates/frontend/src/components/ui/dropdown-menu.tsx +173 -173
  95. package/templates/frontend/src/components/ui/form.tsx +158 -158
  96. package/templates/frontend/src/components/ui/input.tsx +21 -21
  97. package/templates/frontend/src/components/ui/label.tsx +22 -22
  98. package/templates/frontend/src/components/ui/separator.tsx +25 -25
  99. package/templates/frontend/src/components/ui/skeleton.tsx +7 -7
  100. package/templates/frontend/src/components/ui/switch.tsx +28 -28
  101. package/templates/frontend/src/components/ui/tabs.tsx +54 -54
  102. package/templates/frontend/src/components/ui/textarea.tsx +20 -20
  103. package/templates/frontend/src/components/ui/toast.tsx +109 -109
  104. package/templates/frontend/src/components/ui/toaster.tsx +30 -30
  105. package/templates/frontend/src/config/site.ts +197 -197
  106. package/templates/frontend/src/hooks/use-toast.ts +116 -116
  107. package/templates/frontend/src/lib/api/auth.ts +39 -39
  108. package/templates/frontend/src/lib/api/client.ts +66 -66
  109. package/templates/frontend/src/lib/hooks/use-auth.ts +1 -1
  110. package/templates/frontend/src/lib/utils.ts +6 -6
  111. package/templates/frontend/src/providers/auth-provider.tsx +60 -60
  112. package/templates/frontend/src/types/api.ts +12 -12
  113. package/templates/frontend/src/types/auth.ts +27 -27
  114. package/templates/frontend/tsconfig.json +23 -23
@@ -1,38 +1,38 @@
1
- 'use client'
2
-
3
- import { useEffect } from 'react'
4
- import { useRouter } from 'next/navigation'
5
- import { useAuth } from '@/lib/hooks/use-auth'
6
- import { DashboardSidebar } from '@/components/dashboard/sidebar'
7
- import { DashboardHeader } from '@/components/dashboard/header'
8
-
9
- export default function DashboardLayout({ children }: { children: React.ReactNode }) {
10
- const { isAuthenticated, isLoading } = useAuth()
11
- const router = useRouter()
12
-
13
- useEffect(() => {
14
- if (!isLoading && !isAuthenticated) {
15
- router.replace('/login')
16
- }
17
- }, [isAuthenticated, isLoading, router])
18
-
19
- if (isLoading) {
20
- return (
21
- <div className="flex min-h-screen items-center justify-center">
22
- <div className="text-sm text-muted-foreground">Cargando...</div>
23
- </div>
24
- )
25
- }
26
-
27
- if (!isAuthenticated) return null
28
-
29
- return (
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>
36
- </div>
37
- )
38
- }
1
+ 'use client'
2
+
3
+ import { useEffect } from 'react'
4
+ import { useRouter } from 'next/navigation'
5
+ import { useAuth } from '@/lib/hooks/use-auth'
6
+ import { DashboardSidebar } from '@/components/dashboard/sidebar'
7
+ import { DashboardHeader } from '@/components/dashboard/header'
8
+
9
+ export default function DashboardLayout({ children }: { children: React.ReactNode }) {
10
+ const { isAuthenticated, isLoading } = useAuth()
11
+ const router = useRouter()
12
+
13
+ useEffect(() => {
14
+ if (!isLoading && !isAuthenticated) {
15
+ router.replace('/login')
16
+ }
17
+ }, [isAuthenticated, isLoading, router])
18
+
19
+ if (isLoading) {
20
+ return (
21
+ <div className="flex min-h-screen items-center justify-center">
22
+ <div className="text-sm text-muted-foreground">Cargando...</div>
23
+ </div>
24
+ )
25
+ }
26
+
27
+ if (!isAuthenticated) return null
28
+
29
+ return (
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>
36
+ </div>
37
+ )
38
+ }
@@ -1,226 +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
- }
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
+ }