fix: force light mode on shared trip page
This commit is contained in:
@@ -105,7 +105,18 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
}, [isAuthenticated])
|
}, [isAuthenticated])
|
||||||
|
|
||||||
|
const location = useLocation()
|
||||||
|
const isSharedPage = location.pathname.startsWith('/shared/')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Shared page always forces light mode
|
||||||
|
if (isSharedPage) {
|
||||||
|
document.documentElement.classList.remove('dark')
|
||||||
|
const meta = document.querySelector('meta[name="theme-color"]')
|
||||||
|
if (meta) meta.setAttribute('content', '#ffffff')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const mode = settings.dark_mode
|
const mode = settings.dark_mode
|
||||||
const applyDark = (isDark: boolean) => {
|
const applyDark = (isDark: boolean) => {
|
||||||
document.documentElement.classList.toggle('dark', isDark)
|
document.documentElement.classList.toggle('dark', isDark)
|
||||||
@@ -121,7 +132,7 @@ export default function App() {
|
|||||||
return () => mq.removeEventListener('change', handler)
|
return () => mq.removeEventListener('change', handler)
|
||||||
}
|
}
|
||||||
applyDark(mode === true || mode === 'dark')
|
applyDark(mode === true || mode === 'dark')
|
||||||
}, [settings.dark_mode])
|
}, [settings.dark_mode, isSharedPage])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TranslationProvider>
|
<TranslationProvider>
|
||||||
|
|||||||
Reference in New Issue
Block a user