feat: Enhance user profiles page filter synchronization and refactor common header navigation to use Link components.
This commit is contained in:
@@ -534,6 +534,24 @@ function ProfilesPageContent() {
|
|||||||
const handleTypeChange = (typeId: string | null) => {
|
const handleTypeChange = (typeId: string | null) => {
|
||||||
setActiveTypeId(typeId);
|
setActiveTypeId(typeId);
|
||||||
setCurrentPage(1);
|
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
|
// 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>
|
<h2 className="font-fractul font-bold text-[14px] text-[#00293d] mb-3">Listing Type</h2>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<button
|
<button
|
||||||
onClick={() => setListingType('agents')}
|
onClick={() => handleListingTypeChange('agents')}
|
||||||
className={`block font-serif text-[14px] ${listingType === 'agents' ? 'text-[#00293d] font-medium' : 'text-[#00293d]/70'
|
className={`block font-serif text-[14px] ${listingType === 'agents' ? 'text-[#00293d] font-medium' : 'text-[#00293d]/70'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Agents
|
Agents
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setListingType('lenders')}
|
onClick={() => handleListingTypeChange('lenders')}
|
||||||
className={`block font-serif text-[14px] ${listingType === 'lenders' ? 'text-[#00293d] font-medium' : 'text-[#00293d]/70'
|
className={`block font-serif text-[14px] ${listingType === 'lenders' ? 'text-[#00293d] font-medium' : 'text-[#00293d]/70'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import { useSession, signOut } from 'next-auth/react';
|
import { useSession, signOut } from 'next-auth/react';
|
||||||
import { agentsService } from '@/services/agents.service';
|
import { agentsService } from '@/services/agents.service';
|
||||||
import { usersService } from '@/services/users.service';
|
import { usersService } from '@/services/users.service';
|
||||||
@@ -18,7 +18,6 @@ const navLinks = [
|
|||||||
|
|
||||||
export function CommonHeader() {
|
export function CommonHeader() {
|
||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
const router = useRouter();
|
|
||||||
const [showProfileMenu, setShowProfileMenu] = useState(false);
|
const [showProfileMenu, setShowProfileMenu] = useState(false);
|
||||||
const profileMenuRef = useRef<HTMLDivElement>(null);
|
const profileMenuRef = useRef<HTMLDivElement>(null);
|
||||||
const [profileImage, setProfileImage] = useState<string | null>(null);
|
const [profileImage, setProfileImage] = useState<string | null>(null);
|
||||||
@@ -135,7 +134,7 @@ export function CommonHeader() {
|
|||||||
<header className="bg-[#648188] rounded-[20px] px-8">
|
<header className="bg-[#648188] rounded-[20px] px-8">
|
||||||
<div className="flex justify-between items-center h-[70px]">
|
<div className="flex justify-between items-center h-[70px]">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link href="/">
|
<Link href={dashboardLink}>
|
||||||
<Image
|
<Image
|
||||||
src="/assets/logo.svg"
|
src="/assets/logo.svg"
|
||||||
alt="RE-QuestN"
|
alt="RE-QuestN"
|
||||||
@@ -163,8 +162,8 @@ export function CommonHeader() {
|
|||||||
{session ? (
|
{session ? (
|
||||||
<>
|
<>
|
||||||
{/* Notification Bell */}
|
{/* Notification Bell */}
|
||||||
<button
|
<Link
|
||||||
onClick={() => router.push(userRole === 'AGENT' ? '/agent/notifications' : '/user/notifications')}
|
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"
|
className="relative w-6 h-6 flex items-center justify-center hover:opacity-80 transition-opacity cursor-pointer"
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
@@ -181,7 +180,7 @@ export function CommonHeader() {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</Link>
|
||||||
|
|
||||||
{/* Profile Section with Greeting - Entire area clickable */}
|
{/* Profile Section with Greeting - Entire area clickable */}
|
||||||
<div className="relative" ref={profileMenuRef}>
|
<div className="relative" ref={profileMenuRef}>
|
||||||
|
|||||||
Reference in New Issue
Block a user