diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 85e5b2a..eb7638b 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -20,7 +20,7 @@ export default function Dashboard() { { id: number; project_name: string; business_id: { user_id: number }[]; dataroom_id: number }[] >([]); const [latestInvestment, setLatestInvestment] = useState< - { projectId: number; name: any; amount: number; date: Date; logo_url: string }[] + { projectId: number; name: any; amount: number; date: Date; logo_url: string; status: string }[] >([]); const [isSuccess, setIsSuccess] = useState(false); const [graphType, setGraphType] = useState("line"); @@ -58,9 +58,10 @@ export default function Dashboard() { amount: investment.amount, date: investment.date, logo_url: investment.logo_url, + status: investmentDetail?.data?.find((deal) => deal.project_id === investment.projectId)?.deal_status.value, })) ); - // console.table(resolvedLatest); + // console.table(investmentDetail); }; fetchLatestInvestment(); }, [supabase, investmentDetail]); @@ -230,7 +231,7 @@ export default function Dashboard() { Overview - deal !== undefined) as Deal[] )} - /> + /> */} {/* tab to switch between line and bar graph */} @@ -262,7 +263,6 @@ export default function Dashboard() { Recent Funds - You had {} investors invest this month. = 0 && llist.length < count; --i) { let { data: project, error } = await supabase.from("project").select("project_name").eq("id", deals[i].project_id); if (error) { diff --git a/src/components/recent-funds.tsx b/src/components/recent-funds.tsx index 3707d2d..5902524 100644 --- a/src/components/recent-funds.tsx +++ b/src/components/recent-funds.tsx @@ -6,11 +6,12 @@ export type RecentDealData = { investor_id: string; username: string; logo_url?: string; + status?: string; // email: string; }; interface RecentFundsProps { - data?: { name?: string; amount?: number; avatar?: string; date?: Date; logo_url?: string }[]; + data?: { name?: string; amount?: number; avatar?: string; date?: Date; logo_url?: string; status?: string }[]; } export function RecentFunds(props: RecentFundsProps) { @@ -25,6 +26,23 @@ export function RecentFunds(props: RecentFundsProps) { {deal.name} {deal?.date?.toLocaleDateString()} + {deal.status && ( + + + + + + + {deal?.status} + + + )} +${deal.amount} diff --git a/src/lib/data/investmentQuery.ts b/src/lib/data/investmentQuery.ts index bba485f..9cae764 100644 --- a/src/lib/data/investmentQuery.ts +++ b/src/lib/data/investmentQuery.ts @@ -11,7 +11,19 @@ export const getInvestmentCountsByProjectsIds = (client: SupabaseClient, project }; export const getInvestmentByProjectsIds = (client: SupabaseClient, projectIds: string[]) => { - return client.from("investment_deal").select("*").in("project_id", projectIds); + return client + .from("investment_deal") + .select( + ` + id, + deal_status:deal_status_id(value), + project_id, + deal_amount, + investor:users_id(email), + created_time + ` + ) + .in("project_id", projectIds); }; export const getInvestmentByUserId = (client: SupabaseClient, userId: string) => {
{deal.name}
{deal?.date?.toLocaleDateString()}
+ {deal?.status} +