From 2b51f4d025312ccc26b176912cce3c63d6fbb246 Mon Sep 17 00:00:00 2001 From: THIS ONE IS A LITTLE BIT TRICKY KRUB Date: Wed, 6 Nov 2024 16:26:52 +0700 Subject: [PATCH] fix: update carouselData fallback to include default image and remove unnecessary console log --- src/app/(investment)/deals/[id]/page.tsx | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/app/(investment)/deals/[id]/page.tsx b/src/app/(investment)/deals/[id]/page.tsx index fd7618c..dc4e2e7 100644 --- a/src/app/(investment)/deals/[id]/page.tsx +++ b/src/app/(investment)/deals/[id]/page.tsx @@ -53,16 +53,17 @@ export default async function ProjectDealPage({ params }: { params: { id: number const timeDiff = Math.max(new Date(projectData.investment_deadline).getTime() - new Date().getTime(), 0); const hourLeft = Math.floor(timeDiff / (1000 * 60 * 60)); - const carouselData = projectMaterial - ? projectMaterial.flatMap((item) => - (item.material_url || ["/boiler1.jpg"]).map((url: string) => ({ - src: url, - alt: "Image", - })) - ) - : []; + const carouselData = + projectMaterial && projectMaterial.length > 0 + ? projectMaterial.flatMap((item) => + (item.material_url || ["/boiler1.jpg"]).map((url: string) => ({ + src: url, + alt: "Image", + })) + ) + : [{ src: "/boiler1.jpg", alt: "Default Boiler Image" }]; - console.log(carouselData); + // console.log(carouselData); return (
@@ -98,8 +99,6 @@ export default async function ProjectDealPage({ params }: { params: { id: number ))} - - {/* second carousel */} @@ -161,9 +160,7 @@ export default async function ProjectDealPage({ params }: { params: { id: number
- - Pitch - + Pitch General Data Updates