feat: remove dark mode toggle, switch to prefers-color-scheme

This means it's not possible to manually change the theme, but all major operating systems
support global dark mode now, so it shouldn't be a huge problem.
Will re-add the dark mode toggle if the Sec-CH-Prefers-Color-Scheme header gets added to Firefox and Safari.
This commit is contained in:
sam 2024-09-25 15:14:48 +02:00
parent 862a64840e
commit 0f3ab19f6f
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
9 changed files with 25 additions and 64 deletions

View file

@ -57,7 +57,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
};
export function Layout({ children }: { children: ReactNode }) {
const { locale, settings } = useRouteLoaderData<typeof loader>("root") || {
const { locale } = useRouteLoaderData<typeof loader>("root") || {
meta: {
users: {
total: 0,
@ -77,7 +77,6 @@ export function Layout({ children }: { children: ReactNode }) {
return (
<html
lang={locale || "en"}
data-bs-theme={settings?.dark_mode ? "dark" : "light"}
dir={i18n.dir()}
>
<head>
@ -119,10 +118,10 @@ export function ErrorBoundary() {
<Links />
</head>
<body>
{data?.meUser && data?.settings && data?.meta ? (
<Navbar meta={data.meta} user={data.meUser} settings={data.settings} />
{data?.meUser && data?.meta ? (
<Navbar meta={data.meta} user={data.meUser} />
) : (
<BaseNavbar theme="light" />
<BaseNavbar />
)}
<Container>{errorElem}</Container>
<Scripts />