From 7bfb31ea2f548f54d9a61fa983c67c1f78aae971 Mon Sep 17 00:00:00 2001 From: Francesco Sansalvadore Date: Tue, 16 Apr 2024 14:34:10 +0200 Subject: [PATCH 1/2] restore dark theme on unmount --- apps/www/pages/ga-week/index.tsx | 11 ++++++++--- apps/www/pages/ga-week/tickets/[username].tsx | 11 ++++++++--- apps/www/pages/ga.tsx | 10 +++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/apps/www/pages/ga-week/index.tsx b/apps/www/pages/ga-week/index.tsx index 76f899f804f..706f20c4fec 100644 --- a/apps/www/pages/ga-week/index.tsx +++ b/apps/www/pages/ga-week/index.tsx @@ -65,14 +65,19 @@ export default function GAWeekIndex({ meetups }: Props) { } }, [supabase]) + const isDark = resolvedTheme?.includes('dark') const isDarkTheme = resolvedTheme === 'dark' useEffect(() => { - if (isDarkTheme) { - setTheme('deep-dark') - } + isDarkTheme && setTheme('deep-dark') }, [isDarkTheme]) + useEffect(() => { + return () => { + isDark && setTheme('dark') + } + }, []) + useEffect(() => { if (session?.user) { if (userData?.id) { diff --git a/apps/www/pages/ga-week/tickets/[username].tsx b/apps/www/pages/ga-week/tickets/[username].tsx index 885f2ff229e..1e46d014e98 100644 --- a/apps/www/pages/ga-week/tickets/[username].tsx +++ b/apps/www/pages/ga-week/tickets/[username].tsx @@ -43,14 +43,19 @@ export default function UsernamePage({ user, ogImageUrl }: Props) { const [ticketState, setTicketState] = useState('ticket') const { resolvedTheme, setTheme } = useTheme() + const isDark = resolvedTheme?.includes('dark') const isDarkTheme = resolvedTheme === 'dark' useEffect(() => { - if (isDarkTheme) { - setTheme('deep-dark') - } + isDarkTheme && setTheme('deep-dark') }, [isDarkTheme]) + useEffect(() => { + return () => { + isDark && setTheme('dark') + } + }, []) + if (!ticketNumber) { return } diff --git a/apps/www/pages/ga.tsx b/apps/www/pages/ga.tsx index 9694737a166..48d367ff2eb 100644 --- a/apps/www/pages/ga.tsx +++ b/apps/www/pages/ga.tsx @@ -30,11 +30,15 @@ export default function IndexPage() { const isDarkTheme = resolvedTheme === 'dark' useEffect(() => { - if (isDarkTheme) { - setTheme('deep-dark') - } + isDarkTheme && setTheme('deep-dark') }, [isDarkTheme]) + useEffect(() => { + return () => { + isDark && setTheme('dark') + } + }, []) + return ( Date: Tue, 16 Apr 2024 14:35:35 +0200 Subject: [PATCH 2/2] update announcement banners --- apps/www/components/Hero/Hero.tsx | 2 +- packages/ui/src/components/PromoToast/PromoToast.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/www/components/Hero/Hero.tsx b/apps/www/components/Hero/Hero.tsx index 16a3448661a..8f9d8a6d1ca 100644 --- a/apps/www/components/Hero/Hero.tsx +++ b/apps/www/components/Hero/Hero.tsx @@ -24,7 +24,7 @@ const Hero = () => {
- +

diff --git a/packages/ui/src/components/PromoToast/PromoToast.tsx b/packages/ui/src/components/PromoToast/PromoToast.tsx index adb5462c85c..5f7f29e2c52 100644 --- a/packages/ui/src/components/PromoToast/PromoToast.tsx +++ b/packages/ui/src/components/PromoToast/PromoToast.tsx @@ -3,7 +3,6 @@ import Link from 'next/link' import { useEffect, useState } from 'react' import { Button, cn } from 'ui' import { LOCAL_STORAGE_KEYS } from 'common' -import announcement from '../../layout/banners/data/Announcement.json' import { useTheme } from 'next-themes' const LW11BGDark = @@ -41,15 +40,15 @@ const PromoToast = () => { )} >
-

+

General Availability Week

- Day 1 + Day 2