@digilogiclabs/create-saas-app 2.8.0 → 2.9.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/.tsbuildinfo +1 -1
- package/dist/generators/template-generator.js +8 -8
- package/dist/generators/template-generator.js.map +1 -1
- package/dist/templates/shared/quality/web/src/__tests__/accessibility.test.tsx +3 -3
- package/dist/templates/web/ai-platform/template/src/app/page.tsx +207 -207
- package/dist/templates/web/base/template/package.json +1 -3
- package/dist/templates/web/base/template/src/app/auth/callback/route.ts +32 -18
- package/dist/templates/web/base/template/src/app/dashboard/page.tsx +6 -43
- package/dist/templates/web/base/template/src/app/globals.css +158 -157
- package/dist/templates/web/base/template/src/app/page.tsx +2 -2
- package/dist/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +800 -800
- package/dist/templates/web/ui-auth/template/src/app/globals.css +96 -95
- package/dist/templates/web/ui-auth/template/src/app/login/page.tsx +109 -109
- package/dist/templates/web/ui-auth/template/src/app/page.tsx +4 -3
- package/dist/templates/web/ui-auth/template/src/app/signup/page.tsx +128 -128
- package/dist/templates/web/ui-auth-ai/template/src/app/globals.css +35 -40
- package/dist/templates/web/ui-auth-ai/template/src/app/layout.tsx +1 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +3 -3
- package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +10 -49
- package/dist/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +800 -800
- package/dist/templates/web/ui-auth-payments/template/src/app/globals.css +212 -211
- package/dist/templates/web/ui-auth-payments/template/src/app/login/page.tsx +109 -109
- package/dist/templates/web/ui-auth-payments/template/src/app/page.tsx +350 -350
- package/dist/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +506 -506
- package/dist/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +128 -128
- package/dist/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +143 -143
- package/dist/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +184 -184
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +143 -233
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +10 -50
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +800 -800
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/globals.css +97 -96
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +325 -364
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +389 -532
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +644 -644
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +119 -163
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +158 -201
- package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +1 -2
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +10 -51
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/globals.css +97 -96
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +402 -403
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +143 -143
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +184 -184
- package/dist/templates/web/ui-auth-payments-video/template/src/app/globals.css +229 -228
- package/dist/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +1 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/app/page.tsx +4 -7
- package/dist/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +1 -1
- package/dist/templates/web/ui-only/template/src/app/globals.css +43 -42
- package/package.json +1 -1
- package/src/templates/shared/quality/web/src/__tests__/accessibility.test.tsx +3 -3
- package/src/templates/web/ai-platform/template/src/app/page.tsx +207 -207
- package/src/templates/web/base/template/package.json +1 -3
- package/src/templates/web/base/template/src/app/auth/callback/route.ts +32 -18
- package/src/templates/web/base/template/src/app/dashboard/page.tsx +6 -43
- package/src/templates/web/base/template/src/app/globals.css +158 -157
- package/src/templates/web/base/template/src/app/page.tsx +2 -2
- package/src/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +800 -800
- package/src/templates/web/ui-auth/template/src/app/globals.css +96 -95
- package/src/templates/web/ui-auth/template/src/app/login/page.tsx +109 -109
- package/src/templates/web/ui-auth/template/src/app/page.tsx +4 -3
- package/src/templates/web/ui-auth/template/src/app/signup/page.tsx +128 -128
- package/src/templates/web/ui-auth-ai/template/src/app/globals.css +35 -40
- package/src/templates/web/ui-auth-ai/template/src/app/layout.tsx +1 -0
- package/src/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +3 -3
- package/src/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +10 -49
- package/src/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +800 -800
- package/src/templates/web/ui-auth-payments/template/src/app/globals.css +212 -211
- package/src/templates/web/ui-auth-payments/template/src/app/login/page.tsx +109 -109
- package/src/templates/web/ui-auth-payments/template/src/app/page.tsx +350 -350
- package/src/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +506 -506
- package/src/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +128 -128
- package/src/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +143 -143
- package/src/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +184 -184
- package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +143 -233
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +10 -50
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +800 -800
- package/src/templates/web/ui-auth-payments-ai/template/src/app/globals.css +97 -96
- package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +325 -364
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +389 -532
- package/src/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +644 -644
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +119 -163
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +158 -201
- package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +1 -2
- package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +10 -51
- package/src/templates/web/ui-auth-payments-audio/template/src/app/globals.css +97 -96
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +402 -403
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +143 -143
- package/src/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +184 -184
- package/src/templates/web/ui-auth-payments-video/template/src/app/globals.css +229 -228
- package/src/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +1 -1
- package/src/templates/web/ui-auth-payments-video/template/src/app/page.tsx +4 -7
- package/src/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +1 -1
- package/src/templates/web/ui-only/template/src/app/globals.css +43 -42
|
@@ -1,211 +1,212 @@
|
|
|
1
|
-
|
|
2
|
-
@
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
--
|
|
12
|
-
--
|
|
13
|
-
--card
|
|
14
|
-
--
|
|
15
|
-
--primary
|
|
16
|
-
--
|
|
17
|
-
--secondary
|
|
18
|
-
--
|
|
19
|
-
--
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
--
|
|
25
|
-
--
|
|
26
|
-
--card
|
|
27
|
-
--
|
|
28
|
-
--primary
|
|
29
|
-
--
|
|
30
|
-
--secondary
|
|
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
|
-
min-
|
|
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
|
-
animation-
|
|
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
|
-
background
|
|
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
|
-
animation-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1
|
+
/* Import SaaS Factory UI styles */
|
|
2
|
+
@import '@digilogiclabs/saas-factory-ui/dist/index.css';
|
|
3
|
+
|
|
4
|
+
@tailwind base;
|
|
5
|
+
@tailwind components;
|
|
6
|
+
@tailwind utilities;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@layer base {
|
|
10
|
+
:root {
|
|
11
|
+
--background: 0 0% 100%;
|
|
12
|
+
--foreground: 222.2 84% 4.9%;
|
|
13
|
+
--card: 0 0% 100%;
|
|
14
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
15
|
+
--primary: 221.2 83.2% 53.3%;
|
|
16
|
+
--primary-foreground: 210 40% 98%;
|
|
17
|
+
--secondary: 210 40% 96%;
|
|
18
|
+
--secondary-foreground: 222.2 84% 4.9%;
|
|
19
|
+
--border: 214.3 31.8% 91.4%;
|
|
20
|
+
--radius: 0.5rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dark {
|
|
24
|
+
--background: 222.2 84% 4.9%;
|
|
25
|
+
--foreground: 210 40% 98%;
|
|
26
|
+
--card: 222.2 84% 4.9%;
|
|
27
|
+
--card-foreground: 210 40% 98%;
|
|
28
|
+
--primary: 217.2 91.2% 59.8%;
|
|
29
|
+
--primary-foreground: 222.2 84% 4.9%;
|
|
30
|
+
--secondary: 217.2 32.6% 17.5%;
|
|
31
|
+
--secondary-foreground: 210 40% 98%;
|
|
32
|
+
--border: 217.2 32.6% 17.5%;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@layer base {
|
|
37
|
+
* {
|
|
38
|
+
@apply border-border;
|
|
39
|
+
}
|
|
40
|
+
body {
|
|
41
|
+
@apply bg-background text-foreground;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Mobile-first optimizations */
|
|
46
|
+
@media (max-width: 768px) {
|
|
47
|
+
.mobile-optimized {
|
|
48
|
+
touch-action: manipulation;
|
|
49
|
+
-webkit-tap-highlight-color: transparent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Better touch targets */
|
|
53
|
+
button,
|
|
54
|
+
a,
|
|
55
|
+
input,
|
|
56
|
+
select,
|
|
57
|
+
textarea {
|
|
58
|
+
min-height: 44px;
|
|
59
|
+
min-width: 44px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Smooth scrolling for mobile */
|
|
63
|
+
html {
|
|
64
|
+
scroll-behavior: smooth;
|
|
65
|
+
-webkit-overflow-scrolling: touch;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Animated moving banner */
|
|
70
|
+
@keyframes marquee {
|
|
71
|
+
0% {
|
|
72
|
+
transform: translate3d(100%, 0, 0);
|
|
73
|
+
}
|
|
74
|
+
100% {
|
|
75
|
+
transform: translate3d(-100%, 0, 0);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.animate-marquee {
|
|
80
|
+
animation: marquee 15s linear infinite;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Network-aware styles */
|
|
84
|
+
@media (prefers-reduced-data: reduce) {
|
|
85
|
+
.high-bandwidth-content {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Reduced motion preferences */
|
|
91
|
+
@media (prefers-reduced-motion: reduce) {
|
|
92
|
+
*,
|
|
93
|
+
*::before,
|
|
94
|
+
*::after {
|
|
95
|
+
animation-duration: 0.01ms !important;
|
|
96
|
+
animation-iteration-count: 1 !important;
|
|
97
|
+
transition-duration: 0.01ms !important;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.animate-marquee {
|
|
101
|
+
animation: none;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Hamburger menu animations */
|
|
106
|
+
.hamburger-line {
|
|
107
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
108
|
+
transform-origin: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.hamburger-open .hamburger-line:nth-child(1) {
|
|
112
|
+
transform: rotate(45deg) translate(6px, 6px);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.hamburger-open .hamburger-line:nth-child(2) {
|
|
116
|
+
opacity: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.hamburger-open .hamburger-line:nth-child(3) {
|
|
120
|
+
transform: rotate(-45deg) translate(6px, -6px);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Custom animations for mobile interactions */
|
|
124
|
+
@keyframes haptic-feedback {
|
|
125
|
+
0% { transform: scale(1); }
|
|
126
|
+
50% { transform: scale(0.95); }
|
|
127
|
+
100% { transform: scale(1); }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.haptic-feedback {
|
|
131
|
+
animation: haptic-feedback 0.1s ease-in-out;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Offline indicator styles */
|
|
135
|
+
.offline-indicator {
|
|
136
|
+
position: fixed;
|
|
137
|
+
top: 0;
|
|
138
|
+
left: 0;
|
|
139
|
+
right: 0;
|
|
140
|
+
background: #f59e0b;
|
|
141
|
+
color: white;
|
|
142
|
+
text-align: center;
|
|
143
|
+
padding: 8px;
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
z-index: 9999;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Loading states */
|
|
149
|
+
.loading-skeleton {
|
|
150
|
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
151
|
+
background-size: 200% 100%;
|
|
152
|
+
animation: loading 1.5s infinite;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@keyframes loading {
|
|
156
|
+
0% {
|
|
157
|
+
background-position: 200% 0;
|
|
158
|
+
}
|
|
159
|
+
100% {
|
|
160
|
+
background-position: -200% 0;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* Progressive image loading */
|
|
165
|
+
.progressive-image {
|
|
166
|
+
filter: blur(5px);
|
|
167
|
+
transition: filter 0.3s;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.progressive-image.loaded {
|
|
171
|
+
filter: blur(0);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* Additional custom animations for enhanced visual effects */
|
|
175
|
+
@keyframes slide-down {
|
|
176
|
+
from {
|
|
177
|
+
opacity: 0;
|
|
178
|
+
transform: translateY(-10px);
|
|
179
|
+
}
|
|
180
|
+
to {
|
|
181
|
+
opacity: 1;
|
|
182
|
+
transform: translateY(0);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@keyframes fade-in-up {
|
|
187
|
+
from {
|
|
188
|
+
opacity: 0;
|
|
189
|
+
transform: translateY(10px);
|
|
190
|
+
}
|
|
191
|
+
to {
|
|
192
|
+
opacity: 1;
|
|
193
|
+
transform: translateY(0);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.animate-slide-down {
|
|
198
|
+
animation: slide-down 0.6s ease-out;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.animate-fade-in-up {
|
|
202
|
+
animation: fade-in-up 0.6s ease-out;
|
|
203
|
+
animation-fill-mode: both;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.animation-delay-2000 {
|
|
207
|
+
animation-delay: 2s;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.animation-delay-4000 {
|
|
211
|
+
animation-delay: 4s;
|
|
212
|
+
}
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui';
|
|
5
|
-
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
|
-
import { useRouter } from 'next/navigation';
|
|
7
|
-
|
|
8
|
-
export default function LoginPage() {
|
|
9
|
-
const [email, setEmail] = useState('');
|
|
10
|
-
const [password, setPassword] = useState('');
|
|
11
|
-
const { signIn, signInWithOAuth, loading, error, user } = useAuth();
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
|
|
14
|
-
// Redirect if already logged in
|
|
15
|
-
React.useEffect(() => {
|
|
16
|
-
if (user) {
|
|
17
|
-
router.push('/');
|
|
18
|
-
}
|
|
19
|
-
}, [user, router]);
|
|
20
|
-
|
|
21
|
-
const handleLogin = async (e: React.FormEvent) => {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
try {
|
|
24
|
-
await signIn(email, password);
|
|
25
|
-
router.push('/');
|
|
26
|
-
} catch (err) {
|
|
27
|
-
console.error('Login error:', err);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const handleGoogleLogin = async () => {
|
|
32
|
-
try {
|
|
33
|
-
await signInWithOAuth('google'
|
|
34
|
-
} catch (err) {
|
|
35
|
-
console.error('Google login error:', err);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
if (loading) {
|
|
40
|
-
return (
|
|
41
|
-
<div className="flex items-center justify-center min-h-screen bg-gray-100">
|
|
42
|
-
<div>Loading...</div>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div className="flex items-center justify-center min-h-screen bg-gray-100">
|
|
49
|
-
<Card className="w-full max-w-md p-8">
|
|
50
|
-
<h1 className="text-2xl font-bold text-center mb-6">Sign In</h1>
|
|
51
|
-
|
|
52
|
-
{error && (
|
|
53
|
-
<div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
|
|
54
|
-
{error.message}
|
|
55
|
-
</div>
|
|
56
|
-
)}
|
|
57
|
-
|
|
58
|
-
<form onSubmit={handleLogin} className="space-y-4">
|
|
59
|
-
<div>
|
|
60
|
-
<Label htmlFor="email">Email</Label>
|
|
61
|
-
<Input
|
|
62
|
-
id="email"
|
|
63
|
-
type="email"
|
|
64
|
-
value={email}
|
|
65
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
66
|
-
placeholder="Enter your email"
|
|
67
|
-
required
|
|
68
|
-
disabled={loading}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
<div>
|
|
72
|
-
<Label htmlFor="password">Password</Label>
|
|
73
|
-
<Input
|
|
74
|
-
id="password"
|
|
75
|
-
type="password"
|
|
76
|
-
value={password}
|
|
77
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
78
|
-
placeholder="Enter your password"
|
|
79
|
-
required
|
|
80
|
-
disabled={loading}
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
<Button type="submit" className="w-full" disabled={loading}>
|
|
84
|
-
{loading ? 'Signing In...' : 'Sign In'}
|
|
85
|
-
</Button>
|
|
86
|
-
<Button
|
|
87
|
-
type="button"
|
|
88
|
-
variant="outline"
|
|
89
|
-
className="w-full"
|
|
90
|
-
onClick={handleGoogleLogin}
|
|
91
|
-
disabled={loading}
|
|
92
|
-
>
|
|
93
|
-
Sign in with Google
|
|
94
|
-
</Button>
|
|
95
|
-
</form>
|
|
96
|
-
|
|
97
|
-
<div className="mt-4 text-center">
|
|
98
|
-
<p className="text-sm text-gray-600">
|
|
99
|
-
Don't have an account?{' '}
|
|
100
|
-
<a href="/signup" className="text-blue-600 hover:underline">
|
|
101
|
-
Sign up
|
|
102
|
-
</a>
|
|
103
|
-
</p>
|
|
104
|
-
</div>
|
|
105
|
-
</Card>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui';
|
|
5
|
+
import { useAuth } from '@digilogiclabs/app-sdk';
|
|
6
|
+
import { useRouter } from 'next/navigation';
|
|
7
|
+
|
|
8
|
+
export default function LoginPage() {
|
|
9
|
+
const [email, setEmail] = useState('');
|
|
10
|
+
const [password, setPassword] = useState('');
|
|
11
|
+
const { signIn, signInWithOAuth, loading, error, user } = useAuth();
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
|
|
14
|
+
// Redirect if already logged in
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (user) {
|
|
17
|
+
router.push('/');
|
|
18
|
+
}
|
|
19
|
+
}, [user, router]);
|
|
20
|
+
|
|
21
|
+
const handleLogin = async (e: React.FormEvent) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
try {
|
|
24
|
+
await signIn(email, password);
|
|
25
|
+
router.push('/');
|
|
26
|
+
} catch (err) {
|
|
27
|
+
console.error('Login error:', err);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleGoogleLogin = async () => {
|
|
32
|
+
try {
|
|
33
|
+
await signInWithOAuth('google');
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error('Google login error:', err);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (loading) {
|
|
40
|
+
return (
|
|
41
|
+
<div className="flex items-center justify-center min-h-screen bg-gray-100">
|
|
42
|
+
<div>Loading...</div>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className="flex items-center justify-center min-h-screen bg-gray-100">
|
|
49
|
+
<Card className="w-full max-w-md p-8">
|
|
50
|
+
<h1 className="text-2xl font-bold text-center mb-6">Sign In</h1>
|
|
51
|
+
|
|
52
|
+
{error && (
|
|
53
|
+
<div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
|
|
54
|
+
{error.message}
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
<form onSubmit={handleLogin} className="space-y-4">
|
|
59
|
+
<div>
|
|
60
|
+
<Label htmlFor="email">Email</Label>
|
|
61
|
+
<Input
|
|
62
|
+
id="email"
|
|
63
|
+
type="email"
|
|
64
|
+
value={email}
|
|
65
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
66
|
+
placeholder="Enter your email"
|
|
67
|
+
required
|
|
68
|
+
disabled={loading}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
<div>
|
|
72
|
+
<Label htmlFor="password">Password</Label>
|
|
73
|
+
<Input
|
|
74
|
+
id="password"
|
|
75
|
+
type="password"
|
|
76
|
+
value={password}
|
|
77
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
78
|
+
placeholder="Enter your password"
|
|
79
|
+
required
|
|
80
|
+
disabled={loading}
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
<Button type="submit" className="w-full" disabled={loading}>
|
|
84
|
+
{loading ? 'Signing In...' : 'Sign In'}
|
|
85
|
+
</Button>
|
|
86
|
+
<Button
|
|
87
|
+
type="button"
|
|
88
|
+
variant="outline"
|
|
89
|
+
className="w-full"
|
|
90
|
+
onClick={handleGoogleLogin}
|
|
91
|
+
disabled={loading}
|
|
92
|
+
>
|
|
93
|
+
Sign in with Google
|
|
94
|
+
</Button>
|
|
95
|
+
</form>
|
|
96
|
+
|
|
97
|
+
<div className="mt-4 text-center">
|
|
98
|
+
<p className="text-sm text-gray-600">
|
|
99
|
+
Don't have an account?{' '}
|
|
100
|
+
<a href="/signup" className="text-blue-600 hover:underline">
|
|
101
|
+
Sign up
|
|
102
|
+
</a>
|
|
103
|
+
</p>
|
|
104
|
+
</div>
|
|
105
|
+
</Card>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|