From 8d56fbce2f319380b69d9e1da9d88c26164f7877 Mon Sep 17 00:00:00 2001 From: sirin Date: Thu, 3 Oct 2024 09:37:15 +0700 Subject: [PATCH] Add filter by tag to deals page --- src/app/deals/page.tsx | 76 ++++++++++--------------------- src/app/find/page.tsx | 2 +- src/app/page.tsx | 52 +++++---------------- src/components/extendableCard.tsx | 22 +++------ 4 files changed, 44 insertions(+), 108 deletions(-) diff --git a/src/app/deals/page.tsx b/src/app/deals/page.tsx index 21678af..85a375b 100644 --- a/src/app/deals/page.tsx +++ b/src/app/deals/page.tsx @@ -1,18 +1,7 @@ "use client"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { useState } from "react"; -import { - Clock3Icon, - MessageSquareIcon, - UserIcon, - UsersIcon, -} from "lucide-react"; +import { Clock3Icon, MessageSquareIcon, UserIcon, UsersIcon } from "lucide-react"; import { Separator } from "@/components/ui/separator"; import { ExtendableCard } from "@/components/extendableCard"; @@ -21,14 +10,14 @@ export default function Deals() { const [contentTypeFilter, setContentTypeFilter] = useState(""); const [authorFilter, setAuthorFilter] = useState(""); const [groupsFilter, setGroupFilter] = useState(""); + const [selectedTag, setSelectedTag] = useState(""); const data = [ { name: "NVDA", - description: - "Founded in 1993, NVIDIA is a key innovator of computer graphics and AI technology", + description: "Founded in 1993, NVIDIA is a key innovator of computer graphics and AI technology", joinDate: "December 2021", location: "Bangkok, Thailand", - tags: null, + tags: ["AI", "Technology"], minInvestment: 10000, totalInvestor: 58400, totalRaised: 9000000, @@ -39,7 +28,7 @@ export default function Deals() { "Founded in 1976, Apple Inc. is a leading innovator in consumer electronics, software, and online services, known for products like the iPhone, MacBook, and the App Store.", joinDate: "February 2020", location: "Cupertino, California, USA", - tags: null, + tags: ["Consumer Electronics", "Software"], minInvestment: 10000, totalInvestor: 58400, totalRaised: 9000000, @@ -50,30 +39,31 @@ export default function Deals() { "Founded in 1998, Google LLC specializes in internet-related services and products, including search engines, online advertising, cloud computing, and the Android operating system.", joinDate: "April 2019", location: "Mountain View, California, USA", - tags: null, + tags: ["Internet", "Search Engine"], minInvestment: 10000, totalInvestor: 5000, totalRaised: 1500000000, }, { name: "Microsoft Corporation", - description: - "Microsoft Corporation is a multinational technology company.", + description: "Microsoft Corporation is a multinational technology company.", joinDate: "January 2018", location: "California, USA", - tags: null, + tags: ["Technology", "Software"], minInvestment: 250, totalInvestor: 5000, totalRaised: 1500000, }, ]; + const filteredData = selectedTag ? data.filter((item) => item.tags.includes(selectedTag)) : data; + return (
-

Investment Opportunities

+

Investment Opportunities


-

Browse current investment opportunities on Republic.

+

Browse current investment opportunities on B2DVenture.

All companies are vetted & pass due diligence.

@@ -89,40 +79,22 @@ export default function Deals() { Yesterday - setSelectedTag(value)}> + {" "} + {/* Tag filtering */} - + - Blog - Youtube + All Tags {/* Reset filter */} + AI + Technology + Consumer Electronics + Software + Internet - - - {/* {postAtFilter} - {contentTypeFilter} - {authorFilter} - {groupsFilter} */}
@@ -133,7 +105,7 @@ export default function Deals() { {/* block for all the deals */}
- {data.map((item, index) => ( + {filteredData.map((item, index) => ( ))} diff --git a/src/app/page.tsx b/src/app/page.tsx index 1bfadfb..8650999 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,13 +1,7 @@ import Image from "next/image"; import { Button } from "@/components/ui/button"; import Link from "next/link"; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { ExtendableCard } from "@/components/extendableCard"; @@ -17,13 +11,9 @@ export default function Home() {
-

- Explore the world of ventures -

+

Explore the world of ventures

-

- Unlock opportunities and connect with a community of passionate -

+

Unlock opportunities and connect with a community of passionate

investors and innovators.

Together, we turn ideas into impact.

@@ -69,23 +59,11 @@ export default function Home() { @@ -97,20 +75,16 @@ export default function Home() {

Hottest Deals

-

- The deals attracting the most interest right now -

+

The deals attracting the most interest right now

{props.location}
- {["Technology", "Gaming"].map((tag) => ( - + {props.tags.map((tag) => ( + {tag} ))} @@ -58,26 +55,21 @@ export function ExtendableCard(props: ExtendableCardProps) { {/* Hover content (appears when hovered) */}
-

- {props.description} -

+

{props.description}


- ${props.totalRaised.toLocaleString()}{" "} - committed and reserved + ${props.totalRaised.toLocaleString()} committed and reserved


- {props.totalInvestor.toLocaleString()}{" "} - investors + {props.totalInvestor.toLocaleString()} investors


- ${props.minInvestment.toLocaleString()} min. - investment + ${props.minInvestment.toLocaleString()} min. investment