From 991fe2b416f75d7c6a2eecc69afb322f11ea010e Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Sat, 2 May 2026 23:44:56 -0400 Subject: [PATCH] feat(auth): implement Google SSO frontend UI and Supabase wiring Co-Authored-By: Claude Opus 4.7 --- src/pages/AdminLogin.tsx | 49 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/src/pages/AdminLogin.tsx b/src/pages/AdminLogin.tsx index 92eeee2..ab678c4 100644 --- a/src/pages/AdminLogin.tsx +++ b/src/pages/AdminLogin.tsx @@ -8,9 +8,30 @@ export default function AdminLogin() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); + const [googleLoading, setGoogleLoading] = useState(false); const [error, setError] = useState(null); const navigate = useNavigate(); + const handleGoogleSignIn = async (): Promise => { + setError(null); + setGoogleLoading(true); + try { + const { error: oauthError } = await supabase.auth.signInWithOAuth({ + provider: 'google', + options: { redirectTo: window.location.origin }, + }); + if (oauthError) { + setError(classifyAuthError(oauthError)); + setGoogleLoading(false); + } + // On success, the browser is redirected to Google; no further state work needed. + } catch (err) { + const message = err instanceof Error ? err.message : 'Google sign-in failed. Please try again.'; + setError(message); + setGoogleLoading(false); + } + }; + const handleLogin = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); @@ -85,6 +106,30 @@ export default function AdminLogin() { )} + + +
+
+ + or continue with + +
+
+
-