diff --git a/app/about/page.tsx b/app/about/page.tsx index 319f04e..8cefa96 100644 --- a/app/about/page.tsx +++ b/app/about/page.tsx @@ -15,12 +15,7 @@ export default function AboutPage() { paddingBottom: "max(2.5rem, calc(1.5rem + var(--safe-bottom)))", }} > -
- -
+

{t.about.title}

diff --git a/app/contact/page.tsx b/app/contact/page.tsx index 55dbdd4..1cc1ef6 100644 --- a/app/contact/page.tsx +++ b/app/contact/page.tsx @@ -15,12 +15,7 @@ export default function ContactPage() { paddingBottom: "max(2.5rem, calc(1.5rem + var(--safe-bottom)))", }} > -

- -
+

{t.contact.title}

diff --git a/app/page.tsx b/app/page.tsx index ce34601..ab7fb05 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -10,15 +10,10 @@ export default function HomePage() { return (

-
- -
+
diff --git a/components/language-switcher.tsx b/components/language-switcher.tsx index 17201f9..9e7d6a3 100644 --- a/components/language-switcher.tsx +++ b/components/language-switcher.tsx @@ -1,5 +1,6 @@ "use client"; +import { useCallback, useEffect, useRef, useState } from "react"; import { useLocale } from "~/components/locale-provider"; import type { Locale } from "~/lib/i18n"; @@ -8,32 +9,86 @@ const OPTIONS: { value: Locale; label: string }[] = [ { value: "en", label: "English" }, ]; +const UNLOCK_CLICKS = 5; +const CLICK_WINDOW_MS = 2500; +const UNLOCK_KEY = "nomadro-lang-unlock"; + export function LanguageSwitcher({ className = "" }: { className?: string }) { const { locale, setLocale, t } = useLocale(); + const [visible, setVisible] = useState(false); + const clicksRef = useRef(0); + const timerRef = useRef | null>(null); + + useEffect(() => { + try { + if (window.sessionStorage.getItem(UNLOCK_KEY) === "1") { + setVisible(true); + } + } catch { + // ignore + } + }, []); + + const handleSecretClick = useCallback(() => { + if (visible) return; + + clicksRef.current += 1; + + if (timerRef.current) clearTimeout(timerRef.current); + timerRef.current = setTimeout(() => { + clicksRef.current = 0; + }, CLICK_WINDOW_MS); + + if (clicksRef.current >= UNLOCK_CLICKS) { + clicksRef.current = 0; + if (timerRef.current) clearTimeout(timerRef.current); + setVisible(true); + try { + window.sessionStorage.setItem(UNLOCK_KEY, "1"); + } catch { + // ignore + } + } + }, [visible]); return ( - + {/* Invisible hit area — tap 5 times to reveal */} +
); } diff --git a/components/locale-provider.tsx b/components/locale-provider.tsx index 2d19189..0af87a1 100644 --- a/components/locale-provider.tsx +++ b/components/locale-provider.tsx @@ -36,8 +36,11 @@ export function LocaleProvider({ children }: { children: ReactNode }) { let cancelled = false; try { + // Prefer auto detection; only keep a locale if user unlocked and switched. + const unlocked = window.sessionStorage.getItem("nomadro-lang-unlock") === "1"; const saved = window.localStorage.getItem(STORAGE_KEY); - if (isLocale(saved)) { + + if (unlocked && isLocale(saved)) { if (!cancelled) { setLocaleState(saved); setReady(true);