Skip to content

Commit b86fb46

Browse files
authored
feat(explorer): add filter groups by admin (#24)
re #23
1 parent 1baabdf commit b86fb46

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

apps/explorer/src/app/[network]/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ export default function Network() {
3434
}, [])
3535

3636
const filterGroups = useCallback(
37-
(groupId: string) => {
38-
const groups = allGroups.filter((group) => (!groupId ? true : group.id.includes(groupId)))
37+
(groupIdOrAdmin: string) => {
38+
let groups: GroupResponse[]
39+
if (groupIdOrAdmin.startsWith("0x")) {
40+
groupIdOrAdmin = groupIdOrAdmin.toLowerCase()
41+
groups = allGroups.filter((group) => (!groupIdOrAdmin ? true : group.admin?.includes(groupIdOrAdmin)))
42+
} else {
43+
groups = allGroups.filter((group) => (!groupIdOrAdmin ? true : group.id.includes(groupIdOrAdmin)))
44+
}
3945

4046
setFilteredGroups(groups)
4147
},
@@ -49,7 +55,7 @@ export default function Network() {
4955
) : (
5056
allGroups && (
5157
<div className="mx-auto max-w-7xl px-4 lg:px-8 pt-20">
52-
<SearchBar className="mb-6" placeholder="Group ID" onChange={filterGroups} />
58+
<SearchBar className="mb-6" placeholder="Group ID, Admin" onChange={filterGroups} />
5359

5460
<div className="flex justify-center flex-col pb-10 font-[family-name:var(--font-geist-sans)]">
5561
<ul className="divide-y divide-gray-300 min-w-xl">

0 commit comments

Comments
 (0)