diff --git a/src/app/(app)/prs/page.tsx b/src/app/(app)/prs/page.tsx index 7c1196a..2e77ada 100644 --- a/src/app/(app)/prs/page.tsx +++ b/src/app/(app)/prs/page.tsx @@ -118,6 +118,7 @@ function PRRow({ c, appUrl, isLast }: { c: Claim; appUrl: string; isLast: boolea export default function PRsPage() { const [claims, setClaims] = useState([]); const [filter, setFilter] = useState<"all" | "pending" | "claimed">("all"); + const [search, setSearch] = useState(""); const load = async () => { try { @@ -143,37 +144,72 @@ export default function PRsPage() { }, []); const filtered = claims.filter((c) => { - if (filter === "pending") return !c.claimed; - if (filter === "claimed") return c.claimed; + if (filter === "pending" && c.claimed) return false; + if (filter === "claimed" && !c.claimed) return false; + if (search) { + const q = search.toLowerCase(); + return c.githubUsername.toLowerCase().includes(q) || c.repo.toLowerCase().includes(q) || c.prTitle.toLowerCase().includes(q); + } return true; }); + const avgScore = claims.length ? Math.round(claims.reduce((s, c) => s + c.score, 0) / claims.length) : 0; const appUrl = typeof window !== "undefined" ? window.location.origin : ""; return ( <>
-
- {(["all", "pending", "claimed"] as const).map((f) => ( - - ))} + + {/* Stats row */} + {claims.length > 0 && ( +
+ {[ + { label: "Total PRs", value: claims.length }, + { label: "Pending", value: claims.filter(c => !c.claimed).length }, + { label: "Claimed", value: claims.filter(c => c.claimed).length }, + { label: "Avg Score", value: avgScore }, + ].map(({ label, value }) => ( +
+
{label}
+
{value}
+
+ ))} +
+ )} + + {/* Toolbar */} +
+
+ {(["all", "pending", "claimed"] as const).map((f) => ( + + ))} +
+ setSearch(e.target.value)} + placeholder="Search by contributor, repo, or title…" + style={{ + flex: 1, padding: "6px 12px", border: "1px solid #e4e4e7", borderRadius: "7px", + fontSize: "12px", fontFamily: "inherit", color: "#000", outline: "none", background: "#fff", + }} + />
{filtered.length === 0 ? (
-

No pull requests yet

+

{search ? "No results matched your search" : "No pull requests yet"}

) : (