mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-18 21:44:06 +01:00
feat: enhance dashboard overview with overall graph data and export Deal interface
This commit is contained in:
parent
9b37b76bd5
commit
4c42b5e50d
@ -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() {
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
{currentProjectId}
|
||||
{projects.map((project) => (
|
||||
<TabsContent value={project.project_name} className="space-y-4">
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||
@ -282,7 +281,22 @@ export default function Dashboard() {
|
||||
<CardTitle>Overview</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pl-2">
|
||||
<Overview graphType={graphType} data={data} />
|
||||
<Overview
|
||||
graphType={graphType}
|
||||
data={overAllGraphData(
|
||||
investmentDetail?.data
|
||||
?.map((deal) => {
|
||||
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 */}
|
||||
<Tabs defaultValue="line" className="space-y-4 ml-[50%] mt-2">
|
||||
<TabsList>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user