diff --git a/app/auth/page.tsx b/app/auth/page.tsx index f890360..53ddbe7 100644 --- a/app/auth/page.tsx +++ b/app/auth/page.tsx @@ -1,242 +1,32 @@ "use client"; -import { useState } from "react"; -import { useRouter } from "next/navigation"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { Separator } from "@/components/ui/separator"; -import { signUpWithEmail, signInWithEmail, signInWithGoogle, signInWithGitHub } from "@/lib/firebase/auth"; -import { Github, Loader2 } from "lucide-react"; -import { toast } from "sonner"; +import dynamic from "next/dynamic"; +import { useEffect, useState } from "react"; + +// Dynamically import SuperTokens component (client-side only) +const SuperTokensAuthComponent = dynamic( + () => import("@/app/components/SuperTokensAuthComponent"), + { ssr: false } +); export default function AuthPage() { - const router = useRouter(); - const [isSignUp, setIsSignUp] = useState(false); - const [isLoading, setIsLoading] = useState(false); - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); - const [displayName, setDisplayName] = useState(""); + const [mounted, setMounted] = useState(false); - const handleEmailAuth = async (e: React.FormEvent) => { - e.preventDefault(); - setIsLoading(true); + useEffect(() => { + setMounted(true); + }, []); - try { - if (isSignUp) { - if (!displayName.trim()) { - toast.error("Please enter your name"); - setIsLoading(false); - return; - } - const { workspace } = await signUpWithEmail(email, password, displayName); - toast.success("Account created successfully!"); - router.push(`/${workspace}/projects`); - } else { - await signInWithEmail(email, password); - toast.success("Signed in successfully!"); - // Get user's workspace from Firestore - router.push(`/marks-account/projects`); // TODO: Get actual workspace - } - } catch (error: any) { - toast.error(error.message); - } finally { - setIsLoading(false); - } - }; - - const handleGoogleSignIn = async () => { - setIsLoading(true); - try { - await signInWithGoogle(); - toast.success("Signed in with Google!"); - router.push(`/marks-account/projects`); // TODO: Get actual workspace - } catch (error: any) { - toast.error(error.message); - } finally { - setIsLoading(false); - } - }; - - const handleGitHubSignIn = async () => { - setIsLoading(true); - try { - await signInWithGitHub(); - toast.success("Signed in with GitHub!"); - router.push(`/marks-account/projects`); // TODO: Get actual workspace - } catch (error: any) { - toast.error(error.message); - } finally { - setIsLoading(false); - } - }; - - return ( -
+ if (!mounted) {
+ return (
+ Loading authentication...
- By continuing, you agree to our Terms of Service and Privacy Policy. -