From 1e994e8a4c407a8458f8065ef939295e27896ca8 Mon Sep 17 00:00:00 2001 From: Indigo Tang Date: Sun, 6 Jul 2025 13:07:36 +0000 Subject: [PATCH] I see this error with the app, reported by NextJS, please fix it. The er --- src/app/[locale]/dashboard/rentals/page.tsx | 23 ++++++++++++++------ toyshare.db-shm | Bin 32768 -> 32768 bytes toyshare.db-wal | Bin 78312 -> 90672 bytes 3 files changed, 16 insertions(+), 7 deletions(-) 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 49d25a32ebc0a5ed68f78c6c351ca7976893d306..f791555dee24fde1c1accfcce48b50859d4ced65 100644 GIT binary patch delta 189 zcmZo@U}|V!s+V}A%K!qLK+MR%ARq>$*?>4yCTgrAM6PaeYtnVrD~4moqJiO8e}|# zNL3Fs3JgHz{zn2(;feL38=puyP5dCR`JWR9^TtPCn3$OvI5$50&BV#Vz{SAFAiyBJ N@!?md&ENdE3;_YqI}!i@ diff --git a/toyshare.db-wal b/toyshare.db-wal index 466b2e502d2e1e6c1367416511999e803e2daa8b..f910ea4b440399da890d290ccc4714d5e83e7bf1 100644 GIT binary patch delta 307 zcmaFym}SEe)`l&NFAOIaJQPrn3YcNcnepW+F9QPu2lp=qzAt=yyh1#WcsBF2@C0)I z+PG1Nd-9w!+rmRRIO1jXMR|FpON&#BbdAzd4UJPR%ymr-lgxEZ5{(jdlPpY