create-brainerce-store 1.67.0 → 1.71.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.
- package/dist/index.js +22 -2
- package/messages/en.json +52 -2
- package/messages/he.json +52 -2
- package/package.json +1 -1
- package/templates/nextjs/base/.env.local.ejs +7 -0
- package/templates/nextjs/base/AGENTS.md.ejs +7 -0
- package/templates/nextjs/base/CLAUDE.md.ejs +7 -0
- package/templates/nextjs/base/src/app/blog/[slug]/page.tsx.ejs +8 -2
- package/templates/nextjs/base/src/app/category/[slug]/page.tsx +16 -7
- package/templates/nextjs/base/src/app/checkout/page.tsx +1018 -1017
- package/templates/nextjs/base/src/app/error.tsx.ejs +53 -0
- package/templates/nextjs/base/src/app/pages/[slug]/page.tsx.ejs +8 -2
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +17 -7
- package/templates/nextjs/base/src/app/register/page.tsx +67 -64
- package/templates/nextjs/base/src/components/account/profile-section.tsx +303 -226
- package/templates/nextjs/base/src/components/auth/register-form.tsx +326 -245
- package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +306 -294
- package/templates/nextjs/base/src/components/checkout/date-picker.tsx +13 -1
- package/templates/nextjs/base/src/components/checkout/datetime-picker.tsx +61 -21
- package/templates/nextjs/base/src/components/shared/birthday-picker.tsx +258 -0
- package/templates/nextjs/base/src/core/lib/auth.ts +162 -154
- package/templates/nextjs/base/src/core/lib/birthday.ts +74 -0
- package/templates/nextjs/base/src/core/lib/site-url.ts +42 -9
- package/templates/nextjs/base/src/core/lib/store-info.ts +10 -0
- package/templates/nextjs/base/src/ui/layout/newsletter-signup.tsx +143 -0
- package/templates/nextjs/base/src/ui/layout/site-footer.tsx.ejs +18 -2
- package/templates/nextjs/base/src/ui/product/back-in-stock-form.tsx +173 -0
- package/templates/nextjs/base/src/ui/product/product-client-section.tsx +484 -455
- package/templates/nextjs/base/src/ui/product/review-form.tsx +136 -12
- package/templates/nextjs/base/src/ui/product/reviews-section.tsx.ejs +139 -108
- package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +155 -142
- package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +500 -477
- package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +135 -11
- package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +179 -148
- package/templates/nextjs/ui-canvas/layout/newsletter-signup.tsx +122 -0
- package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +87 -83
- package/templates/nextjs/ui-canvas/product/back-in-stock-form.tsx +151 -0
- package/templates/nextjs/ui-canvas/product/product-client-section.tsx +373 -352
- package/templates/nextjs/ui-canvas/product/review-form.tsx +129 -11
- 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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
>
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
{
|
|
199
|
-
{
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
+
}
|