mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 14:04:06 +01:00
fix: show investor and reserve fund
This commit is contained in:
parent
e7a1f54b43
commit
57b31ec43c
@ -12,6 +12,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { ProjectSection } from "@/components/ProjectSection";
|
||||
import { ShowFilter } from "./ShowFilter";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { sumByKey } from "@/lib/utils";
|
||||
|
||||
export default function Deals() {
|
||||
const supabase = createSupabaseClient();
|
||||
@ -71,8 +72,8 @@ export default function Deals() {
|
||||
location: project.business_location,
|
||||
tags: project.tags.map((tag) => tag.tag_name),
|
||||
min_investment: project.min_investment || 0,
|
||||
total_investor: project.total_investment || 0,
|
||||
total_raise: project.total_investment || 0,
|
||||
total_investor: new Set(project.investment_deal.map((deal) => deal.investor_id)).size || 0,
|
||||
total_raise: sumByKey(project.investment_deal, "deal_amount") || 0,
|
||||
})) || [];
|
||||
|
||||
const clearAll = () => {
|
||||
|
||||
@ -19,6 +19,12 @@ export default async function Home() {
|
||||
const supabase = createSupabaseClient();
|
||||
const { data: topProjectsData, error: topProjectsError } = await getTopProjects(supabase);
|
||||
|
||||
const formattedProjects =
|
||||
topProjectsData?.map((project) => ({
|
||||
...project,
|
||||
id: project.project_id,
|
||||
})) || [];
|
||||
|
||||
return (
|
||||
<main>
|
||||
<div className="relative mx-auto">
|
||||
@ -100,7 +106,7 @@ export default async function Home() {
|
||||
</div>
|
||||
) : (
|
||||
<Suspense fallback={<ProjectsLoader />}>
|
||||
<ProjectSection projectsData={topProjectsData} />
|
||||
<ProjectSection projectsData={formattedProjects} />
|
||||
</Suspense>
|
||||
)}
|
||||
<div className="self-center py-5 scale-75 md:scale-100">
|
||||
|
||||
@ -151,6 +151,10 @@ function searchProjectsQuery(
|
||||
business_type:value
|
||||
),
|
||||
business_location:location
|
||||
),
|
||||
investment_deal (
|
||||
deal_amount,
|
||||
investor_id
|
||||
)
|
||||
`
|
||||
)
|
||||
@ -207,6 +211,7 @@ const getProjectByUserId = (client: SupabaseClient, userId: string) => {
|
||||
`
|
||||
id,
|
||||
project_name,
|
||||
project_short_description,
|
||||
business_id:business!inner (
|
||||
user_id
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user