From fb7b4eefc187b4109cb8956cfaa94a369d5471cf Mon Sep 17 00:00:00 2001 From: root Date: Mon, 20 Jul 2026 01:01:21 -0400 Subject: [PATCH] fix bug#7 --- apps/dashboard/src/app/layout.tsx | 13 ++-- .../dashboard/src/components/I18nProvider.tsx | 30 ++++----- apps/dashboard/src/lib/preferences.test.ts | 11 ++++ apps/dashboard/src/lib/preferences.ts | 23 ++++++- apps/homepage/src/app/[locale]/layout.tsx | 8 +-- .../src/components/app-shell/AuthHeader.tsx | 6 +- .../src/components/app-shell/BrandLink.tsx | 4 +- .../components/app-shell/HeaderNavigation.tsx | 4 +- .../src/components/app-shell/LocalePill.tsx | 8 ++- .../components/app-shell/LocaleSelector.tsx | 12 +++- .../components/app-shell/MobileNavigation.tsx | 28 ++++---- .../src/components/app-shell/SiteFooter.tsx | 2 +- .../src/components/app-shell/SiteHeader.tsx | 36 +++++----- .../app-shell/ThemedAccountCreateLink.tsx | 23 +++++++ .../app-shell/ThemedRouteActionLink.tsx | 24 +++++++ .../app-shell/useThemePreference.ts | 25 +++++++ .../src/components/auth/AuthForms.module.css | 19 ++++++ .../components/auth/ForgotPasswordForm.tsx | 9 ++- .../src/components/auth/SignInForm.tsx | 18 ++++- apps/homepage/src/content/homepage-model.ts | 4 +- apps/homepage/src/lib/account-urls.ts | 4 +- apps/homepage/src/lib/localization/config.ts | 2 +- .../src/lib/theme/bootstrap-script.ts | 2 +- apps/homepage/src/lib/theme/client.ts | 2 +- apps/homepage/src/proxy.ts | 2 +- apps/homepage/tests/browser/shell.spec.ts | 2 +- apps/homepage/tests/browser/theme-csp.spec.ts | 3 +- .../components/header-navigation.test.tsx | 65 +++++++++++++++++++ .../tests/unit/homepage-content.test.ts | 10 ++- .../unit/integrations/destinations.test.ts | 4 +- apps/homepage/tests/unit/localization.test.ts | 16 ++--- apps/homepage/tests/unit/proxy.test.ts | 4 +- apps/homepage/tests/unit/theme.test.ts | 6 ++ 33 files changed, 342 insertions(+), 87 deletions(-) create mode 100644 apps/homepage/src/components/app-shell/ThemedAccountCreateLink.tsx create mode 100644 apps/homepage/src/components/app-shell/ThemedRouteActionLink.tsx create mode 100644 apps/homepage/src/components/app-shell/useThemePreference.ts create mode 100644 apps/homepage/tests/unit/components/header-navigation.test.tsx diff --git a/apps/dashboard/src/app/layout.tsx b/apps/dashboard/src/app/layout.tsx index e1917e5..b61f6e4 100644 --- a/apps/dashboard/src/app/layout.tsx +++ b/apps/dashboard/src/app/layout.tsx @@ -1,10 +1,11 @@ import type { Metadata } from 'next' import { cookies } from 'next/headers' import { JetBrains_Mono } from 'next/font/google' +import Script from 'next/script' import '@fontsource-variable/inter/index.css' import '@fontsource-variable/noto-sans-arabic/index.css' import { DashboardI18nProvider } from '@/components/I18nProvider' -import { SHARED_LANGUAGE_COOKIE } from '@/lib/preferences' +import { HOMEPAGE_THEME_COOKIE, SHARED_LANGUAGE_COOKIE, SHARED_THEME_KEY } from '@/lib/preferences' import './globals.css' const jetbrainsMono = JetBrains_Mono({ @@ -33,14 +34,18 @@ export default async function RootLayout({ children }: { children: React.ReactNo cookieStore.get(SHARED_LANGUAGE_COOKIE)?.value ?? cookieStore.get('dashboard-language')?.value, ) const dir = initialLanguage === 'ar' ? 'rtl' : 'ltr' + const cookieTheme = cookieStore.get(SHARED_THEME_KEY)?.value ?? cookieStore.get(HOMEPAGE_THEME_COOKIE)?.value + const initialTheme = cookieTheme === 'light' ? 'light' : 'dark' return ( - + -