connect image carousel to database

This commit is contained in:
Naytitorn Chaovirachot 2024-11-01 23:12:15 +07:00
parent 71d1d3c1fc
commit b25895e5ad
2 changed files with 7 additions and 7 deletions

View File

@ -35,13 +35,13 @@ export default async function ProjectDealPage({ params }: { params: { id: number
// timeDiff, if negative convert to zero
const timeDiff = Math.max((new Date(projectData.investment_deadline)).getTime() - new Date().getTime(), 0)
const hourLeft = Math.floor(timeDiff / (1000 * 60 * 60));
console.log(hourLeft)
const carouselData = [
{ src: "/boiler1.jpg", alt: "Boiler 1" },
{ src: "/boiler1.jpg", alt: "Boiler 1" },
{ src: "/boiler1.jpg", alt: "Boiler 1" },
{ src: "/boiler1.jpg", alt: "Boiler 1" },
{ src: "/boiler1.jpg", alt: "Boiler 1" },
{ src: projectData.card_image_url, alt: `${projectData.project_name} Image` },
{ src: projectData.card_image_url, alt: `${projectData.project_name} Image` },
{ src: projectData.card_image_url, alt: `${projectData.project_name} Image` },
{ src: projectData.card_image_url, alt: `${projectData.project_name} Image` },
{ src: projectData.card_image_url, alt: `${projectData.project_name} Image` },
];
return (
@ -95,7 +95,6 @@ export default async function ProjectDealPage({ params }: { params: { id: number
<div id="stats" className="flex flex-col w-full mt-4 pl-12">
<div className="pl-5">
<span>
{/* #TODO use sum() instead of storing total in database */}
<h1 className="font-semibold text-xl md:text-4xl mt-8">${totalDealAmount}</h1>
<p className="text-sm md:text-lg">
{toPercentage(totalDealAmount, projectData?.target_investment)}%

View File

@ -79,6 +79,7 @@ async function getProjectData(client: SupabaseClient, projectId: number) {
project_short_description,
project_description,
published_time,
card_image_url,
...project_investment_detail!inner (
min_investment,
total_investment,