create-brainerce-store 1.68.0 → 1.72.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 (50) hide show
  1. package/README.md +31 -10
  2. package/dist/index.js +197 -105
  3. package/messages/en.json +63 -3
  4. package/messages/he.json +63 -3
  5. package/package.json +1 -1
  6. package/templates/nextjs/base/TRANSLATIONS.md +14 -7
  7. package/templates/nextjs/base/src/app/checkout/page.tsx +1074 -1017
  8. package/templates/nextjs/base/src/app/order-confirmation/page.tsx +21 -2
  9. package/templates/nextjs/base/src/app/products/[slug]/page.tsx +1 -1
  10. package/templates/nextjs/base/src/app/register/page.tsx +67 -64
  11. package/templates/nextjs/base/src/components/account/order-history.tsx +25 -39
  12. package/templates/nextjs/base/src/components/account/order-status-timeline.tsx +30 -11
  13. package/templates/nextjs/base/src/components/account/profile-section.tsx +303 -226
  14. package/templates/nextjs/base/src/components/auth/register-form.tsx +326 -245
  15. package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +306 -294
  16. package/templates/nextjs/base/src/components/checkout/date-picker.tsx +13 -1
  17. package/templates/nextjs/base/src/components/checkout/datetime-picker.tsx +61 -21
  18. package/templates/nextjs/base/src/components/shared/birthday-picker.tsx +258 -0
  19. package/templates/nextjs/base/src/core/hooks/use-cart-page.ts +71 -2
  20. package/templates/nextjs/base/src/core/lib/auth.ts +155 -154
  21. package/templates/nextjs/base/src/core/lib/birthday.ts +74 -0
  22. package/templates/nextjs/base/src/core/lib/brainerce.ts.ejs +5 -16
  23. package/templates/nextjs/base/src/core/lib/store-info.ts +10 -0
  24. package/templates/nextjs/base/src/core/providers/store-provider.tsx.ejs +3 -6
  25. package/templates/nextjs/base/src/ui/cart/cart-item.tsx +19 -1
  26. package/templates/nextjs/base/src/ui/cart/cart-view.tsx +42 -6
  27. package/templates/nextjs/base/src/ui/cart/reservation-countdown.tsx +52 -10
  28. package/templates/nextjs/base/src/ui/layout/newsletter-signup.tsx +143 -0
  29. package/templates/nextjs/base/src/ui/layout/site-footer.tsx.ejs +18 -2
  30. package/templates/nextjs/base/src/ui/product/back-in-stock-form.tsx +173 -0
  31. package/templates/nextjs/base/src/ui/product/product-client-section.tsx +484 -455
  32. package/templates/nextjs/base/src/ui/product/review-form.tsx +136 -12
  33. package/templates/nextjs/base/src/ui/product/reviews-section.tsx.ejs +139 -108
  34. package/templates/nextjs/designs/atelier/ui/cart/cart-drawer.tsx +21 -3
  35. package/templates/nextjs/designs/atelier/ui/cart/cart-item.tsx +19 -1
  36. package/templates/nextjs/designs/atelier/ui/cart/cart-view.tsx +44 -7
  37. package/templates/nextjs/designs/atelier/ui/cart/reservation-countdown.tsx +52 -10
  38. package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +155 -142
  39. package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +500 -477
  40. package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +135 -11
  41. package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +179 -148
  42. package/templates/nextjs/ui-canvas/cart/cart-item.tsx +15 -1
  43. package/templates/nextjs/ui-canvas/cart/cart-view.tsx +38 -4
  44. package/templates/nextjs/ui-canvas/cart/reservation-countdown.tsx +54 -11
  45. package/templates/nextjs/ui-canvas/layout/newsletter-signup.tsx +122 -0
  46. package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +87 -83
  47. package/templates/nextjs/ui-canvas/product/back-in-stock-form.tsx +151 -0
  48. package/templates/nextjs/ui-canvas/product/product-client-section.tsx +373 -352
  49. package/templates/nextjs/ui-canvas/product/review-form.tsx +129 -11
  50. package/templates/nextjs/ui-canvas/product/reviews-section.tsx.ejs +127 -96
