Skip to content

Commit

Permalink
Updated builders grid
Browse files Browse the repository at this point in the history
  • Loading branch information
gboigwe committed Nov 24, 2024
1 parent e521be8 commit f06c50e
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 168 deletions.

This file was deleted.

19 changes: 10 additions & 9 deletions packages/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@

import Link from "next/link";
import type { NextPage } from "next";
import { useContractRead } from "wagmi";
import { BugAntIcon, MagnifyingGlassIcon, RocketLaunchIcon, UserGroupIcon } from "@heroicons/react/24/outline";
import BuildersGrid from "~~/components/batch/BuildersGrid";
import deployedContracts from "~~/contracts/deployedContracts";

const BATCH_REGISTRY_ADDRESS = "0x65E42251A2ca0906c640331afd77f45F4682c56C";
const BATCH_REGISTRY_ABI = deployedContracts[31337].BatchRegistry.abi;
import { useScaffoldReadContract } from "~~/hooks/scaffold-eth/useScaffoldReadContract";

const Home: NextPage = () => {
const { data: checkedInCount, isLoading } = useContractRead({
address: BATCH_REGISTRY_ADDRESS,
abi: BATCH_REGISTRY_ABI,
const {
data: checkedInCount,
isLoading,
error,
} = useScaffoldReadContract({
contractName: "BatchRegistry",
functionName: "checkedInCounter",
});

const displayCount = isLoading ? (
<span className="loading loading-spinner loading-sm text-primary"></span>
) : checkedInCount ? (
) : error ? (
"Error loading"
) : typeof checkedInCount === "bigint" ? (
checkedInCount.toString()
) : (
"0"
Expand Down
15 changes: 0 additions & 15 deletions packages/nextjs/components/batch/BuildersGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@ interface Builder {
address: string;
}

// This needs to be in a server component or API route
// async function getBuilderAddresses() {
// const buildersPath = path.join(process.cwd(), 'app/builders');
// try {
// const directories = await readdir(buildersPath, { withFileTypes: true });
// return directories
// .filter(dirent => dirent.isDirectory())
// .map(dirent => dirent.name)
// .filter(name => name.startsWith('0x'));
// } catch (error) {
// console.error('Error reading builders directory:', error);
// return [];
// }
// }

// Client component
const BuildersGrid = () => {
const [builders, setBuilders] = useState<Builder[]>([]);
Expand Down
Loading

0 comments on commit f06c50e

Please sign in to comment.