Add filter by tag to deals page

This commit is contained in:
sirin 2024-10-03 09:37:15 +07:00
parent 02e204d877
commit 8d56fbce2f
4 changed files with 44 additions and 108 deletions

View File

@ -1,18 +1,7 @@
"use client"; "use client";
import { import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { useState } from "react"; import { useState } from "react";
import { import { Clock3Icon, MessageSquareIcon, UserIcon, UsersIcon } from "lucide-react";
Clock3Icon,
MessageSquareIcon,
UserIcon,
UsersIcon,
} from "lucide-react";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import { ExtendableCard } from "@/components/extendableCard"; import { ExtendableCard } from "@/components/extendableCard";
@ -21,14 +10,14 @@ export default function Deals() {
const [contentTypeFilter, setContentTypeFilter] = useState(""); const [contentTypeFilter, setContentTypeFilter] = useState("");
const [authorFilter, setAuthorFilter] = useState(""); const [authorFilter, setAuthorFilter] = useState("");
const [groupsFilter, setGroupFilter] = useState(""); const [groupsFilter, setGroupFilter] = useState("");
const [selectedTag, setSelectedTag] = useState("");
const data = [ const data = [
{ {
name: "NVDA", name: "NVDA",
description: description: "Founded in 1993, NVIDIA is a key innovator of computer graphics and AI technology",
"Founded in 1993, NVIDIA is a key innovator of computer graphics and AI technology",
joinDate: "December 2021", joinDate: "December 2021",
location: "Bangkok, Thailand", location: "Bangkok, Thailand",
tags: null, tags: ["AI", "Technology"],
minInvestment: 10000, minInvestment: 10000,
totalInvestor: 58400, totalInvestor: 58400,
totalRaised: 9000000, 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.", "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", joinDate: "February 2020",
location: "Cupertino, California, USA", location: "Cupertino, California, USA",
tags: null, tags: ["Consumer Electronics", "Software"],
minInvestment: 10000, minInvestment: 10000,
totalInvestor: 58400, totalInvestor: 58400,
totalRaised: 9000000, 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.", "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", joinDate: "April 2019",
location: "Mountain View, California, USA", location: "Mountain View, California, USA",
tags: null, tags: ["Internet", "Search Engine"],
minInvestment: 10000, minInvestment: 10000,
totalInvestor: 5000, totalInvestor: 5000,
totalRaised: 1500000000, totalRaised: 1500000000,
}, },
{ {
name: "Microsoft Corporation", name: "Microsoft Corporation",
description: description: "Microsoft Corporation is a multinational technology company.",
"Microsoft Corporation is a multinational technology company.",
joinDate: "January 2018", joinDate: "January 2018",
location: "California, USA", location: "California, USA",
tags: null, tags: ["Technology", "Software"],
minInvestment: 250, minInvestment: 250,
totalInvestor: 5000, totalInvestor: 5000,
totalRaised: 1500000, totalRaised: 1500000,
}, },
]; ];
const filteredData = selectedTag ? data.filter((item) => item.tags.includes(selectedTag)) : data;
return ( return (
<div> <div>
<div className=" w-1/2 h-[250px] mt-10 ml-[15%]"> <div className=" w-1/2 h-[250px] mt-10 ml-[15%]">
<h1 className="text-4xl font-bold">Investment Opportunities </h1> <h1 className="text-4xl font-bold">Investment Opportunities</h1>
<br /> <br />
<p>Browse current investment opportunities on Republic. </p> <p>Browse current investment opportunities on B2DVenture.</p>
<p> <p>
All companies are <u>vetted & pass due diligence.</u> All companies are <u>vetted & pass due diligence.</u>
</p> </p>
@ -89,40 +79,22 @@ export default function Deals() {
<SelectItem value="Yesterday">Yesterday</SelectItem> <SelectItem value="Yesterday">Yesterday</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
<Select onValueChange={(value) => setContentTypeFilter(value)}> <Select onValueChange={(value) => setSelectedTag(value)}>
{" "}
{/* Tag filtering */}
<SelectTrigger className="w-[180px]"> <SelectTrigger className="w-[180px]">
<MessageSquareIcon className="ml-2" /> <MessageSquareIcon className="ml-2" />
<SelectValue placeholder="Content type" /> <SelectValue placeholder="Tags" />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="Blog">Blog</SelectItem> <SelectItem value="_">All Tags</SelectItem> {/* Reset filter */}
<SelectItem value="Youtube">Youtube</SelectItem> <SelectItem value="AI">AI</SelectItem>
<SelectItem value="Technology">Technology</SelectItem>
<SelectItem value="Consumer Electronics">Consumer Electronics</SelectItem>
<SelectItem value="Software">Software</SelectItem>
<SelectItem value="Internet">Internet</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
<Select onValueChange={(value) => setAuthorFilter(value)}>
<SelectTrigger className="w-[180px]">
<UserIcon className="ml-2" />
<SelectValue placeholder="Author" />
</SelectTrigger>
<SelectContent>
<SelectItem value="Me">Me</SelectItem>
<SelectItem value="Charlie Puth">Charlie Puth</SelectItem>
</SelectContent>
</Select>
<Select onValueChange={(value) => setGroupFilter(value)}>
<SelectTrigger className="w-[180px]">
<UsersIcon />
<SelectValue placeholder="Sent to groups" />
</SelectTrigger>
<SelectContent>
<SelectItem value="Group1">Group1</SelectItem>
<SelectItem value="Group2">Group2</SelectItem>
</SelectContent>
</Select>
{/* {postAtFilter}
{contentTypeFilter}
{authorFilter}
{groupsFilter} */}
</div> </div>
<Separator className="mt-10" /> <Separator className="mt-10" />
</div> </div>
@ -133,7 +105,7 @@ export default function Deals() {
</div> </div>
{/* block for all the deals */} {/* block for all the deals */}
<div className="ml-[15%] mt-10 grid grid-cols-3"> <div className="ml-[15%] mt-10 grid grid-cols-3">
{data.map((item, index) => ( {filteredData.map((item, index) => (
<ExtendableCard <ExtendableCard
key={index} key={index}
name={item.name} name={item.name}

View File

@ -164,7 +164,7 @@ export default function Find() {
minInvestment={project.ProjectInvestmentDetail[0]?.minInvestment} minInvestment={project.ProjectInvestmentDetail[0]?.minInvestment}
totalInvestor={project.ProjectInvestmentDetail[0]?.totalInvestment} totalInvestor={project.ProjectInvestmentDetail[0]?.totalInvestment}
totalRaised={project.ProjectInvestmentDetail[0]?.targetInvestment} totalRaised={project.ProjectInvestmentDetail[0]?.targetInvestment}
tags={null} tags={[]}
/> />
))} ))}
</CardContent> </CardContent>

View File

@ -1,13 +1,7 @@
import Image from "next/image"; import Image from "next/image";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import Link from "next/link"; import Link from "next/link";
import { import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import { ExtendableCard } from "@/components/extendableCard"; import { ExtendableCard } from "@/components/extendableCard";
@ -17,13 +11,9 @@ export default function Home() {
<div className="flex flex-row bg-slate-100 dark:bg-gray-800"> <div className="flex flex-row bg-slate-100 dark:bg-gray-800">
<div className="flex flex-col w-3/5"> <div className="flex flex-col w-3/5">
<span className="px-10 md:px-28 py-10 md:py-20"> <span className="px-10 md:px-28 py-10 md:py-20">
<p className="text-lg md:text-4xl font-bold"> <p className="text-lg md:text-4xl font-bold">Explore the world of ventures</p>
Explore the world of ventures
</p>
<span className="text-sm md:text-lg"> <span className="text-sm md:text-lg">
<p> <p>Unlock opportunities and connect with a community of passionate</p>
Unlock opportunities and connect with a community of passionate
</p>
<p>investors and innovators.</p> <p>investors and innovators.</p>
<p>Together, we turn ideas into impact.</p> <p>Together, we turn ideas into impact.</p>
</span> </span>
@ -69,23 +59,11 @@ export default function Home() {
</CardHeader> </CardHeader>
<CardContent className="flex gap-2"> <CardContent className="flex gap-2">
<Button className="flex gap-1 border-2 border-border rounded-md p-1 bg-background text-foreground scale-75 md:scale-100"> <Button className="flex gap-1 border-2 border-border rounded-md p-1 bg-background text-foreground scale-75 md:scale-100">
<Image <Image src={"/github.svg"} width={20} height={20} alt="github" className="scale-75 md:scale-100" />
src={"/github.svg"}
width={20}
height={20}
alt="github"
className="scale-75 md:scale-100"
/>
Github Github
</Button> </Button>
<Button className="flex gap-1 border-2 border-border rounded-md p-1 bg-background text-foreground scale-75 md:scale-100"> <Button className="flex gap-1 border-2 border-border rounded-md p-1 bg-background text-foreground scale-75 md:scale-100">
<Image <Image src={"/github.svg"} width={20} height={20} alt="github" className="scale-75 md:scale-100" />
src={"/github.svg"}
width={20}
height={20}
alt="github"
className="scale-75 md:scale-100"
/>
Github Github
</Button> </Button>
</CardContent> </CardContent>
@ -97,20 +75,16 @@ export default function Home() {
<div className="flex flex-col px-10 md:px-28"> <div className="flex flex-col px-10 md:px-28">
<span className="pb-5"> <span className="pb-5">
<p className="text-xl md:text-2xl font-bold">Hottest Deals</p> <p className="text-xl md:text-2xl font-bold">Hottest Deals</p>
<p className="text-md md:text-lg"> <p className="text-md md:text-lg">The deals attracting the most interest right now</p>
The deals attracting the most interest right now
</p>
</span> </span>
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4"> <div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
<Link href={"/invest"}> <Link href={"/invest"}>
<ExtendableCard <ExtendableCard
name={"NVDA"} name={"NVDA"}
description={ description={"Founded in 1993, NVIDIA is a key innovator of computer graphics and AI technology"}
"Founded in 1993, NVIDIA is a key innovator of computer graphics and AI technology"
}
joinDate={"December 2021"} joinDate={"December 2021"}
location={"Bangkok, Thailand"} location={"Bangkok, Thailand"}
tags={null} tags={[]}
minInvestment={10000} minInvestment={10000}
totalInvestor={58400} totalInvestor={58400}
totalRaised={9000000} totalRaised={9000000}
@ -123,7 +97,7 @@ export default function Home() {
} }
joinDate={"February 2020"} joinDate={"February 2020"}
location={"Cupertino, California, USA"} location={"Cupertino, California, USA"}
tags={null} tags={[]}
minInvestment={10000} minInvestment={10000}
totalInvestor={58400} totalInvestor={58400}
totalRaised={9000000} totalRaised={9000000}
@ -135,19 +109,17 @@ export default function Home() {
} }
joinDate={"April 2019"} joinDate={"April 2019"}
location={"Mountain View, California, USA"} location={"Mountain View, California, USA"}
tags={null} tags={[]}
minInvestment={10000} minInvestment={10000}
totalInvestor={5000} totalInvestor={5000}
totalRaised={1500000000} totalRaised={1500000000}
/> />
<ExtendableCard <ExtendableCard
name={"Microsoft Corporation"} name={"Microsoft Corporation"}
description={ description={"Microsoft Corporation is a multinational technology company."}
"Microsoft Corporation is a multinational technology company."
}
joinDate={"January 2018"} joinDate={"January 2018"}
location={"California, USA"} location={"California, USA"}
tags={null} tags={[]}
minInvestment={250} minInvestment={250}
totalInvestor={5000} totalInvestor={5000}
totalRaised={1500000} totalRaised={1500000}

View File

@ -11,7 +11,7 @@ interface ExtendableCardProps {
description: string; description: string;
joinDate: string; joinDate: string;
location: string; location: string;
tags: XMap | null; tags: XMap | null | never[] | string[];
minInvestment: number; minInvestment: number;
totalInvestor: number; totalInvestor: number;
totalRaised: number; totalRaised: number;
@ -46,11 +46,8 @@ export function ExtendableCard(props: ExtendableCardProps) {
<span className="text-xs md:text-sm">{props.location}</span> <span className="text-xs md:text-sm">{props.location}</span>
</div> </div>
<div className="mt-2 flex flex-wrap items-center text-muted-foreground group-hover:hidden"> <div className="mt-2 flex flex-wrap items-center text-muted-foreground group-hover:hidden">
{["Technology", "Gaming"].map((tag) => ( {props.tags.map((tag) => (
<span <span key={tag} className="text-[10px] md:text-xs rounded-md bg-slate-200 dark:bg-slate-700 p-1 mx-1 mb-1">
key={tag}
className="text-[10px] md:text-xs rounded-md bg-slate-200 dark:bg-slate-700 p-1 mx-1 mb-1"
>
{tag} {tag}
</span> </span>
))} ))}
@ -58,26 +55,21 @@ export function ExtendableCard(props: ExtendableCardProps) {
{/* Hover content (appears when hovered) */} {/* Hover content (appears when hovered) */}
<div className="mt-4 max-h-0 overflow-hidden opacity-0 group-hover:max-h-[500px] group-hover:opacity-100 transition-all duration-1000 ease-in-out"> <div className="mt-4 max-h-0 overflow-hidden opacity-0 group-hover:max-h-[500px] group-hover:opacity-100 transition-all duration-1000 ease-in-out">
<p className="text-xs md:text-sm text-muted-foreground"> <p className="text-xs md:text-sm text-muted-foreground">{props.description}</p>
{props.description}
</p>
<div className="mt-4 flex items-center justify-between"> <div className="mt-4 flex items-center justify-between">
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<div> <div>
<hr className="w-screen -ml-4 mb-2" /> <hr className="w-screen -ml-4 mb-2" />
<p className="text-xs md:text-base"> <p className="text-xs md:text-base">
<strong>${props.totalRaised.toLocaleString()}</strong>{" "} <strong>${props.totalRaised.toLocaleString()}</strong> committed and reserved
committed and reserved
</p> </p>
<hr className="w-screen -ml-4 mb-2 mt-2" /> <hr className="w-screen -ml-4 mb-2 mt-2" />
<p className="mb-2 text-xs md:text-base"> <p className="mb-2 text-xs md:text-base">
<strong>{props.totalInvestor.toLocaleString()}</strong>{" "} <strong>{props.totalInvestor.toLocaleString()}</strong> investors
investors
</p> </p>
<hr className="w-screen -ml-4 mb-2" /> <hr className="w-screen -ml-4 mb-2" />
<p className="text-xs md:text-base"> <p className="text-xs md:text-base">
<strong>${props.minInvestment.toLocaleString()}</strong> min. <strong>${props.minInvestment.toLocaleString()}</strong> min. investment
investment
</p> </p>
</div> </div>
</div> </div>