Implement booking availability and pricing core

This commit is contained in:
2026-05-24 23:20:31 +00:00
parent 014307f2ec
commit 6118b9fd91
6 changed files with 1086 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Section } from '@/components/Section';
import { bookingCatalog, formatPoundsFromCents, quoteStay } from '@/lib/booking';
import {
featuredProperties,
locationHighlights,
@@ -20,6 +21,14 @@ const bookingFields = [
{ label: 'Area', value: 'Coastal or rural' },
];
const demoQuote = quoteStay(bookingCatalog[0]!, {
arrivalDate: '2026-07-10',
departureDate: '2026-07-14',
adults: 2,
children: 1,
pets: 0,
});
export default function HomePage() {
return (
<>
@@ -65,9 +74,49 @@ export default function HomePage() {
Check availability
</button>
</form>
<div className="quote-panel" aria-label="Booking quote preview">
<div className={`availability-pill ${demoQuote.available ? 'is-available' : 'is-unavailable'}`}>
{demoQuote.available ? 'Available now' : 'Unavailable'}
</div>
<div className="quote-heading">
<div>
<p className="footer-label">Live quote core</p>
<h3>{demoQuote.propertyName}</h3>
</div>
<strong>{formatPoundsFromCents(demoQuote.totalCents)}</strong>
</div>
<p className="mb-0">
{demoQuote.arrivalDate} to {demoQuote.departureDate} {demoQuote.nights} nights
</p>
<p className="mb-0 text-body-secondary">
Booking hold: {demoQuote.holdExpiresAt ? '30 minutes after checkout starts' : 'not available yet'}
</p>
</div>
</aside>
</section>
<Section
eyebrow="Booking core"
title="Availability and pricing are now based on explicit rules"
description="The site can check dates, block conflicts, and preview a booking total before payment starts. Later tickets can reuse the same core on the property pages and checkout path."
>
<div className="data-grid">
<article className="data-card">
<h3>Availability checks</h3>
<p>
Published properties are filtered by search terms, guest count, pet rules, minimum stay, and any blocked or already-booked date ranges.
</p>
</article>
<article className="data-card">
<h3>Pricing rules</h3>
<p>
The quote core applies seasonal pricing, weekend overrides, guest supplements, and a 30-minute hold window for the booking start step.
</p>
</article>
</div>
</Section>
<Section
id="browse"
eyebrow="Featured stays"
@@ -206,7 +255,7 @@ export default function HomePage() {
<article className="content-card">
<h3>What comes next</h3>
<p>
The next tickets can now focus on the property listing and property detail pages while the public content layer stays reusable.
The next tickets can now focus on the property listing and property detail pages while the public content layer and booking core stay reusable.
</p>
<Link className="inline-link" href="/contact">
Enquire through the contact page