mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54:06 +01:00
feat: update Dashboard and Portfolio components; add Deals page and improve project filtering
This commit is contained in:
parent
0bef51750c
commit
7f68a31afa
9
src/app/dashboard/deals/page.tsx
Normal file
9
src/app/dashboard/deals/page.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { DataTable } from "@/components/dataTable";
|
||||||
|
|
||||||
|
export default function Deals() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>hello นาา</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -16,6 +16,7 @@ import { overAllGraphData, fourYearGraphData, dayOftheWeekData } from "../portfo
|
|||||||
import CountUp from "react-countup";
|
import CountUp from "react-countup";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const supabase = createSupabaseClient();
|
const supabase = createSupabaseClient();
|
||||||
@ -50,17 +51,17 @@ export default function Dashboard() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
let graphData = [];
|
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) => {
|
const handleTabChange = (tab: string) => {
|
||||||
setActiveTab(tab);
|
setActiveTab(tab);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (activeTab === "daily") {
|
if (activeTab === "daily") {
|
||||||
graphData = dayOftheWeekData(filteredData);
|
graphData = dayOftheWeekData(filteredProject);
|
||||||
} else if (activeTab === "yearly") {
|
} else if (activeTab === "yearly") {
|
||||||
graphData = fourYearGraphData(filteredData);
|
graphData = fourYearGraphData(filteredProject);
|
||||||
} else {
|
} else {
|
||||||
graphData = overAllGraphData(filteredData);
|
graphData = overAllGraphData(filteredProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -173,7 +174,7 @@ export default function Dashboard() {
|
|||||||
<div className="text-2xl font-bold">
|
<div className="text-2xl font-bold">
|
||||||
$
|
$
|
||||||
<CountUp
|
<CountUp
|
||||||
end={filteredData
|
end={filteredProject
|
||||||
.filter((project) => project.deal_status === "Completed")
|
.filter((project) => project.deal_status === "Completed")
|
||||||
.reduce((sum, current) => sum + current.deal_amount, 0)}
|
.reduce((sum, current) => sum + current.deal_amount, 0)}
|
||||||
duration={1}
|
duration={1}
|
||||||
@ -282,7 +283,7 @@ export default function Dashboard() {
|
|||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Recent Funds</CardTitle>
|
<CardTitle>Recent Funds</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent className="grid grid-flow-dense">
|
||||||
<RecentFunds
|
<RecentFunds
|
||||||
data={latestInvestment.map((item) => {
|
data={latestInvestment.map((item) => {
|
||||||
return {
|
return {
|
||||||
@ -295,6 +296,13 @@ export default function Dashboard() {
|
|||||||
};
|
};
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
<div className="flex justify-center">
|
||||||
|
{filteredProject && filteredProject.length > 6 ? (
|
||||||
|
<Button asChild>
|
||||||
|
<Link href="/dashboard/deals/">View More</Link>
|
||||||
|
</Button>
|
||||||
|
) : undefined}
|
||||||
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -235,8 +235,7 @@ export default async function Portfolio({ params }: { params: { uid: string } })
|
|||||||
<CardContent className="mt-5 grid grid-flow-row-dense">
|
<CardContent className="mt-5 grid grid-flow-row-dense">
|
||||||
<RecentFunds data={latestDeals} />
|
<RecentFunds data={latestDeals} />
|
||||||
<div className="mt-5 flex justify-center">
|
<div className="mt-5 flex justify-center">
|
||||||
{deals && deals.length > 5 ? <Button>View More</Button> : ""}
|
{deals && deals.length > 5 ? <Button>View More</Button> : undefined}
|
||||||
{/* <DataTable data={latestDeals} /> */}
|
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user