feat: Enhance user profiles page filter synchronization and refactor common header navigation to use Link components.

This commit is contained in:
pradeepkumar
2026-03-04 22:13:14 +05:30
parent 27d3a24605
commit a1c128ea2f
2 changed files with 25 additions and 8 deletions

View File

@@ -534,6 +534,24 @@ function ProfilesPageContent() {
const handleTypeChange = (typeId: string | null) => {
setActiveTypeId(typeId);
setCurrentPage(1);
// Sync listing type sidebar with agent type tab selection
if (typeId) {
const matchedType = agentTypes.find(t => t.id === typeId);
if (matchedType?.name === 'Lender') {
setListingType('lenders');
} else {
setListingType('agents');
}
}
};
const handleListingTypeChange = (type: 'agents' | 'lenders') => {
setListingType(type);
// Map listing type to the corresponding agent type and filter
const typeName = type === 'agents' ? 'Professional' : 'Lender';
const matchedType = agentTypes.find(t => t.name === typeName);
setActiveTypeId(matchedType?.id || null);
setCurrentPage(1);
};
// Get filter field by slug for sidebar
@@ -555,14 +573,14 @@ function ProfilesPageContent() {
<h2 className="font-fractul font-bold text-[14px] text-[#00293d] mb-3">Listing Type</h2>
<div className="space-y-2">
<button
onClick={() => setListingType('agents')}
onClick={() => handleListingTypeChange('agents')}
className={`block font-serif text-[14px] ${listingType === 'agents' ? 'text-[#00293d] font-medium' : 'text-[#00293d]/70'
}`}
>
Agents
</button>
<button
onClick={() => setListingType('lenders')}
onClick={() => handleListingTypeChange('lenders')}
className={`block font-serif text-[14px] ${listingType === 'lenders' ? 'text-[#00293d] font-medium' : 'text-[#00293d]/70'
}`}
>

View File

@@ -3,7 +3,7 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import Link from 'next/link';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import { useSession, signOut } from 'next-auth/react';
import { agentsService } from '@/services/agents.service';
import { usersService } from '@/services/users.service';
@@ -18,7 +18,6 @@ const navLinks = [
export function CommonHeader() {
const { data: session } = useSession();
const router = useRouter();
const [showProfileMenu, setShowProfileMenu] = useState(false);
const profileMenuRef = useRef<HTMLDivElement>(null);
const [profileImage, setProfileImage] = useState<string | null>(null);
@@ -135,7 +134,7 @@ export function CommonHeader() {
<header className="bg-[#648188] rounded-[20px] px-8">
<div className="flex justify-between items-center h-[70px]">
{/* Logo */}
<Link href="/">
<Link href={dashboardLink}>
<Image
src="/assets/logo.svg"
alt="RE-QuestN"
@@ -163,8 +162,8 @@ export function CommonHeader() {
{session ? (
<>
{/* Notification Bell */}
<button
onClick={() => router.push(userRole === 'AGENT' ? '/agent/notifications' : '/user/notifications')}
<Link
href={userRole === 'AGENT' ? '/agent/notifications' : '/user/notifications'}
className="relative w-6 h-6 flex items-center justify-center hover:opacity-80 transition-opacity cursor-pointer"
>
<Image
@@ -181,7 +180,7 @@ export function CommonHeader() {
</span>
</span>
)}
</button>
</Link>
{/* Profile Section with Greeting - Entire area clickable */}
<div className="relative" ref={profileMenuRef}>