1
1
"use client" ;
2
2
3
- import { useState , useEffect } from "react" ;
3
+ import { useState , useEffect , Suspense } from "react" ;
4
4
import { GoogleLoginButton } from "./GoogleLoginButton" ;
5
5
import { LocalLoginForm } from "./LocalLoginForm" ;
6
6
import { Logo } from "@/components/Logo" ;
7
7
import { AmbientBackground } from "./AmbientBackground" ;
8
8
import { useSearchParams } from "next/navigation" ;
9
9
import { Loader2 } from "lucide-react" ;
10
10
11
- export default function LoginPage ( ) {
11
+ function LoginContent ( ) {
12
12
const [ authType , setAuthType ] = useState < string | null > ( null ) ;
13
13
const [ registrationSuccess , setRegistrationSuccess ] = useState ( false ) ;
14
14
const [ isLoading , setIsLoading ] = useState ( true ) ;
@@ -64,4 +64,26 @@ export default function LoginPage() {
64
64
</ div >
65
65
</ div >
66
66
) ;
67
+ }
68
+
69
+ // Loading fallback for Suspense
70
+ const LoadingFallback = ( ) => (
71
+ < div className = "relative w-full overflow-hidden" >
72
+ < AmbientBackground />
73
+ < div className = "mx-auto flex h-screen max-w-lg flex-col items-center justify-center" >
74
+ < Logo className = "rounded-md" />
75
+ < div className = "mt-8 flex items-center space-x-2" >
76
+ < Loader2 className = "h-5 w-5 animate-spin text-muted-foreground" />
77
+ < span className = "text-muted-foreground" > Loading...</ span >
78
+ </ div >
79
+ </ div >
80
+ </ div >
81
+ ) ;
82
+
83
+ export default function LoginPage ( ) {
84
+ return (
85
+ < Suspense fallback = { < LoadingFallback /> } >
86
+ < LoginContent />
87
+ </ Suspense >
88
+ ) ;
67
89
}
0 commit comments