I see this error with the app, reported by NextJS, please fix it. The er

This commit is contained in:
Indigo Tang 2025-07-06 13:07:36 +00:00
parent 396f1a76a1
commit 1e994e8a4c
3 changed files with 16 additions and 7 deletions

View File

@ -1,19 +1,28 @@
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { ShoppingBag, ToyBrick } from "lucide-react"; import { ShoppingBag, ToyBrick } from "lucide-react";
import Link from "next/link"; import Link from "next/link";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import Image from "next/image"; import Image from "next/image";
import type { Toy } from "@/types"; import type { Toy } from "@/types";
import { mockToys } from "@/lib/mockData"; import { getAllToys } from "@/data/operations";
import { getI18n } from "@/locales/server"; 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() { export default async function MyRentalsPage() {
const t = await getI18n(); 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 ( return (
<div className="space-y-8"> <div className="space-y-8">
@ -50,7 +59,7 @@ export default async function MyRentalsPage() {
} }
interface RentalItemCardProps { interface RentalItemCardProps {
toy: Toy & { rentalEndDate?: string, dataAiHint?: string }; toy: Toy & { rentalEndDate?: string };
t: (key: string, params?: Record<string, string | number>) => string; t: (key: string, params?: Record<string, string | number>) => string;
} }

Binary file not shown.

Binary file not shown.