Skip to content

Commit

Permalink
Add builders list (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
wildanvin authored Jun 10, 2024
1 parent 9c011f4 commit c967d62
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
71 changes: 71 additions & 0 deletions packages/nextjs/app/builders/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"use client";

import Link from "next/link";
import type { NextPage } from "next";
import { MagnifyingGlassPlusIcon } from "@heroicons/react/24/outline";
import { Address } from "~~/components/scaffold-eth";
import { useScaffoldEventHistory } from "~~/hooks/scaffold-eth";

const Builders: NextPage = () => {
const { data: checkedInEvents } = useScaffoldEventHistory({
contractName: "BatchRegistry",
eventName: "CheckedIn",
fromBlock: 120936875n,
});

return (
<>
<div className="flex items-center flex-col flex-grow pt-10">
<div className="px-5">
<h1 className="text-center">
<span className="block text-4xl font-bold">Get to know Batch 6 builders!!</span>
</h1>
</div>
<div className="flex items-center flex-col flex-grow ">
<div className="mt-8">
<div className="overflow-x-auto shadow-lg">
<table className="table table-zebra w-full">
<thead>
<tr>
<th className="bg-primary text-lg">Address </th>
<th className="bg-primary text-lg">Info</th>
</tr>
</thead>
<tbody>
{!checkedInEvents || checkedInEvents.length === 0 ? (
<tr>
<td colSpan={2} className="text-center text-3xl">
Loading builders...
</td>
</tr>
) : (
checkedInEvents
.slice()
.reverse()
.filter(event => event.args.first)
.map((event, index) => {
return (
<tr key={index}>
<td className="text-center bg-base-100">
<Address size="xl" address={event.args.builder} />
</td>
<td className="bg-base-100">
<Link href={`/builders/${event.args.builder}`} passHref className="link">
<MagnifyingGlassPlusIcon className="h-8 w-8 fill-secondary" />
</Link>
</td>
</tr>
);
})
)}
</tbody>
</table>
</div>
</div>
</div>
</div>
</>
);
};

export default Builders;
7 changes: 6 additions & 1 deletion packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Link from "next/link";
import { usePathname } from "next/navigation";
import { zeroAddress } from "viem";
import { useAccount } from "wagmi";
import { Bars3Icon, BugAntIcon, CheckIcon, HandThumbUpIcon, XMarkIcon } from "@heroicons/react/24/outline";
import { Bars3Icon, BugAntIcon, CheckIcon, HandThumbUpIcon, UsersIcon, XMarkIcon } from "@heroicons/react/24/outline";
import { FaucetButton, RainbowKitCustomConnectButton } from "~~/components/scaffold-eth";
import { useOutsideClick, useScaffoldReadContract } from "~~/hooks/scaffold-eth";

Expand All @@ -21,6 +21,11 @@ export const menuLinks: HeaderMenuLink[] = [
label: "Home",
href: "/",
},
{
label: "Builders",
href: "/builders",
icon: <UsersIcon className="h-4 w-4" />,
},
{
label: "Debug Contracts",
href: "/debug",
Expand Down

0 comments on commit c967d62

Please sign in to comment.