From 1f907a4ace47ddd190d1708a8df6a31f6507242c Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 22 Jan 2026 09:16:51 -0800 Subject: [PATCH] feat: improve loading state handling in LayoutWrapper and adjust ProfilePage layout --- src/app/[handle]/page.tsx | 33 ++++++++++++++++---------------- src/app/globals.css | 6 +++++- src/components/LayoutWrapper.tsx | 30 ++++++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/src/app/[handle]/page.tsx b/src/app/[handle]/page.tsx index 5e8507b..7779571 100644 --- a/src/app/[handle]/page.tsx +++ b/src/app/[handle]/page.tsx @@ -381,14 +381,14 @@ export default function ProfilePage() {
{user.avatarUrl ? ( {user.displayName @@ -397,21 +397,22 @@ export default function ProfilePage() { )}
- {!isOwnProfile && currentUser && ( - - )} +
+ {!isOwnProfile && currentUser && ( + + )} - {isOwnProfile && ( - - )} + {isOwnProfile && ( + + )} +
{/* User Info */} diff --git a/src/app/globals.css b/src/app/globals.css index c6f0890..e6f3efa 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -227,12 +227,14 @@ a.btn-primary:visited { position: sticky; top: 0; height: 100vh; + overflow-y: auto; } .main { flex: 1; max-width: 600px; min-width: 0; + min-height: 100vh; border-right: 1px solid var(--border); } @@ -240,9 +242,11 @@ a.btn-primary:visited { width: 320px; flex-shrink: 0; padding: 16px; + padding-bottom: 32px; position: sticky; top: 0; height: 100vh; + overflow-y: auto; } /* Post */ @@ -1307,4 +1311,4 @@ a.btn-primary:visited { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; -} +} \ No newline at end of file diff --git a/src/components/LayoutWrapper.tsx b/src/components/LayoutWrapper.tsx index d0f60f5..17cdcee 100644 --- a/src/components/LayoutWrapper.tsx +++ b/src/components/LayoutWrapper.tsx @@ -4,9 +4,10 @@ import { useEffect } from 'react'; import { usePathname } from 'next/navigation'; import { Sidebar } from './Sidebar'; import { RightSidebar } from './RightSidebar'; +import { useAuth } from '@/lib/contexts/AuthContext'; export function LayoutWrapper({ children }: { children: React.ReactNode }) { - const pathname = usePathname(); + const { loading } = useAuth(); // Paths that should NOT have the app layout const isStandalone = @@ -46,6 +47,33 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) { .catch(() => { }); }, []); + if (loading) { + return ( +
+
+ +
+ ); + } + if (isStandalone) { return <>{children}; }