diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 7b76c35..491ba62 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -8,6 +8,7 @@ import { TrendingUp, Wallet, ArrowUpRight, ArrowDownRight, type LucideIcon } fro import { fetchMe, type DashboardData } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; +import { Input } from "@/components/ui/input"; import { formatAmount, formatDateTime, getStatusColor } from "@/components/bounty/utils"; function DashboardSkeleton() { @@ -121,6 +122,7 @@ export default function DashboardPage() { const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); + const [searchTerm, setSearchTerm] = useState(""); useEffect(() => { fetchMe() @@ -155,6 +157,18 @@ export default function DashboardPage() { const { user, funded_bounties, won_bounties, stats } = data; + const filteredFundedBounties = funded_bounties.filter( + (bounty) => + bounty.owner.toLowerCase().includes(searchTerm.toLowerCase()) || + bounty.issue_title?.toLowerCase().includes(searchTerm.toLowerCase()) + ); + + const filteredWonBounties = won_bounties.filter( + (bounty) => + bounty.owner.toLowerCase().includes(searchTerm.toLowerCase()) || + bounty.issue_title?.toLowerCase().includes(searchTerm.toLowerCase()) + ); + return (
@@ -163,6 +177,16 @@ export default function DashboardPage() {

{user.email}

+
+ setSearchTerm(e.target.value)} + className="w-full" + /> +
+
Bounties You Funded
- {funded_bounties.length === 0 ? ( + {filteredFundedBounties.length === 0 ? (
-

You haven't funded any bounties yet

+

No funded bounties found

) : ( - funded_bounties.slice(0, 5).map((bounty) => ( + filteredFundedBounties.slice(0, 5).map((bounty) => ( )) )} - {funded_bounties.length > 5 && ( + {filteredFundedBounties.length > 5 && (

- +{funded_bounties.length - 5} more + +{filteredFundedBounties.length - 5} more

)}
@@ -216,19 +240,19 @@ export default function DashboardPage() {

Bounties You Won

- {won_bounties.length === 0 ? ( + {filteredWonBounties.length === 0 ? (
-

You haven't won any bounties yet

+

No won bounties found

Submit a PR to start earning!

) : ( - won_bounties.slice(0, 5).map((bounty) => ( + filteredWonBounties.slice(0, 5).map((bounty) => ( )) )} - {won_bounties.length > 5 && ( + {filteredWonBounties.length > 5 && (

- +{won_bounties.length - 5} more + +{filteredWonBounties.length - 5} more

)}