import Image from 'next/image'; import { mockToys } from '@/lib/mockData'; import type { Toy } from '@/types'; import { Button } from '@/components/ui/button'; import AvailabilityCalendar from '@/components/toys/AvailabilityCalendar'; import { ArrowLeft, CalendarDays, DollarSign, MapPin, ShoppingBag, UserCircle2 } from 'lucide-react'; import Link from 'next/link'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; interface ToyPageProps { params: { id: string }; } // Server Component to fetch toy data (mocked for now) async function getToyById(id: string): Promise { // In a real app, this would fetch from a database await new Promise(resolve => setTimeout(resolve, 200)); // Simulate network delay return mockToys.find(toy => toy.id === id); } export default async function ToyPage({ params }: ToyPageProps) { const toy = await getToyById(params.id); if (!toy) { return (

Toy Not Found

Sorry, the toy you are looking for does not exist or has been removed.

); } const placeholderHint = toy.category.toLowerCase() || "toy detail"; return (
Back to All Toys
{/* Image Gallery Section */}
{toy.name}
{toy.images.length > 1 && (
{toy.images.slice(1, 4).map((img, index) => (
{`${toy.name}
))}
)}
{/* Toy Details Section */}
{toy.category}

{toy.name}

{toy.description}

Owner: {toy.ownerName}
{toy.location && (
Location: {toy.location}
)} {toy.pricePerDay !== undefined && (
Price: {toy.pricePerDay > 0 ? `$${toy.pricePerDay}/day` : 'Free'}
)}
); } // Generate static paths for all toys export async function generateStaticParams() { return mockToys.map((toy) => ({ id: toy.id, })); }