diff --git a/src/app/find/ProjectSection.tsx b/src/app/find/ProjectSection.tsx deleted file mode 100644 index 31ef700..0000000 --- a/src/app/find/ProjectSection.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import React from "react"; -import { ProjectCard } from "@/components/projectCard"; -import { Separator } from "@/components/ui/separator"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { ProjectCardProps } from "@/types/ProjectCard"; -import Link from "next/link"; - -export function ProjectSection({ projectsData }: { projectsData: ProjectCardProps[] | null }) { - if (!projectsData || projectsData.length === 0) { - return ( - - - No Project Found - - -

Sorry, we could not find any projects matching your search criteria.

-
-
- ); - } - - return ( -
-
- - - Projects - Found {projectsData.length} projects! - - - -
- {projectsData.map((project) => ( -
- - - - -
- ))} -
-
-
-
-
- ); -} diff --git a/src/app/find/page.tsx b/src/app/find/page.tsx index eae1be7..adee983 100644 --- a/src/app/find/page.tsx +++ b/src/app/find/page.tsx @@ -2,9 +2,10 @@ import React, { Suspense } from "react"; import { getBusinessByName } from "@/lib/data/businessQuery"; import { createSupabaseClient } from "@/lib/supabase/serverComponentClient"; import { BusinessSection } from "./BusinessSection"; -import { ProjectSection } from "./ProjectSection"; +import { ProjectSection } from "@/components/ProjectSection"; import { getProjectCardData } from "@/lib/data/projectQuery"; import { Separator } from "@/components/ui/separator"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; export default async function FindContent({ searchParams }: { searchParams: { query: string } }) { const query = searchParams.query; @@ -36,7 +37,20 @@ export default async function FindContent({ searchParams }: { searchParams: { qu Loading Projects...}> - +
+
+ + + Projects + Found {projectsData?.length ?? 0} projects! + + + + + + +
+
); diff --git a/src/app/page.tsx b/src/app/page.tsx index 44941c0..d43c17a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -9,6 +9,7 @@ import { createSupabaseClient } from "@/lib/supabase/serverComponentClient"; import { Suspense } from "react"; import { FC } from "react"; import { ProjectCardProps } from "@/types/ProjectCard"; +import { ProjectSection } from "@/components/ProjectSection"; interface TopProjectsProps { projects: ProjectCardProps[] | null; @@ -134,7 +135,7 @@ export default async function Home() { ) : ( }> - + )}
diff --git a/src/components/ProjectSection.tsx b/src/components/ProjectSection.tsx new file mode 100644 index 0000000..214a057 --- /dev/null +++ b/src/components/ProjectSection.tsx @@ -0,0 +1,44 @@ +import React from "react"; +import { ProjectCard } from "@/components/projectCard"; +import { Separator } from "@/components/ui/separator"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { ProjectCardProps } from "@/types/ProjectCard"; +import Link from "next/link"; + +export function ProjectSection({ projectsData }: { projectsData: ProjectCardProps[] | null }) { + if (!projectsData || projectsData.length === 0) { + return ( + + + No Project Found + + +

Sorry, we could not find any projects.

+
+
+ ); + } + + return ( +
+ {projectsData.map((project) => ( +
+ + + + +
+ ))} +
+ ); +} diff --git a/src/components/projectCard.tsx b/src/components/projectCard.tsx index ff221f3..ded4889 100644 --- a/src/components/projectCard.tsx +++ b/src/components/projectCard.tsx @@ -3,6 +3,7 @@ import { CalendarDaysIcon } from "lucide-react"; import { cn } from "@/lib/utils"; import Image from "next/image"; +import { Separator } from "./ui/separator"; interface XMap { [tag: string]: string; @@ -13,7 +14,7 @@ interface ProjectCardProps { description: string; joinDate: string; location: string; - tags: XMap | null | never[] | string[]; + tags?: XMap | null | never[] | string[]; imageUri: string | null; minInvestment: number; totalInvestor: number; @@ -22,18 +23,6 @@ interface ProjectCardProps { } export function ProjectCard(props: ProjectCardProps) { - if (props.minInvestment === null) { - props.minInvestment = 0; - } - - if (props.totalInvestor === null) { - props.minInvestment = 0; - } - - if (props.totalRaised === null) { - props.minInvestment = 0; - } - return (
{/* Info 2 (Visible on hover) */} -
-
+
+

- ${props.totalRaised.toLocaleString()} committed and reserved + + ${isNaN(props.totalRaised) || props.totalRaised == null ? "N/A" : props.totalRaised.toLocaleString()} + {" "} + committed and reserved

-
+

- {props.totalInvestor.toLocaleString()} investors + + {isNaN(props.totalInvestor) || props.totalInvestor == null + ? "N/A " + : props.totalInvestor.toLocaleString()} + {" "} + investors

-
+

- ${props.minInvestment.toLocaleString()} min. investment + + $ + {isNaN(props.minInvestment) || props.minInvestment == null + ? "N/A" + : props.minInvestment.toLocaleString()} + {" "} + min. investment

diff --git a/src/types/ProjectCard.ts b/src/types/ProjectCard.ts index 51e9955..ce70358 100644 --- a/src/types/ProjectCard.ts +++ b/src/types/ProjectCard.ts @@ -5,7 +5,7 @@ export interface ProjectCardProps { image_url: string; join_date: string; location: string; - tags: string[] | null; + tags?: string[] | null; min_investment: number; total_investor: number; total_raise: number;