diff --git a/src/app/(investment)/deals/[id]/page.tsx b/src/app/(investment)/deals/[id]/page.tsx index 08a1430..73ef4be 100644 --- a/src/app/(investment)/deals/[id]/page.tsx +++ b/src/app/(investment)/deals/[id]/page.tsx @@ -5,13 +5,12 @@ import ReactMarkdown from "react-markdown"; import * as Tabs from "@radix-ui/react-tabs"; import { Button } from "@/components/ui/button"; -import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; import { Separator } from "@/components/ui/separator"; import { createSupabaseClient } from "@/lib/supabase/serverComponentClient"; import FollowShareButtons from "./followShareButton"; -import { DisplayFullImage } from "./displayImage"; + import { getProjectData } from "@/lib/data/projectQuery"; import { getDealList } from "@/app/api/dealApi"; import { sumByKey, toPercentage } from "@/lib/utils"; @@ -19,6 +18,7 @@ import { redirect } from "next/navigation"; import { isOwnerOfProject } from "./query"; import { UpdateTab } from "./UpdateTab"; import remarkGfm from "remark-gfm"; +import Gallery from "@/components/carousel"; const PHOTO_MATERIAL_ID = 2; @@ -75,7 +75,6 @@ export default async function ProjectDealPage({ params }: { params: { id: number ? projectMaterial.flatMap((item) => (item.material_url || ["/boiler1.jpg"]).map((url: string) => ({ src: url, - alt: "Image", })) ) : [{ src: "/boiler1.jpg", alt: "Default Boiler Image" }]; @@ -104,35 +103,8 @@ export default async function ProjectDealPage({ params }: { params: { id: number
- +20.1% from last month -
*/} -
+
+180.1% from last month
+
+19% from last month
diff --git a/src/app/portfolio/[uid]/query.ts b/src/app/portfolio/[uid]/query.ts
index 151d0eb..aac9153 100644
--- a/src/app/portfolio/[uid]/query.ts
+++ b/src/app/portfolio/[uid]/query.ts
@@ -26,11 +26,11 @@ function getTotalInvestment(deals: { deal_amount: number }[]) {
}
async function getLatestInvestment(
supabase: SupabaseClient,
- deals: { project_id: number; deal_amount: number; created_time: Date }[]
+ deals: { project_id: number; deal_amount: number; created_time: Date;}[]
) {
const llist = [];
const count = 8;
-
+ // select project name from the given id
for (let i = deals.length - 1; i >= 0 && llist.length < count; --i) {
let { data: project, error } = await supabase.from("project").select("project_name").eq("id", deals[i].project_id);
if (error) {
@@ -38,6 +38,7 @@ async function getLatestInvestment(
}
let url = fetchLogoURL(supabase, deals[i].project_id);
llist.push({
+ projectId: deals[i].project_id,
name: project?.[0]?.project_name,
amount: deals[i].deal_amount,
date: new Date(deals[i].created_time),
@@ -104,7 +105,7 @@ async function getBusinessTypeName(supabase: SupabaseClient, projectId: number)
}
// only use deal that were made at most year ago
-interface Deal {
+export interface Deal {
created_time: string | number | Date;
deal_amount: any;
}
diff --git a/src/components/carousel.tsx b/src/components/carousel.tsx
new file mode 100644
index 0000000..5e1386b
--- /dev/null
+++ b/src/components/carousel.tsx
@@ -0,0 +1,88 @@
+"use client";
+import { useEffect, useState, useMemo } from "react";
+import { Carousel, CarouselContent, CarouselItem, type CarouselApi } from "./ui/carousel";
+import Image from "next/image";
+
+interface GalleryProps {
+ images: { src: string }[];
+}
+
+const Gallery = ({ images }: GalleryProps) => {
+ const [mainApi, setMainApi] = useState
{deal.name}
-{deal?.date?.toLocaleDateString()}
-{deal.name}
+{deal?.date?.toLocaleDateString()}
+ {deal.status && ( ++ {deal?.status} +
+{deal.name}
+{deal?.date?.toLocaleDateString()}
+ {deal.status && ( ++ {deal?.status} +
+