@@ -79,36 +79,53 @@ export default function AuthComponent({ onClose }: AuthComponentProps = { onClos
79
79
const handleOAuthSignIn = async ( provider : 'github' | 'google' | 'apple' ) => {
80
80
if ( ! supabase ) return
81
81
82
- const { error } = await supabase . auth . signInWithOAuth ( {
83
- provider,
84
- options : {
85
- redirectTo : `${ window . location . origin } /auth/callback` ,
86
- } ,
87
- } )
82
+ setLoading ( true )
83
+ setError ( null )
88
84
89
- if ( error ) {
90
- setError ( error . message )
85
+ try {
86
+ const { error } = await supabase . auth . signInWithOAuth ( {
87
+ provider,
88
+ options : {
89
+ redirectTo : `${ window . location . origin } /auth/callback` ,
90
+ } ,
91
+ } )
92
+ if ( error ) {
93
+ setError ( error . message )
94
+ }
95
+ } catch ( err ) {
96
+ setError ( 'An unexpected error occurred' )
97
+ } finally {
98
+ setLoading ( false )
91
99
}
92
100
}
93
101
94
102
if ( ! supabase ) {
95
103
return < div className = "text-center text-gray-300" > Loading...</ div >
96
104
}
97
105
106
+ if ( loading ) {
107
+ return (
108
+ < div className = "w-full min-w-md max-w-md p-8 bg-bolt-elements-background-depth-2 rounded-lg shadow-lg flex flex-col items-center justify-center gap-4" >
109
+ < div className = "i-svg-spinners:90-ring-with-bg w-8 h-8 text-bolt-elements-button-primary-background" />
110
+ < p className = "text-bolt-elements-textPrimary text-lg" > Signing in...</ p >
111
+ </ div >
112
+ ) ;
113
+ }
114
+
98
115
return (
99
- < div className = "w-full max-w-md p-8 bg-[#0E1117] rounded-lg shadow-lg" >
116
+ < div className = "w-full min-w-md max-w-md p-8 bg-bolt-elements-background-depth-2 rounded-lg shadow-lg" >
100
117
< div className = "flex mb-6" >
101
118
< button
102
119
className = { `flex-1 py-2 text-lg font-semibold transition-colors duration-300 bg-transparent ${
103
- activeTab === 'signin' ? 'text-blue-400 border-b-2 border-blue-400 ' : 'text-gray-400'
120
+ activeTab === 'signin' ? 'text-bolt-elements-button-primary-background border-b-2 border-bolt-elements-button-primary-background ' : 'text-gray-400'
104
121
} `}
105
122
onClick = { ( ) => setActiveTab ( 'signin' ) }
106
123
>
107
124
Sign In
108
125
</ button >
109
126
< button
110
127
className = { `flex-1 py-2 text-lg font-semibold transition-colors duration-300 bg-transparent ${
111
- activeTab === 'signup' ? 'text-blue-400 border-b-2 border-blue-400 ' : 'text-gray-400'
128
+ activeTab === 'signup' ? 'text-bolt-elements-button-primary-background border-b-2 border-bolt-elements-button-primary-background ' : 'text-gray-400'
112
129
} `}
113
130
onClick = { ( ) => setActiveTab ( 'signup' ) }
114
131
>
@@ -135,7 +152,7 @@ export default function AuthComponent({ onClose }: AuthComponentProps = { onClos
135
152
id = "email"
136
153
value = { email }
137
154
onChange = { ( e ) => setEmail ( e . target . value ) }
138
- className = "w-full px-3 py-2 bg-[#1C2128] text-white border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400 "
155
+ className = "w-full px-3 py-2 bg-bolt-elements-background-depth-3 text-white border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-bolt-elements-button-primary-background "
139
156
required
140
157
/>
141
158
</ div >
@@ -148,13 +165,13 @@ export default function AuthComponent({ onClose }: AuthComponentProps = { onClos
148
165
id = "password"
149
166
value = { password }
150
167
onChange = { ( e ) => setPassword ( e . target . value ) }
151
- className = "w-full px-3 py-2 bg-[#1C2128] text-white border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400 "
168
+ className = "w-full px-3 py-2 bg-bolt-elements-background-depth-3 text-white border border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-bolt-elements-button-primary-background "
152
169
required
153
170
/>
154
171
</ div >
155
172
< motion . button
156
173
type = "submit"
157
- className = "w-full bg-blue-400 text-white py-2 rounded-md hover:bg-blue-500 transition-colors duration-300"
174
+ className = "w-full bg-bolt-elements-button-primary-background text-white py-2 rounded-md hover:bg-bolt-elements-button-primary-hover transition-colors duration-300"
158
175
disabled = { loading }
159
176
whileHover = { { scale : 1.05 } }
160
177
whileTap = { { scale : 0.95 } }
@@ -179,23 +196,23 @@ export default function AuthComponent({ onClose }: AuthComponentProps = { onClos
179
196
< div className = "flex justify-center space-x-4" >
180
197
< motion . button
181
198
onClick = { ( ) => handleOAuthSignIn ( 'github' ) }
182
- className = "p-2 bg-[#1C2128] rounded-full hover:bg-[#2D3748] transition-colors duration-300"
199
+ className = "p-2 bg-bolt-elements-background-depth-3 rounded-full hover:bg-bolt-elements-button-primary-hover transition-colors duration-300"
183
200
whileHover = { { scale : 1.1 } }
184
201
whileTap = { { scale : 0.9 } }
185
202
>
186
203
< Github className = "w-6 h-6 text-white" />
187
204
</ motion . button >
188
205
< motion . button
189
206
onClick = { ( ) => handleOAuthSignIn ( 'google' ) }
190
- className = "p-2 bg-[#1C2128] rounded-full hover:bg-[#2D3748] transition-colors duration-300"
207
+ className = "p-2 bg-bolt-elements-background-depth-3 rounded-full hover:bg-bolt-elements-button-primary-hover transition-colors duration-300"
191
208
whileHover = { { scale : 1.1 } }
192
209
whileTap = { { scale : 0.9 } }
193
210
>
194
211
< Mail className = "w-6 h-6 text-white" />
195
212
</ motion . button >
196
213
< motion . button
197
214
onClick = { ( ) => handleOAuthSignIn ( 'apple' ) }
198
- className = "p-2 bg-[#1C2128] rounded-full hover:bg-[#2D3748] transition-colors duration-300"
215
+ className = "p-2 bg-bolt-elements-background-depth-3 rounded-full hover:bg-bolt-elements-button-primary-hover transition-colors duration-300"
199
216
whileHover = { { scale : 1.1 } }
200
217
whileTap = { { scale : 0.9 } }
201
218
>
0 commit comments