import { prisma } from "@/lib/prisma"; import { redirect } from "next/navigation"; import { auth } from "@/lib/auth"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import Link from "next/link"; export default async function ListingDetailPage({ params, }: { params: { slug: string }; }) { const session = await auth(); if (!session) { redirect("/login"); } const listing = await prisma.listing.findUnique({ where: { slug: params.slug }, include: { images: true, notes: true, sleepingOptions: true, tags: { include: { tag: true, }, }, }, }); if (!listing) { redirect("/listings"); } return (
← Zurück zur Übersicht
{/* Main Content */}
{/* Images */} {listing.coverImage ? ( {listing.title} ) : (
Kein Bild
)}
{/* Details */}

📋 Details

Schlafzimmer

{listing.bedrooms || "—"}

Betten

{listing.beds || "—"}

Badezimmer

{listing.bathrooms || "—"}

Max Gäste

{listing.maxSleepingPlaces || "—"}

{listing.description && (

Beschreibung

{listing.description}

)}
{/* Sleep Analysis */}

🛏️ Schlafplatz-Analyse

4 Personen geeignet

{listing.suitableFor4 ? "✅ Ja" : "❌ Nein"}

Extra Matratzen für 4

{listing.extraMattressesNeededFor4 ?? "—"}

{listing.sleepingOptions.length > 0 && (

Schlafmöglichkeiten

{listing.sleepingOptions.map((opt) => (
{opt.label || opt.bedType} {opt.quantity}× ({opt.spotsPerUnit} Plätze)
))}
)}
{/* Notes */} {listing.notes.length > 0 && (

📝 Notizen

{listing.notes.map((note) => (

{note.body}

{new Date(note.createdAt).toLocaleDateString("de-DE")}

))}
)}
{/* Sidebar */}
{/* Price Card */}

{listing.title}

📍 {listing.locationText || "Kein Ort"}

€{listing.nightlyPrice?.toFixed(2) || "—"} / Nacht
{listing.rating?.toFixed(2) || "—"} {listing.reviewCount && ( ({listing.reviewCount} Bewertungen) )}
{listing.hostName && (

👤 Host: {listing.hostName}

)}
{listing.tags.map((lt) => ( {lt.tag.name} ))}
🔗 Auf Airbnb ansehen
{/* Status */}

Status

{listing.status}
); }