diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 627ae12..da7870e 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -11,7 +11,7 @@ import { getProjectByUserId } from "@/lib/data/projectQuery"; import { Loader } from "@/components/loading/loader"; import { getInvestmentByProjectsIds } from "@/lib/data/investmentQuery"; import { useQuery } from "@supabase-cache-helpers/postgrest-react-query"; -import { getLatestInvestment } from "../portfolio/[uid]/query"; +import { getLatestInvestment, overAllGraphData, Deal } from "../portfolio/[uid]/query"; const data = [ { @@ -174,7 +174,6 @@ export default function Dashboard() { ))} - {currentProjectId} {projects.map((project) => (
@@ -282,7 +281,22 @@ export default function Dashboard() { Overview - + { + if (deal.project_id === currentProjectId) { + return { + deal_amount: deal.deal_amount, + created_time: deal.created_time, + }; + } + return undefined; + }) + .filter((deal) => deal !== undefined) as Deal[] + )} + /> {/* tab to switch between line and bar graph */} diff --git a/src/app/portfolio/[uid]/query.ts b/src/app/portfolio/[uid]/query.ts index d3c147a..28d8e42 100644 --- a/src/app/portfolio/[uid]/query.ts +++ b/src/app/portfolio/[uid]/query.ts @@ -105,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; }