feat: implement URL-based listing type selection and update footer navigation links
This commit is contained in:
@@ -409,6 +409,7 @@ function ProfilesPageContent() {
|
|||||||
const nameFromUrl = searchParams.get('name') || '';
|
const nameFromUrl = searchParams.get('name') || '';
|
||||||
const locationFromUrl = searchParams.get('location') || '';
|
const locationFromUrl = searchParams.get('location') || '';
|
||||||
const filtersFromUrl = searchParams.get('filters') || '';
|
const filtersFromUrl = searchParams.get('filters') || '';
|
||||||
|
const listingFromUrl = searchParams.get('listing') as 'agents' | 'lenders' | null;
|
||||||
|
|
||||||
// State for API data
|
// State for API data
|
||||||
const [agents, setAgents] = useState<PublicAgentProfile[]>([]);
|
const [agents, setAgents] = useState<PublicAgentProfile[]>([]);
|
||||||
@@ -424,7 +425,7 @@ function ProfilesPageContent() {
|
|||||||
// State for search and filters - initialize from URL params
|
// State for search and filters - initialize from URL params
|
||||||
const [searchQuery, setSearchQuery] = useState(nameFromUrl);
|
const [searchQuery, setSearchQuery] = useState(nameFromUrl);
|
||||||
const [activeTypeId, setActiveTypeId] = useState<string | null>(typeFromUrl);
|
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 [isFilterModalOpen, setIsFilterModalOpen] = useState(false);
|
||||||
const [filters, setFilters] = useState<FilterState>(() => {
|
const [filters, setFilters] = useState<FilterState>(() => {
|
||||||
if (filtersFromUrl) {
|
if (filtersFromUrl) {
|
||||||
@@ -460,6 +461,15 @@ function ProfilesPageContent() {
|
|||||||
]);
|
]);
|
||||||
setAgentTypes(types);
|
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
|
// Convert FilterableField to FilterField format
|
||||||
const filterFieldsData: FilterField[] = fields.map((f: FilterableField) => ({
|
const filterFieldsData: FilterField[] = fields.map((f: FilterableField) => ({
|
||||||
slug: f.slug,
|
slug: f.slug,
|
||||||
|
|||||||
@@ -4,18 +4,11 @@ import Link from 'next/link';
|
|||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
|
||||||
const footerLinks = {
|
const footerLinks = {
|
||||||
services: {
|
|
||||||
title: 'Services',
|
|
||||||
links: [
|
|
||||||
{ label: 'Neighborhood Guides', href: '#' },
|
|
||||||
{ label: 'Home Loan & EMI Calculator', href: '#' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
serviceProviders: {
|
serviceProviders: {
|
||||||
title: 'Service Providers',
|
title: 'Service Providers',
|
||||||
links: [
|
links: [
|
||||||
{ label: 'Agent', href: '/education' },
|
{ label: 'Agent', href: '/user/profiles?listing=agents' },
|
||||||
{ label: 'Lenders', href: '#' },
|
{ label: 'Lenders', href: '/user/profiles?listing=lenders' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
resources: {
|
resources: {
|
||||||
@@ -24,7 +17,6 @@ const footerLinks = {
|
|||||||
{ label: "Buyer's Guide", href: '#' },
|
{ label: "Buyer's Guide", href: '#' },
|
||||||
{ label: "Seller's Guide", href: '#' },
|
{ label: "Seller's Guide", href: '#' },
|
||||||
{ label: 'FAQs', href: '/faq' },
|
{ label: 'FAQs', href: '/faq' },
|
||||||
{ label: 'Blogs', href: '#' },
|
|
||||||
{ label: 'Legal & Documentation Help', href: '#' },
|
{ label: 'Legal & Documentation Help', href: '#' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -33,8 +25,6 @@ const footerLinks = {
|
|||||||
links: [
|
links: [
|
||||||
{ label: 'About Our Agency', href: '/about' },
|
{ label: 'About Our Agency', href: '/about' },
|
||||||
{ label: 'Our Agents', href: '/education' },
|
{ label: 'Our Agents', href: '/education' },
|
||||||
{ label: 'Testimonials', href: '/testimonials' },
|
|
||||||
{ label: 'Careers', href: '#' },
|
|
||||||
{ label: 'Contact Us', href: '/contact' },
|
{ label: 'Contact Us', href: '/contact' },
|
||||||
{ label: 'Privacy Policy', href: '/privacy-policy' },
|
{ label: 'Privacy Policy', href: '/privacy-policy' },
|
||||||
{ label: 'Terms & Conditions', href: '/terms-of-service' },
|
{ label: 'Terms & Conditions', href: '/terms-of-service' },
|
||||||
@@ -90,27 +80,7 @@ export function Footer() {
|
|||||||
<footer className="bg-[#648188] text-[#00293d]">
|
<footer className="bg-[#648188] text-[#00293d]">
|
||||||
{/* Main Footer Content */}
|
{/* Main Footer Content */}
|
||||||
<div className="max-w-7xl mx-auto px-6 py-12">
|
<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">
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 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>
|
|
||||||
|
|
||||||
{/* Service Providers */}
|
{/* Service Providers */}
|
||||||
<div>
|
<div>
|
||||||
<h3 className="font-serif font-bold text-[14px] leading-[19px] text-[#E58625] mb-4 pb-2 border-b-2 border-[#e58625] inline-block">
|
<h3 className="font-serif font-bold text-[14px] leading-[19px] text-[#E58625] mb-4 pb-2 border-b-2 border-[#e58625] inline-block">
|
||||||
|
|||||||
Reference in New Issue
Block a user