From 7f68a31afa63a505206b508e252efc3a03f0d5ab Mon Sep 17 00:00:00 2001 From: THIS ONE IS A LITTLE BIT TRICKY KRUB Date: Mon, 11 Nov 2024 16:33:50 +0700 Subject: [PATCH] feat: update Dashboard and Portfolio components; add Deals page and improve project filtering --- src/app/dashboard/deals/page.tsx | 9 +++++++++ src/app/dashboard/page.tsx | 20 ++++++++++++++------ src/app/portfolio/[uid]/page.tsx | 3 +-- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 src/app/dashboard/deals/page.tsx diff --git a/src/app/dashboard/deals/page.tsx b/src/app/dashboard/deals/page.tsx new file mode 100644 index 0000000..4b70825 --- /dev/null +++ b/src/app/dashboard/deals/page.tsx @@ -0,0 +1,9 @@ +import { DataTable } from "@/components/dataTable"; + +export default function Deals() { + return ( +
+

hello นาา

+
+ ); +} diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index c1c58cc..f53a071 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -16,6 +16,7 @@ import { overAllGraphData, fourYearGraphData, dayOftheWeekData } from "../portfo import CountUp from "react-countup"; import { Button } from "@/components/ui/button"; import { useRouter } from "next/navigation"; +import Link from "next/link"; export default function Dashboard() { const supabase = createSupabaseClient(); @@ -50,17 +51,17 @@ export default function Dashboard() { ) ); let graphData = []; - const filteredData = (investmentDetail?.data || []).filter((deal) => deal.project_id === currentProjectId); + const filteredProject = (investmentDetail?.data || []).filter((deal) => deal.project_id === currentProjectId); const handleTabChange = (tab: string) => { setActiveTab(tab); }; if (activeTab === "daily") { - graphData = dayOftheWeekData(filteredData); + graphData = dayOftheWeekData(filteredProject); } else if (activeTab === "yearly") { - graphData = fourYearGraphData(filteredData); + graphData = fourYearGraphData(filteredProject); } else { - graphData = overAllGraphData(filteredData); + graphData = overAllGraphData(filteredProject); } useEffect(() => { @@ -173,7 +174,7 @@ export default function Dashboard() {
$ project.deal_status === "Completed") .reduce((sum, current) => sum + current.deal_amount, 0)} duration={1} @@ -282,7 +283,7 @@ export default function Dashboard() { Recent Funds - + { return { @@ -295,6 +296,13 @@ export default function Dashboard() { }; })} /> +
+ {filteredProject && filteredProject.length > 6 ? ( + + ) : undefined} +
diff --git a/src/app/portfolio/[uid]/page.tsx b/src/app/portfolio/[uid]/page.tsx index d57db80..3eebeec 100644 --- a/src/app/portfolio/[uid]/page.tsx +++ b/src/app/portfolio/[uid]/page.tsx @@ -235,8 +235,7 @@ export default async function Portfolio({ params }: { params: { uid: string } })
- {deals && deals.length > 5 ? : ""} - {/* */} + {deals && deals.length > 5 ? : undefined}