11'use client' ;
22
33import { LoginForm } from '@components/auth/login-form' ;
4- import { useTheme } from '@lib/hooks/use-theme' ;
54import { motion } from 'framer-motion' ;
65import { AlertTriangle , CheckCircle } from 'lucide-react' ;
76
8- import { useEffect , useState } from 'react' ;
9-
107import { useTranslations } from 'next-intl' ;
118import { useSearchParams } from 'next/navigation' ;
129
@@ -17,57 +14,7 @@ export default function LoginPage() {
1714 const registered = searchParams . get ( 'registered' ) ;
1815 const resetSuccess = searchParams . get ( 'reset' ) ;
1916 const oauthError = searchParams . get ( 'error' ) ;
20- const { isDark } = useTheme ( ) ;
2117 const t = useTranslations ( 'pages.auth.login' ) ;
22- const [ mounted , setMounted ] = useState ( false ) ;
23-
24- // ensure client-side rendering consistency
25- useEffect ( ( ) => {
26- setMounted ( true ) ;
27- } , [ ] ) ;
28-
29- // get colors based on theme
30- const getColors = ( ) => {
31- if ( isDark ) {
32- return {
33- bgColor : 'bg-stone-800' ,
34- alertBg : 'bg-stone-800/50' ,
35- alertBorder : 'border-stone-600' ,
36- alertText : 'text-stone-300' ,
37- iconColor : 'text-stone-400' ,
38- errorAlertBg : 'bg-red-900/30' ,
39- errorAlertBorder : 'border-red-500' ,
40- errorAlertText : 'text-red-400' ,
41- errorIconColor : 'text-red-400' ,
42- } ;
43- } else {
44- return {
45- bgColor : 'bg-stone-100' ,
46- alertBg : 'bg-stone-50' ,
47- alertBorder : 'border-stone-300' ,
48- alertText : 'text-stone-700' ,
49- iconColor : 'text-stone-600' ,
50- errorAlertBg : 'bg-red-50' ,
51- errorAlertBorder : 'border-red-500' ,
52- errorAlertText : 'text-red-700' ,
53- errorIconColor : 'text-red-500' ,
54- } ;
55- }
56- } ;
57-
58- const colors = mounted
59- ? getColors ( )
60- : {
61- bgColor : '' ,
62- alertBg : '' ,
63- alertBorder : '' ,
64- alertText : '' ,
65- iconColor : '' ,
66- errorAlertBg : '' ,
67- errorAlertBorder : '' ,
68- errorAlertText : '' ,
69- errorIconColor : '' ,
70- } ;
7118
7219 // get error message
7320 const getErrorMessage = ( error : string ) => {
@@ -96,20 +43,16 @@ export default function LoginPage() {
9643 } ;
9744
9845 return (
99- < main
100- className = { `flex min-h-screen w-full flex-col items-center justify-center gap-4 px-4 py-12 sm:px-6 lg:px-8 ${ colors . bgColor } font-serif` }
101- >
46+ < main className = "flex min-h-screen w-full flex-col items-center justify-center gap-4 bg-stone-100 px-4 py-12 font-serif sm:px-6 lg:px-8 dark:bg-stone-800" >
10247 { registered && (
10348 < motion . div
10449 initial = { { opacity : 0 , y : - 20 } }
10550 animate = { { opacity : 1 , y : 0 } }
10651 transition = { { duration : 0.6 } }
10752 >
108- < Alert
109- className = { `max-w-md border-l-4 ${ colors . alertBg } ${ colors . alertBorder } ` }
110- >
111- < CheckCircle className = { `h-4 w-4 ${ colors . iconColor } ` } />
112- < AlertDescription className = { `${ colors . alertText } font-serif` } >
53+ < Alert className = "max-w-md border-l-4 border-stone-300 bg-stone-50 dark:border-stone-600 dark:bg-stone-800/50" >
54+ < CheckCircle className = "h-4 w-4 text-stone-600 dark:text-stone-400" />
55+ < AlertDescription className = "font-serif text-stone-700 dark:text-stone-300" >
11356 { t ( 'alerts.registered' ) }
11457 </ AlertDescription >
11558 </ Alert >
@@ -121,11 +64,9 @@ export default function LoginPage() {
12164 animate = { { opacity : 1 , y : 0 } }
12265 transition = { { duration : 0.6 } }
12366 >
124- < Alert
125- className = { `max-w-md border-l-4 ${ colors . alertBg } ${ colors . alertBorder } ` }
126- >
127- < CheckCircle className = { `h-4 w-4 ${ colors . iconColor } ` } />
128- < AlertDescription className = { `${ colors . alertText } font-serif` } >
67+ < Alert className = "max-w-md border-l-4 border-stone-300 bg-stone-50 dark:border-stone-600 dark:bg-stone-800/50" >
68+ < CheckCircle className = "h-4 w-4 text-stone-600 dark:text-stone-400" />
69+ < AlertDescription className = "font-serif text-stone-700 dark:text-stone-300" >
12970 { t ( 'alerts.resetSuccess' ) }
13071 </ AlertDescription >
13172 </ Alert >
@@ -137,11 +78,9 @@ export default function LoginPage() {
13778 animate = { { opacity : 1 , y : 0 } }
13879 transition = { { duration : 0.6 } }
13980 >
140- < Alert
141- className = { `max-w-md border-l-4 ${ colors . errorAlertBg } ${ colors . errorAlertBorder } ` }
142- >
143- < AlertTriangle className = { `h-4 w-4 ${ colors . errorIconColor } ` } />
144- < AlertDescription className = { `${ colors . errorAlertText } font-serif` } >
81+ < Alert className = "max-w-md border-l-4 border-red-500 bg-red-50 dark:border-red-500 dark:bg-red-900/30" >
82+ < AlertTriangle className = "h-4 w-4 text-red-500 dark:text-red-400" />
83+ < AlertDescription className = "font-serif text-red-700 dark:text-red-400" >
14584 { getErrorMessage ( oauthError ) }
14685 </ AlertDescription >
14786 </ Alert >
0 commit comments