import { notFound } from "next/navigation"; import Link from "next/link"; import type { Metadata } from "next"; import { prisma } from "@/lib/db"; import { formatPrice, parseJsonArray } from "@/lib/utils"; import { Gallery } from "@/components/apartment/Gallery"; import { Features } from "@/components/apartment/Features"; import { AvailabilityCalendar } from "@/components/apartment/AvailabilityCalendar"; import { BookingPlatforms } from "@/components/apartment/BookingPlatforms"; import { AvailablePeriods } from "@/components/apartment/AvailablePeriods"; export const dynamic = "force-dynamic"; interface PageProps { params: { slug: string }; } export async function generateMetadata({ params }: PageProps): Promise { const apt = await prisma.apartment.findUnique({ where: { slug: params.slug } }); if (!apt) return { title: "Wohnung nicht gefunden" }; return { title: `${apt.name} — ${apt.tagline}`, description: apt.shortDescription, }; } export default async function ApartmentDetailPage({ params }: PageProps) { const row = await prisma.apartment.findUnique({ where: { slug: params.slug } }); if (!row || !row.published) notFound(); const apartment = { ...row, features: parseJsonArray(row.features), images: parseJsonArray(row.images), }; return (
{/* Brotkrümel */} {/* Titelblock */}
{apartment.tagline}

{apartment.name}

Gäste
bis {apartment.maxGuests}
Größe
{apartment.sizeSqm} m²
ab
{formatPrice(apartment.priceFrom)} /Nacht
{/* Galerie */} {/* Beschreibung + Sticky-CTA */}
Die Wohnung

{apartment.shortDescription}

{apartment.description}

{/* Sticky Anfrage-Box */}
); }