From 86e2c9dbfa91e95c3054884a4acd8e24ca30b87f Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Fri, 15 May 2026 19:15:40 +0200 Subject: [PATCH] disable theme switching + fixed some visual bugs --- .../src/components/react/ThemeSwitcher.tsx | 58 ---------------- frontend/src/layouts/Layout.astro | 10 +-- frontend/src/styles/global.css | 67 +++++++++---------- 3 files changed, 37 insertions(+), 98 deletions(-) delete mode 100644 frontend/src/components/react/ThemeSwitcher.tsx diff --git a/frontend/src/components/react/ThemeSwitcher.tsx b/frontend/src/components/react/ThemeSwitcher.tsx deleted file mode 100644 index 4cbe53a..0000000 --- a/frontend/src/components/react/ThemeSwitcher.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; - -const THEMES = [ - { value: 'salon', label: 'Salon' }, - { value: 'salon-noir', label: 'Salon Noir' }, - { value: 'gothic', label: 'Gothic' }, - { value: 'breakcore', label: 'Breakcore' }, -]; - -interface Props { - defaultTheme?: string; -} - -export default function ThemeSwitcher({ defaultTheme = 'salon' }: Props) { - const [theme, setTheme] = useState(() => { - if (typeof window !== 'undefined') { - return localStorage.getItem('user-theme') || defaultTheme; - } - return defaultTheme; - }); - const [toast, setToast] = useState(null); - const isFirst = useRef(true); - - useEffect(() => { - const html = document.documentElement; - THEMES.forEach(t => html.classList.remove(t.value)); - html.classList.add(theme); - localStorage.setItem('user-theme', theme); - - if (isFirst.current) { - isFirst.current = false; - return; - } - const label = THEMES.find(t => t.value === theme)?.label ?? theme; - setToast(`Theme: ${label}`); - const id = setTimeout(() => setToast(null), 1200); - return () => clearTimeout(id); - }, [theme]); - - return ( -
- -
- -
- {toast &&
{toast}
} -
- ); -} diff --git a/frontend/src/layouts/Layout.astro b/frontend/src/layouts/Layout.astro index a9fec72..92d9e77 100644 --- a/frontend/src/layouts/Layout.astro +++ b/frontend/src/layouts/Layout.astro @@ -3,7 +3,6 @@ import '../styles/global.css'; import '@fontsource-variable/fraunces'; import '@fontsource-variable/eb-garamond'; import '@fontsource-variable/jetbrains-mono'; -import ThemeSwitcher from '../components/react/ThemeSwitcher'; import Search from '../components/react/Search'; import LogoutButton from '../components/react/LogoutButton'; import EditableText from '../components/react/EditableText'; @@ -77,9 +76,11 @@ const hasContact = (siteConfig.contact_links?.length ?? 0) > 0; {image && } {siteConfig.custom_css &&