From 5fafe9c8a7175b117b7160381e05f08bb57fb8ef Mon Sep 17 00:00:00 2001 From: Mary Kate Fain Date: Wed, 25 Feb 2026 18:36:31 -0600 Subject: [PATCH] Simplify profile theme: swap global CSS vars instead of scoped theme wrapper - Remove ScopedThemeColumns, scopedThemeTokens from LayoutContext and MainLayout - Profile page now temporarily overrides :root CSS vars with the visited user's theme - On navigation away, user's own theme is restored via effect cleanup - Entire page (sidebar, center, right) uses the profile theme - Removed all display:contents and background extension hacks --- src/components/MainLayout.tsx | 42 ++++++++------------------ src/components/ProfileRightSidebar.tsx | 2 +- src/contexts/LayoutContext.ts | 3 -- src/pages/ProfilePage.tsx | 35 ++++++++++++++++++++- 4 files changed, 47 insertions(+), 35 deletions(-) diff --git a/src/components/MainLayout.tsx b/src/components/MainLayout.tsx index 1b496267..43ebe0b4 100644 --- a/src/components/MainLayout.tsx +++ b/src/components/MainLayout.tsx @@ -7,7 +7,6 @@ import { MobileBottomNav } from '@/components/MobileBottomNav'; import { MobileDrawer } from '@/components/MobileDrawer'; import { FloatingComposeButton } from '@/components/FloatingComposeButton'; import { Skeleton } from '@/components/ui/skeleton'; -import { ScopedTheme } from '@/components/ScopedTheme'; import { LayoutStore, LayoutStoreContext, useLayoutSnapshot } from '@/contexts/LayoutContext'; import { cn } from '@/lib/utils'; @@ -63,7 +62,7 @@ function PageSkeleton() { /** Inner component that reads layout options from the context store. */ function MainLayoutInner() { - const { rightSidebar, showFAB = false, fabKind = 1, fabHref, scopedThemeTokens, noBottomSpacer = false, wrapperClassName } = useLayoutSnapshot(); + const { rightSidebar, showFAB = false, fabKind = 1, fabHref, noBottomSpacer = false, wrapperClassName } = useLayoutSnapshot(); const [drawerOpen, setDrawerOpen] = useState(false); return ( @@ -83,20 +82,18 @@ function MainLayoutInner() { {/* Main content + right sidebar: inside Suspense so the left sidebar persists while lazy pages load */} }> - - {/* Wrap the center column in a relative container for the FAB */} -
- - {showFAB && ( -
-
- -
+ {/* Wrap the center column in a relative container for the FAB */} +
+ + {showFAB && ( +
+
+
- )} -
- {rightSidebar ?? } - +
+ )} +
+ {rightSidebar ?? }
@@ -109,21 +106,6 @@ function MainLayoutInner() { ); } -/** - * Wraps center + right columns in a ScopedTheme when profile theme tokens are provided. - * Uses `display: contents` so the wrapper doesn't affect the flex layout. - */ -function ScopedThemeColumns({ tokens, children }: { tokens?: import('@/themes').ThemeTokens; children: React.ReactNode }) { - if (!tokens) return <>{children}; - return ( - - {/* Extend background to the right edge of the viewport */} -
- {children} - - ); -} - /** * Persistent layout shell rendered once by the router. * Provides a LayoutStore so child pages can configure layout options diff --git a/src/components/ProfileRightSidebar.tsx b/src/components/ProfileRightSidebar.tsx index f8a8c5f0..1d5de789 100644 --- a/src/components/ProfileRightSidebar.tsx +++ b/src/components/ProfileRightSidebar.tsx @@ -315,7 +315,7 @@ export function ProfileRightSidebar({ fields, mediaEvents, mediaLoading: mediaLo const mediaLoading = mediaLoadingProp ?? false; return ( -