@@ -1,226 +1,303 @@
1
- 'use client';
2
-
3
- import { useState } from 'react';
4
- import type { CustomerProfile } from 'brainerce';
5
- import { getClient } from '@/core/lib/brainerce';
6
- import { useTranslations } from '@/core/lib/translations';
7
- import { cn } from '@/core/lib/utils';
8
-
9
- interface ProfileSectionProps {
10
- profile: CustomerProfile;
11
- onProfileUpdate?: (updated: CustomerProfile) => void;
12
- className?: string;
13
- }
14
-
15
- export function ProfileSection({ profile, onProfileUpdate, className }: ProfileSectionProps) {
16
- const t = useTranslations('account');
17
- const [editing, setEditing] = useState(false);
18
- const [saving, setSaving] = useState(false);
19
- const [message, setMessage] = useState<{ type: 'success' | 'error'; text: string } | null>(null);
20
- const [form, setForm] = useState({
21
- firstName: profile.firstName || '',
22
- lastName: profile.lastName || '',
23
- phone: profile.phone || '',
24
- });
25
-
26
- const fullName = [profile.firstName, profile.lastName].filter(Boolean).join(' ');
27
- const initials =
28
- [profile.firstName?.[0], profile.lastName?.[0]].filter(Boolean).join('').toUpperCase() ||
29
- profile.email[0].toUpperCase();
30
-
31
- function startEditing() {
32
- setForm({
33
- firstName: profile.firstName || '',
34
- lastName: profile.lastName || '',
35
- phone: profile.phone || '',
36
- });
37
- setMessage(null);
38
- setEditing(true);
39
- }
40
-
41
- function cancelEditing() {
42
- setEditing(false);
43
- setMessage(null);
44
- }
45
-
46
- async function handleSave(e: React.FormEvent) {
47
- e.preventDefault();
48
- setSaving(true);
49
- setMessage(null);
50
-
51
- try {
52
- const client = getClient();
53
- const updated = await client.updateMyProfile({
54
- firstName: form.firstName || undefined,
55
- lastName: form.lastName || undefined,
56
- phone: form.phone || undefined,
57
- });
58
- onProfileUpdate?.(updated);
59
- setEditing(false);
60
- setMessage({ type: 'success', text: t('profileUpdated') });
61
- setTimeout(() => setMessage(null), 3000);
62
- } catch {
63
- setMessage({ type: 'error', text: t('profileUpdateFailed') });
64
- } finally {
65
- setSaving(false);
66
- }
67
- }
68
-
69
- return (
70
- <div className={cn('border-border rounded-lg border p-6', className)}>
71
- <div className="flex items-start gap-4">
72
- {/* Avatar */}
73
- <div className="bg-primary/10 text-primary flex h-14 w-14 flex-shrink-0 items-center justify-center rounded-full text-lg font-semibold">
74
- {initials}
75
- </div>
76
-
77
- <div className="min-w-0 flex-1">
78
- {editing ? (
79
- <form onSubmit={handleSave} className="space-y-3">
80
- <div className="grid grid-cols-2 gap-3">
81
- <div>
82
- <label className="text-muted-foreground mb-1 block text-xs font-medium">
83
- {t('firstName')}
84
- </label>
85
- <input
86
- type="text"
87
- value={form.firstName}
88
- onChange={(e) => setForm((f) => ({ ...f, firstName: e.target.value }))}
89
- className="border-border bg-background text-foreground focus:border-primary w-full rounded-md border px-3 py-1.5 text-sm outline-none"
90
- autoFocus
91
- />
92
- </div>
93
- <div>
94
- <label className="text-muted-foreground mb-1 block text-xs font-medium">
95
- {t('lastName')}
96
- </label>
97
- <input
98
- type="text"
99
- value={form.lastName}
100
- onChange={(e) => setForm((f) => ({ ...f, lastName: e.target.value }))}
101
- className="border-border bg-background text-foreground focus:border-primary w-full rounded-md border px-3 py-1.5 text-sm outline-none"
102
- />
103
- </div>
104
- </div>
105
- <div>
106
- <label className="text-muted-foreground mb-1 block text-xs font-medium">
107
- {t('phone')}
108
- </label>
109
- <input
110
- type="tel"
111
- value={form.phone}
112
- onChange={(e) => setForm((f) => ({ ...f, phone: e.target.value }))}
113
- className="border-border bg-background text-foreground focus:border-primary w-full rounded-md border px-3 py-1.5 text-sm outline-none"
114
- />
115
- </div>
116
- <p className="text-muted-foreground truncate text-sm">{profile.email}</p>
117
- <div className="flex items-center gap-2">
118
- <button
119
- type="submit"
120
- disabled={saving}
121
- className="bg-primary text-primary-foreground rounded-md px-4 py-1.5 text-sm font-medium transition-opacity hover:opacity-90 disabled:opacity-50"
122
- >
123
- {saving ? '...' : t('save')}
124
- </button>
125
- <button
126
- type="button"
127
- onClick={cancelEditing}
128
- disabled={saving}
129
- className="text-muted-foreground hover:text-foreground rounded-md px-4 py-1.5 text-sm transition-colors disabled:opacity-50"
130
- >
131
- {t('cancel')}
132
- </button>
133
- </div>
134
- </form>
135
- ) : (
136
- <>
137
- <div className="flex items-center gap-2">
138
- {fullName && (
139
- <h2 className="text-foreground truncate text-lg font-semibold">{fullName}</h2>
140
- )}
141
- <button
142
- type="button"
143
- onClick={startEditing}
144
- className="text-muted-foreground hover:text-foreground flex-shrink-0 rounded p-1 transition-colors"
145
- title={t('editProfile')}
146
- >
147
- <svg
148
- className="h-4 w-4"
149
- fill="none"
150
- viewBox="0 0 24 24"
151
- stroke="currentColor"
152
- strokeWidth={2}
153
- >
154
- <path
155
- strokeLinecap="round"
156
- strokeLinejoin="round"
157
- d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
158
- />
159
- </svg>
160
- </button>
161
- </div>
162
- <p className="text-muted-foreground truncate text-sm">{profile.email}</p>
163
-
164
- <div className="mt-2 flex items-center gap-2">
165
- {profile.emailVerified ? (
166
- <span className="inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700 dark:bg-green-950/30 dark:text-green-400">
167
- <svg className="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
168
- <path
169
- strokeLinecap="round"
170
- strokeLinejoin="round"
171
- strokeWidth={2}
172
- d="M5 13l4 4L19 7"
173
- />
174
- </svg>
175
- {t('verified')}
176
- </span>
177
- ) : (
178
- <span className="inline-flex items-center gap-1 rounded-full bg-orange-100 px-2 py-0.5 text-xs font-medium text-orange-700 dark:bg-orange-950/30 dark:text-orange-400">
179
- <svg className="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
180
- <path
181
- strokeLinecap="round"
182
- strokeLinejoin="round"
183
- strokeWidth={2}
184
- d="M12 9v2m0 4h.01"
185
- />
186
- </svg>
187
- {t('unverified')}
188
- </span>
189
- )}
190
- </div>
191
-
192
- {profile.phone && (
193
- <p className="text-muted-foreground mt-2 text-sm">{profile.phone}</p>
194
- )}
195
-
196
- {profile.createdAt && !isNaN(new Date(profile.createdAt).getTime()) && (
197
- <p className="text-muted-foreground mt-3 text-xs">
198
- {t('memberSince')}{' '}
199
- {new Date(profile.createdAt).toLocaleDateString(undefined, {
200
- year: 'numeric',
201
- month: 'long',
202
- day: 'numeric',
203
- })}
204
- </p>
205
- )}
206
- </>
207
- )}
208
-
209
- {/* Success/Error message */}
210
- {message && (
211
- <p
212
- className={cn(
213
- 'mt-2 text-sm',
214
- message.type === 'success'
215
- ? 'text-green-600 dark:text-green-400'
216
- : 'text-red-600 dark:text-red-400'
217
- )}
218
- >
219
- {message.text}
220
- </p>
221
- )}
222
- </div>
223
- </div>
224
- </div>
225
- );
226
- }
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import type { CustomerProfile } from 'brainerce';
5
+ import { getClient } from '@/core/lib/brainerce';
6
+ import { useTranslations } from '@/core/lib/translations';
7
+ import { cn } from '@/core/lib/utils';
8
+ import { birthMonthKey, toBirthdayNumber } from '@/core/lib/birthday';
9
+ import { BirthdayPicker } from '@/components/shared/birthday-picker';
10
+
11
+ interface ProfileSectionProps {
12
+ profile: CustomerProfile;
13
+ onProfileUpdate?: (updated: CustomerProfile) => void;
14
+ className?: string;
15
+ }
16
+
17
+ export function ProfileSection({ profile, onProfileUpdate, className }: ProfileSectionProps) {
18
+ const t = useTranslations('account');
19
+ const tc = useTranslations('common');
20
+ const [editing, setEditing] = useState(false);
21
+ const [saving, setSaving] = useState(false);
22
+ const [message, setMessage] = useState<{ type: 'success' | 'error'; text: string } | null>(null);
23
+ const [form, setForm] = useState({
24
+ firstName: profile.firstName || '',
25
+ lastName: profile.lastName || '',
26
+ phone: profile.phone || '',
27
+ // Seeded from the fetched profile so a saved birthday renders back into
28
+ // the picker instead of the form reopening blank. Held as strings to match
29
+ // the other fields; '' means no birthday is set.
30
+ birthMonth: profile.birthMonth ? String(profile.birthMonth) : '',
31
+ birthDay: profile.birthDay ? String(profile.birthDay) : '',
32
+ });
33
+
34
+ const fullName = [profile.firstName, profile.lastName].filter(Boolean).join(' ');
35
+ const initials =
36
+ [profile.firstName?.[0], profile.lastName?.[0]].filter(Boolean).join('').toUpperCase() ||
37
+ profile.email[0].toUpperCase();
38
+
39
+ // Stored birthday for the read-only view. Both halves always arrive together,
40
+ // and an out-of-range month resolves to null so nothing renders rather than a
41
+ // raw key path.
42
+ const storedMonthKey = profile.birthMonth ? birthMonthKey(profile.birthMonth) : null;
43
+ const storedBirthday =
44
+ storedMonthKey && profile.birthDay
45
+ ? tc('birthdayDisplay', {
46
+ month: tc(storedMonthKey),
47
+ day: String(profile.birthDay),
48
+ })
49
+ : null;
50
+
51
+ function startEditing() {
52
+ setForm({
53
+ firstName: profile.firstName || '',
54
+ lastName: profile.lastName || '',
55
+ phone: profile.phone || '',
56
+ birthMonth: profile.birthMonth ? String(profile.birthMonth) : '',
57
+ birthDay: profile.birthDay ? String(profile.birthDay) : '',
58
+ });
59
+ setMessage(null);
60
+ setEditing(true);
61
+ }
62
+
63
+ /**
64
+ * The picker hands back both halves at once, or two nulls when the shopper
65
+ * clears the field. State stays as strings so the save path below is
66
+ * unchanged.
67
+ */
68
+ function selectBirthday(month: number | null, day: number | null) {
69
+ setForm((f) => ({
70
+ ...f,
71
+ birthMonth: month ? String(month) : '',
72
+ birthDay: day ? String(day) : '',
73
+ }));
74
+ setMessage(null);
75
+ }
76
+
77
+ function cancelEditing() {
78
+ setEditing(false);
79
+ setMessage(null);
80
+ }
81
+
82
+ async function handleSave(e: React.FormEvent) {
83
+ e.preventDefault();
84
+
85
+ const birthMonth = toBirthdayNumber(form.birthMonth);
86
+ const birthDay = toBirthdayNumber(form.birthDay);
87
+
88
+ // Half a birthday is an HTTP 400 at the API, so stop here with something
89
+ // the shopper can act on instead of showing the generic save failure.
90
+ if ((birthMonth === null) !== (birthDay === null)) {
91
+ setMessage({ type: 'error', text: tc('birthdayIncomplete') });
92
+ return;
93
+ }
94
+
95
+ setSaving(true);
96
+ setMessage(null);
97
+
98
+ try {
99
+ const client = getClient();
100
+ const updated = await client.updateMyProfile({
101
+ firstName: form.firstName || undefined,
102
+ lastName: form.lastName || undefined,
103
+ phone: form.phone || undefined,
104
+ // Deliberately NOT the `|| undefined` shape used above: leaving these
105
+ // two keys out tells the API to KEEP the stored birthday, so a shopper
106
+ // who cleared the picker could never remove it. Explicit nulls delete
107
+ // it. Do not "tidy" this back into the pattern of the fields above.
108
+ birthMonth,
109
+ birthDay,
110
+ });
111
+ onProfileUpdate?.(updated);
112
+ setEditing(false);
113
+ setMessage({ type: 'success', text: t('profileUpdated') });
114
+ setTimeout(() => setMessage(null), 3000);
115
+ } catch {
116
+ setMessage({ type: 'error', text: t('profileUpdateFailed') });
117
+ } finally {
118
+ setSaving(false);
119
+ }
120
+ }
121
+
122
+ return (
123
+ <div className={cn('border-border rounded-lg border p-6', className)}>
124
+ <div className="flex items-start gap-4">
125
+ {/* Avatar */}
126
+ <div className="bg-primary/10 text-primary flex h-14 w-14 flex-shrink-0 items-center justify-center rounded-full text-lg font-semibold">
127
+ {initials}
128
+ </div>
129
+
130
+ <div className="min-w-0 flex-1">
131
+ {editing ? (
132
+ <form onSubmit={handleSave} className="space-y-3">
133
+ <div className="grid grid-cols-2 gap-3">
134
+ <div>
135
+ <label className="text-muted-foreground mb-1 block text-xs font-medium">
136
+ {t('firstName')}
137
+ </label>
138
+ <input
139
+ type="text"
140
+ value={form.firstName}
141
+ onChange={(e) => setForm((f) => ({ ...f, firstName: e.target.value }))}
142
+ className="border-border bg-background text-foreground focus:border-primary w-full rounded-md border px-3 py-1.5 text-sm outline-none"
143
+ autoFocus
144
+ />
145
+ </div>
146
+ <div>
147
+ <label className="text-muted-foreground mb-1 block text-xs font-medium">
148
+ {t('lastName')}
149
+ </label>
150
+ <input
151
+ type="text"
152
+ value={form.lastName}
153
+ onChange={(e) => setForm((f) => ({ ...f, lastName: e.target.value }))}
154
+ className="border-border bg-background text-foreground focus:border-primary w-full rounded-md border px-3 py-1.5 text-sm outline-none"
155
+ />
156
+ </div>
157
+ </div>
158
+ <div>
159
+ <label className="text-muted-foreground mb-1 block text-xs font-medium">
160
+ {t('phone')}
161
+ </label>
162
+ <input
163
+ type="tel"
164
+ value={form.phone}
165
+ onChange={(e) => setForm((f) => ({ ...f, phone: e.target.value }))}
166
+ className="border-border bg-background text-foreground focus:border-primary w-full rounded-md border px-3 py-1.5 text-sm outline-none"
167
+ />
168
+ </div>
169
+ {/* Month and day only. Never collect a birth year: the gift
170
+ needs the date, not the age. */}
171
+ <div>
172
+ <label
173
+ htmlFor="profile-birthday"
174
+ className="text-muted-foreground mb-1 block text-xs font-medium"
175
+ >
176
+ {tc('birthday')}
177
+ </label>
178
+ <BirthdayPicker
179
+ id="profile-birthday"
180
+ month={toBirthdayNumber(form.birthMonth)}
181
+ day={toBirthdayNumber(form.birthDay)}
182
+ onChange={selectBirthday}
183
+ triggerClassName="rounded-md"
184
+ />
185
+ <p className="text-muted-foreground mt-1 text-xs">{tc('birthdayGiftNote')}</p>
186
+ </div>
187
+ <p className="text-muted-foreground truncate text-sm">{profile.email}</p>
188
+ <div className="flex items-center gap-2">
189
+ <button
190
+ type="submit"
191
+ disabled={saving}
192
+ className="bg-primary text-primary-foreground rounded-md px-4 py-1.5 text-sm font-medium transition-opacity hover:opacity-90 disabled:opacity-50"
193
+ >
194
+ {saving ? '...' : t('save')}
195
+ </button>
196
+ <button
197
+ type="button"
198
+ onClick={cancelEditing}
199
+ disabled={saving}
200
+ className="text-muted-foreground hover:text-foreground rounded-md px-4 py-1.5 text-sm transition-colors disabled:opacity-50"
201
+ >
202
+ {t('cancel')}
203
+ </button>
204
+ </div>
205
+ </form>
206
+ ) : (
207
+ <>
208
+ <div className="flex items-center gap-2">
209
+ {fullName && (
210
+ <h2 className="text-foreground truncate text-lg font-semibold">{fullName}</h2>
211
+ )}
212
+ <button
213
+ type="button"
214
+ onClick={startEditing}
215
+ className="text-muted-foreground hover:text-foreground flex-shrink-0 rounded p-1 transition-colors"
216
+ title={t('editProfile')}
217
+ >
218
+ <svg
219
+ className="h-4 w-4"
220
+ fill="none"
221
+ viewBox="0 0 24 24"
222
+ stroke="currentColor"
223
+ strokeWidth={2}
224
+ >
225
+ <path
226
+ strokeLinecap="round"
227
+ strokeLinejoin="round"
228
+ d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
229
+ />
230
+ </svg>
231
+ </button>
232
+ </div>
233
+ <p className="text-muted-foreground truncate text-sm">{profile.email}</p>
234
+
235
+ <div className="mt-2 flex items-center gap-2">
236
+ {profile.emailVerified ? (
237
+ <span className="inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700 dark:bg-green-950/30 dark:text-green-400">
238
+ <svg className="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
239
+ <path
240
+ strokeLinecap="round"
241
+ strokeLinejoin="round"
242
+ strokeWidth={2}
243
+ d="M5 13l4 4L19 7"
244
+ />
245
+ </svg>
246
+ {t('verified')}
247
+ </span>
248
+ ) : (
249
+ <span className="inline-flex items-center gap-1 rounded-full bg-orange-100 px-2 py-0.5 text-xs font-medium text-orange-700 dark:bg-orange-950/30 dark:text-orange-400">
250
+ <svg className="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
251
+ <path
252
+ strokeLinecap="round"
253
+ strokeLinejoin="round"
254
+ strokeWidth={2}
255
+ d="M12 9v2m0 4h.01"
256
+ />
257
+ </svg>
258
+ {t('unverified')}
259
+ </span>
260
+ )}
261
+ </div>
262
+
263
+ {profile.phone && (
264
+ <p className="text-muted-foreground mt-2 text-sm">{profile.phone}</p>
265
+ )}
266
+
267
+ {storedBirthday && (
268
+ <p className="text-muted-foreground mt-2 text-sm">
269
+ {tc('birthday')} {storedBirthday}
270
+ </p>
271
+ )}
272
+
273
+ {profile.createdAt && !isNaN(new Date(profile.createdAt).getTime()) && (
274
+ <p className="text-muted-foreground mt-3 text-xs">
275
+ {t('memberSince')}{' '}
276
+ {new Date(profile.createdAt).toLocaleDateString(undefined, {
277
+ year: 'numeric',
278
+ month: 'long',
279
+ day: 'numeric',
280
+ })}
281
+ </p>
282
+ )}
283
+ </>
284
+ )}
285
+
286
+ {/* Success/Error message */}
287
+ {message && (
288
+ <p
289
+ className={cn(
290
+ 'mt-2 text-sm',
291
+ message.type === 'success'
292
+ ? 'text-green-600 dark:text-green-400'
293
+ : 'text-red-600 dark:text-red-400'
294
+ )}
295
+ >
296
+ {message.text}
297
+ </p>
298
+ )}
299
+ </div>
300
+ </div>
301
+ </div>
302
+ );
303
+ }