feat: implement URL-based listing type selection and update footer navigation links

This commit is contained in:
pradeepkumar
2026-04-10 20:15:25 +05:30
parent fbd209e129
commit 6fff0de325
2 changed files with 14 additions and 34 deletions

View File

@@ -409,6 +409,7 @@ function ProfilesPageContent() {
const nameFromUrl = searchParams.get('name') || '';
const locationFromUrl = searchParams.get('location') || '';
const filtersFromUrl = searchParams.get('filters') || '';
const listingFromUrl = searchParams.get('listing') as 'agents' | 'lenders' | null;
// State for API data
const [agents, setAgents] = useState<PublicAgentProfile[]>([]);
@@ -424,7 +425,7 @@ function ProfilesPageContent() {
// State for search and filters - initialize from URL params
const [searchQuery, setSearchQuery] = useState(nameFromUrl);
const [activeTypeId, setActiveTypeId] = useState<string | null>(typeFromUrl);
const [listingType, setListingType] = useState<'agents' | 'lenders'>('agents');
const [listingType, setListingType] = useState<'agents' | 'lenders'>(listingFromUrl || 'agents');
const [isFilterModalOpen, setIsFilterModalOpen] = useState(false);
const [filters, setFilters] = useState<FilterState>(() => {
if (filtersFromUrl) {
@@ -460,6 +461,15 @@ function ProfilesPageContent() {
]);
setAgentTypes(types);
// If listing param is set, auto-select the matching agent type
if (listingFromUrl && !typeFromUrl) {
const typeName = listingFromUrl === 'lenders' ? 'Lender' : 'Professional';
const matchedType = types.find((t: AgentType) => t.name === typeName);
if (matchedType) {
setActiveTypeId(matchedType.id);
}
}
// Convert FilterableField to FilterField format
const filterFieldsData: FilterField[] = fields.map((f: FilterableField) => ({
slug: f.slug,

View File

@@ -4,18 +4,11 @@ import Link from 'next/link';
import Image from 'next/image';
const footerLinks = {
services: {
title: 'Services',
links: [
{ label: 'Neighborhood Guides', href: '#' },
{ label: 'Home Loan & EMI Calculator', href: '#' },
],
},
serviceProviders: {
title: 'Service Providers',
links: [
{ label: 'Agent', href: '/education' },
{ label: 'Lenders', href: '#' },
{ label: 'Agent', href: '/user/profiles?listing=agents' },
{ label: 'Lenders', href: '/user/profiles?listing=lenders' },
],
},
resources: {
@@ -24,7 +17,6 @@ const footerLinks = {
{ label: "Buyer's Guide", href: '#' },
{ label: "Seller's Guide", href: '#' },
{ label: 'FAQs', href: '/faq' },
{ label: 'Blogs', href: '#' },
{ label: 'Legal & Documentation Help', href: '#' },
],
},
@@ -33,8 +25,6 @@ const footerLinks = {
links: [
{ label: 'About Our Agency', href: '/about' },
{ label: 'Our Agents', href: '/education' },
{ label: 'Testimonials', href: '/testimonials' },
{ label: 'Careers', href: '#' },
{ label: 'Contact Us', href: '/contact' },
{ label: 'Privacy Policy', href: '/privacy-policy' },
{ label: 'Terms & Conditions', href: '/terms-of-service' },
@@ -90,27 +80,7 @@ export function Footer() {
<footer className="bg-[#648188] text-[#00293d]">
{/* Main Footer Content */}
<div className="max-w-7xl mx-auto px-6 py-12">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8 lg:gap-12">
{/* Services */}
<div>
<h3 className="font-serif font-bold text-[14px] leading-[19px] text-[#E58625] mb-4 pb-2 border-b-2 border-[#e58625] inline-block">
{footerLinks.services.title}
</h3>
<ul className="space-y-3">
{footerLinks.services.links.map((link) => (
<li key={link.label}>
<Link
href={link.href}
prefetch={false}
className="font-serif font-normal text-[14px] leading-[19px] text-[#00293D] hover:text-[#e58625] transition-colors"
>
{link.label}
</Link>
</li>
))}
</ul>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 lg:gap-12">
{/* Service Providers */}
<div>
<h3 className="font-serif font-bold text-[14px] leading-[19px] text-[#E58625] mb-4 pb-2 border-b-2 border-[#e58625] inline-block">