diff --git a/src/app/[locale]/dashboard/rentals/page.tsx b/src/app/[locale]/dashboard/rentals/page.tsx index 6cc7999..dc99b2b 100644 --- a/src/app/[locale]/dashboard/rentals/page.tsx +++ b/src/app/[locale]/dashboard/rentals/page.tsx @@ -1,19 +1,28 @@ + import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { ShoppingBag, ToyBrick } from "lucide-react"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import Image from "next/image"; import type { Toy } from "@/types"; -import { mockToys } from "@/lib/mockData"; +import { getAllToys } from "@/data/operations"; import { getI18n } from "@/locales/server"; -const rentedToys: (Toy & { rentalEndDate?: string, dataAiHint?: string })[] = [ - { ...mockToys[1], rentalEndDate: "2024-08-15", dataAiHint: mockToys[1]?.category.toLowerCase() }, - { ...mockToys[4], rentalEndDate: "2024-09-01", dataAiHint: mockToys[4]?.category.toLowerCase() }, -]; - export default async function MyRentalsPage() { const t = await getI18n(); + const allToys = getAllToys(); + + // Mock data: toys rented by the current user + // In a real app, this would come from a database query based on rental records + const rentedToys: (Toy & { rentalEndDate?: string })[] = []; + if (allToys.length > 1) { + // Note: The ownerId here might not be the logged-in user, this is for demonstration. + rentedToys.push({ ...allToys[1], rentalEndDate: "2024-12-15" }); + } + if (allToys.length > 4) { + rentedToys.push({ ...allToys[4], rentalEndDate: "2025-01-01" }); + } + return (
@@ -50,7 +59,7 @@ export default async function MyRentalsPage() { } interface RentalItemCardProps { - toy: Toy & { rentalEndDate?: string, dataAiHint?: string }; + toy: Toy & { rentalEndDate?: string }; t: (key: string, params?: Record) => string; } diff --git a/toyshare.db-shm b/toyshare.db-shm index 49d25a3..f791555 100644 Binary files a/toyshare.db-shm and b/toyshare.db-shm differ diff --git a/toyshare.db-wal b/toyshare.db-wal index 466b2e5..f910ea4 100644 Binary files a/toyshare.db-wal and b/toyshare.db-wal differ