create-brainerce-store 1.6.0 → 1.6.1
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 +1 -1
- package/messages/en.json +286 -286
- package/messages/he.json +286 -286
- package/package.json +1 -1
- package/templates/nextjs/base/next.config.ts +31 -9
- package/templates/nextjs/base/src/app/forgot-password/page.tsx +111 -111
- package/templates/nextjs/base/src/app/reset-password/page.tsx +161 -161
- package/templates/nextjs/base/src/components/auth/login-form.tsx +101 -101
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import Link from 'next/link';
|
|
5
|
-
import { useTranslations } from '@/lib/translations';
|
|
6
|
-
import { cn } from '@/lib/utils';
|
|
7
|
-
import { LoadingSpinner } from '@/components/shared/loading-spinner';
|
|
8
|
-
|
|
9
|
-
interface LoginFormProps {
|
|
10
|
-
onSubmit: (email: string, password: string) => Promise<void>;
|
|
11
|
-
error?: string | null;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function LoginForm({ onSubmit, error, className }: LoginFormProps) {
|
|
16
|
-
const t = useTranslations('auth');
|
|
17
|
-
const [email, setEmail] = useState('');
|
|
18
|
-
const [password, setPassword] = useState('');
|
|
19
|
-
const [loading, setLoading] = useState(false);
|
|
20
|
-
|
|
21
|
-
async function handleSubmit(e: React.FormEvent) {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
if (loading) return;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
setLoading(true);
|
|
27
|
-
await onSubmit(email, password);
|
|
28
|
-
} finally {
|
|
29
|
-
setLoading(false);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<form onSubmit={handleSubmit} className={cn('space-y-4', className)}>
|
|
35
|
-
{error && (
|
|
36
|
-
<div className="bg-destructive/10 border-destructive/20 text-destructive rounded-lg border px-4 py-3 text-sm">
|
|
37
|
-
{error}
|
|
38
|
-
</div>
|
|
39
|
-
)}
|
|
40
|
-
|
|
41
|
-
<div>
|
|
42
|
-
<label htmlFor="login-email" className="text-foreground mb-1.5 block text-sm font-medium">
|
|
43
|
-
{t('email')}
|
|
44
|
-
</label>
|
|
45
|
-
<input
|
|
46
|
-
id="login-email"
|
|
47
|
-
type="email"
|
|
48
|
-
required
|
|
49
|
-
value={email}
|
|
50
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
51
|
-
placeholder={t('emailPlaceholder')}
|
|
52
|
-
autoComplete="email"
|
|
53
|
-
className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div>
|
|
58
|
-
<label
|
|
59
|
-
htmlFor="login-password"
|
|
60
|
-
className="text-foreground mb-1.5 block text-sm font-medium"
|
|
61
|
-
>
|
|
62
|
-
{t('password')}
|
|
63
|
-
</label>
|
|
64
|
-
<input
|
|
65
|
-
id="login-password"
|
|
66
|
-
type="password"
|
|
67
|
-
required
|
|
68
|
-
value={password}
|
|
69
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
70
|
-
placeholder={t('passwordPlaceholder')}
|
|
71
|
-
autoComplete="current-password"
|
|
72
|
-
className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div className="flex justify-end">
|
|
77
|
-
<Link href="/forgot-password" className="text-primary text-sm hover:underline">
|
|
78
|
-
{t('forgotPassword')}
|
|
79
|
-
</Link>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<button
|
|
83
|
-
type="submit"
|
|
84
|
-
disabled={loading}
|
|
85
|
-
className="bg-primary text-primary-foreground flex h-10 w-full items-center justify-center gap-2 rounded text-sm font-medium transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50"
|
|
86
|
-
>
|
|
87
|
-
{loading ? (
|
|
88
|
-
<>
|
|
89
|
-
<LoadingSpinner
|
|
90
|
-
size="sm"
|
|
91
|
-
className="border-primary-foreground/30 border-t-primary-foreground"
|
|
92
|
-
/>
|
|
93
|
-
{t('signingIn')}
|
|
94
|
-
</>
|
|
95
|
-
) : (
|
|
96
|
-
t('signIn')
|
|
97
|
-
)}
|
|
98
|
-
</button>
|
|
99
|
-
</form>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { useTranslations } from '@/lib/translations';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
import { LoadingSpinner } from '@/components/shared/loading-spinner';
|
|
8
|
+
|
|
9
|
+
interface LoginFormProps {
|
|
10
|
+
onSubmit: (email: string, password: string) => Promise<void>;
|
|
11
|
+
error?: string | null;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function LoginForm({ onSubmit, error, className }: LoginFormProps) {
|
|
16
|
+
const t = useTranslations('auth');
|
|
17
|
+
const [email, setEmail] = useState('');
|
|
18
|
+
const [password, setPassword] = useState('');
|
|
19
|
+
const [loading, setLoading] = useState(false);
|
|
20
|
+
|
|
21
|
+
async function handleSubmit(e: React.FormEvent) {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
if (loading) return;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
setLoading(true);
|
|
27
|
+
await onSubmit(email, password);
|
|
28
|
+
} finally {
|
|
29
|
+
setLoading(false);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<form onSubmit={handleSubmit} className={cn('space-y-4', className)}>
|
|
35
|
+
{error && (
|
|
36
|
+
<div className="bg-destructive/10 border-destructive/20 text-destructive rounded-lg border px-4 py-3 text-sm">
|
|
37
|
+
{error}
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
<div>
|
|
42
|
+
<label htmlFor="login-email" className="text-foreground mb-1.5 block text-sm font-medium">
|
|
43
|
+
{t('email')}
|
|
44
|
+
</label>
|
|
45
|
+
<input
|
|
46
|
+
id="login-email"
|
|
47
|
+
type="email"
|
|
48
|
+
required
|
|
49
|
+
value={email}
|
|
50
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
51
|
+
placeholder={t('emailPlaceholder')}
|
|
52
|
+
autoComplete="email"
|
|
53
|
+
className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div>
|
|
58
|
+
<label
|
|
59
|
+
htmlFor="login-password"
|
|
60
|
+
className="text-foreground mb-1.5 block text-sm font-medium"
|
|
61
|
+
>
|
|
62
|
+
{t('password')}
|
|
63
|
+
</label>
|
|
64
|
+
<input
|
|
65
|
+
id="login-password"
|
|
66
|
+
type="password"
|
|
67
|
+
required
|
|
68
|
+
value={password}
|
|
69
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
70
|
+
placeholder={t('passwordPlaceholder')}
|
|
71
|
+
autoComplete="current-password"
|
|
72
|
+
className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div className="flex justify-end">
|
|
77
|
+
<Link href="/forgot-password" className="text-primary text-sm hover:underline">
|
|
78
|
+
{t('forgotPassword')}
|
|
79
|
+
</Link>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<button
|
|
83
|
+
type="submit"
|
|
84
|
+
disabled={loading}
|
|
85
|
+
className="bg-primary text-primary-foreground flex h-10 w-full items-center justify-center gap-2 rounded text-sm font-medium transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50"
|
|
86
|
+
>
|
|
87
|
+
{loading ? (
|
|
88
|
+
<>
|
|
89
|
+
<LoadingSpinner
|
|
90
|
+
size="sm"
|
|
91
|
+
className="border-primary-foreground/30 border-t-primary-foreground"
|
|
92
|
+
/>
|
|
93
|
+
{t('signingIn')}
|
|
94
|
+
</>
|
|
95
|
+
) : (
|
|
96
|
+
t('signIn')
|
|
97
|
+
)}
|
|
98
|
+
</button>
|
|
99
|
+
</form>
|
|
100
|
+
);
|
|
101
|
+
}
|