feat: improve loading state handling in LayoutWrapper and adjust ProfilePage layout

This commit is contained in:
Christopher
2026-01-22 09:16:51 -08:00
parent 4bcfff52bc
commit 1f907a4ace
3 changed files with 51 additions and 18 deletions
+17 -16
View File
@@ -381,14 +381,14 @@ export default function ProfilePage() {
<div style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'flex-end',
marginTop: '-48px',
alignItems: 'flex-start',
}}>
<div className="avatar avatar-lg" style={{
width: '96px',
height: '96px',
fontSize: '36px',
border: '4px solid var(--background)',
marginTop: '-48px',
}}>
{user.avatarUrl ? (
<img src={user.avatarUrl} alt={user.displayName || user.handle} />
@@ -397,21 +397,22 @@ export default function ProfilePage() {
)}
</div>
{!isOwnProfile && currentUser && (
<button
className={`btn ${isFollowing ? '' : 'btn-primary'}`}
onClick={handleFollow}
style={{ marginBottom: '12px' }}
>
{isFollowing ? 'Following' : 'Follow'}
</button>
)}
<div style={{ paddingTop: '12px' }}>
{!isOwnProfile && currentUser && (
<button
className={`btn ${isFollowing ? '' : 'btn-primary'}`}
onClick={handleFollow}
>
{isFollowing ? 'Following' : 'Follow'}
</button>
)}
{isOwnProfile && (
<button className="btn" style={{ marginBottom: '12px' }} onClick={() => setIsEditing(!isEditing)}>
{isEditing ? 'Close' : 'Edit Profile'}
</button>
)}
{isOwnProfile && (
<button className="btn" onClick={() => setIsEditing(!isEditing)}>
{isEditing ? 'Close' : 'Edit Profile'}
</button>
)}
</div>
</div>
{/* User Info */}
+5 -1
View File
@@ -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;
}
}
+29 -1
View File
@@ -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 (
<div style={{
height: '100vh',
width: '100vw',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
background: 'var(--background)'
}}>
<div style={{
width: '24px',
height: '24px',
borderRadius: '50%',
border: '2px solid var(--border)',
borderTopColor: 'var(--accent)',
animation: 'spin 0.8s linear infinite'
}} />
<style jsx>{`
@keyframes spin {
to { transform: rotate(360deg); }
}
`}</style>
</div>
);
}
if (isStandalone) {
return <>{children}</>;
}