Files
property-pulse-nextjs/app/properties/[id]/page.jsx
T
2024-07-12 10:32:37 -04:00

46 lines
1.5 KiB
React

import PropertyHeaderImage from '@/components/PropertyHeaderImage';
import PropertyDetails from '@/components/PropertyDetails';
import connectDB from '@/config/database';
import Property from '@/models/Property';
import PropertyImages from '@/components/PropertyImages';
import BookmarkButton from '@/components/BookmarkButton';
import ShareButtons from '@/components/ShareButtons';
import PropertyContactForm from '@/components/PropertyContactForm';
import { convertToSerializeableObject } from '@/utils/convertToObject';
const PropertyPage = async ({ params }) => {
await connectDB();
const propertyDoc = await Property.findById(params.id).lean();
const property = convertToSerializeableObject(propertyDoc);
if (!property) {
return (
<h1 className='text-center text-2xl font-bold mt-10'>
Property Not Found
</h1>
);
}
return (
<>
<PropertyHeaderImage image={property.images[0]} />
<section className='bg-blue-50'>
<div className='container m-auto py-10 px-6'>
<div className='grid grid-cols-1 md:grid-cols-70/30 w-full gap-6'>
<PropertyDetails property={property} />
{/* <!-- Sidebar --> */}
<aside className='space-y-4'>
<BookmarkButton property={property} />
<ShareButtons property={property} />
<PropertyContactForm property={property} />
</aside>
</div>
</div>
</section>
<PropertyImages images={property.images} />
</>
);
};
export default PropertyPage;