import Image from 'next/image'; import { getToyById, getAllToys } from '@/data/operations'; import type { Toy } from '@/types'; import { Button } from '@/components/ui/button'; import { ArrowLeft, DollarSign, MapPin, ShoppingBag, UserCircle2 } from 'lucide-react'; import Link from 'next/link'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; interface ToyPageProps { params: { id: string }; } export default async function ToyPage({ params }: ToyPageProps) { const toy = 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
{toy.name}
{toy.images.length > 1 && (
{toy.images.slice(1, 4).map((img, index) => (
{`${toy.name}
))}
)}
{toy.category}

{toy.name}

{toy.description}

{toy.ownerName.split(' ').map(n => n[0]).join('').toUpperCase()}
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() { const toys = getAllToys(); return toys.map((toy) => ({ id: toy.id, })); }