Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add builders list #19

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading