@@ -10,10 +10,13 @@ export default function AuthCallback() {
1010 const { configServerUrl } = useConfig ( ) ;
1111
1212 useEffect ( ( ) => {
13- // Check if dark mode is enabled
14- const isDark = document . documentElement . classList . contains ( 'dark' ) ||
15- localStorage . getItem ( 'theme' ) === 'dark' ||
16- ( ! localStorage . getItem ( 'theme' ) && window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ) ;
13+ const hasDarkClass = document . documentElement . classList . contains ( 'dark' ) ;
14+ const storedPreference = localStorage . getItem ( 'darkMode' ) === 'true' ;
15+ const prefersDarkScheme = window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
16+ const useSystemPreference = ! localStorage . getItem ( 'darkMode' ) && prefersDarkScheme ;
17+
18+ // Set dark mode if any of the conditions are true
19+ const isDark = hasDarkClass || storedPreference || useSystemPreference ;
1720 setIsDarkMode ( isDark ) ;
1821 } , [ ] ) ;
1922
@@ -54,15 +57,15 @@ export default function AuthCallback() {
5457 if ( error ) {
5558 return (
5659 < div className = "text-red-500" >
57- < h2 className = { isDarkMode ? "text-white" : " text-black" } > Error</ h2 >
58- < p className = { isDarkMode ? "text-red-400" : " text-red-500" } > { error } </ p >
60+ < h2 className = "text-black dark: text-white" > Error</ h2 >
61+ < p className = "text-red-500 dark: text-red-400" > { error } </ p >
5962 </ div >
6063 ) ;
6164 }
6265 if ( token ) {
6366 return (
6467 < div className = "space-y-4" >
65- < h2 className = { ` text-2xl ${ isDarkMode ? " text-white" : " text-black" } ` } > Successfully Authenticated!</ h2 >
68+ < h2 className = " text-2xl text-black dark: text-white" > Successfully Authenticated!</ h2 >
6669 < button
6770 onClick = { ( ) => window . location . href = '/' }
6871 className = "bg-solace-green text-white px-6 py-2 rounded shadow hover:bg-solace-dark-green"
@@ -72,13 +75,15 @@ export default function AuthCallback() {
7275 </ div >
7376 ) ;
7477 }
75- return < div className = { isDarkMode ? "text-white" : " text-black" } > Processing authentication...</ div > ;
78+ return < div className = "text-black dark: text-white" > Processing authentication...</ div > ;
7679 } ;
7780
7881 return (
79- < div className = { `min-h-screen flex items-center justify-center ${ isDarkMode ? "bg-gray-900" : "bg-white" } ` } >
80- < div className = "text-center p-8 max-w-lg" >
81- { renderContent ( ) }
82+ < div className = { `${ isDarkMode ? "dark" : "" } min-h-screen flex items-center justify-center` } >
83+ < div className = "min-h-screen w-full flex items-center justify-center bg-white dark:bg-gray-900" >
84+ < div className = "text-center p-8 max-w-lg" >
85+ { renderContent ( ) }
86+ </ div >
8287 </ div >
8388 </ div >
8489 ) ;
0 commit comments