import PropertyCard from '@/components/PropertyCard'; import PropertySearchForm from '@/components/PropertySearchForm'; import Pagination from '@/components/Pagination'; import Property from '@/models/Property'; import connectDB from '@/config/database'; const PropertiesPage = async ({ searchParams: { pageSize = 9, page = 1 } }) => { await connectDB(); const skip = (page - 1) * pageSize; const total = await Property.countDocuments({}); const properties = await Property.find({}).skip(skip).limit(pageSize); // Calculate if pagination is needed const showPagination = total > pageSize; return ( <>

Browse Properties

{properties.length === 0 ? (

No properties found

) : (
{properties.map((property, index) => ( ))}
)} {showPagination && ( )}
); }; export default PropertiesPage;