From db3b12507e0f182eb2ed049e9305f654f8734b4a Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 19 Jan 2026 09:20:48 +0530 Subject: [PATCH] refactor: Replace custom user layout header and sidebar with shared components and remove negative margin from user profile page. --- src/app/(user)/layout.tsx | 114 ++++------------------- src/app/(user)/user/userprofile/page.tsx | 2 +- 2 files changed, 18 insertions(+), 98 deletions(-) diff --git a/src/app/(user)/layout.tsx b/src/app/(user)/layout.tsx index 69e0daf..4d2bdf0 100644 --- a/src/app/(user)/layout.tsx +++ b/src/app/(user)/layout.tsx @@ -1,52 +1,10 @@ 'use client'; -import { useSession, signOut } from 'next-auth/react'; -import { useRouter, usePathname } from 'next/navigation'; -import { useEffect, ReactElement } from 'react'; -import Link from 'next/link'; - -const userNavItems = [ - { href: '/user/userprofile', label: 'Dashboard', icon: 'home' }, - { href: '/user/properties', label: 'Browse Properties', icon: 'building' }, - { href: '/user/favorites', label: 'Favorites', icon: 'heart' }, - { href: '/user/inquiries', label: 'My Inquiries', icon: 'message' }, - { href: '/user/appointments', label: 'Appointments', icon: 'calendar' }, - { href: '/user/settings', label: 'Settings', icon: 'settings' }, -]; - -const icons: Record = { - home: ( - - - - ), - building: ( - - - - ), - heart: ( - - - - ), - message: ( - - - - ), - calendar: ( - - - - ), - settings: ( - - - - - ), -}; +import { useSession } from 'next-auth/react'; +import { useRouter } from 'next/navigation'; +import { useEffect } from 'react'; +import { Footer } from '@/components/layout/Footer'; +import { CommonHeader } from '@/components/layout/CommonHeader'; export default function UserLayout({ children, @@ -55,7 +13,6 @@ export default function UserLayout({ }) { const { data: session, status } = useSession(); const router = useRouter(); - const pathname = usePathname(); useEffect(() => { if (status === 'loading') return; @@ -74,63 +31,26 @@ export default function UserLayout({ if (status === 'loading' || !session) { return ( -
+
); } return ( -
+
{/* Header */} -
-
-
- - RE-QuestN - -
- - {session?.user?.name || session?.user?.email} - - -
-
-
-
- -
- {/* Sidebar */} - - - {/* Main Content */} -
{children}
+
+
+ + {/* Main Content */} +
+ {children} +
+ + {/* Footer */} +
); } diff --git a/src/app/(user)/user/userprofile/page.tsx b/src/app/(user)/user/userprofile/page.tsx index 8308d8a..ab9875d 100644 --- a/src/app/(user)/user/userprofile/page.tsx +++ b/src/app/(user)/user/userprofile/page.tsx @@ -8,7 +8,7 @@ import { TestimonialsSection } from '@/components/home/TestimonialsSection'; export default function UserDashboard() { return ( -
+