diff --git a/packages/nextjs/app/page.tsx b/packages/nextjs/app/page.tsx
index 2ba44ec..5a377e0 100644
--- a/packages/nextjs/app/page.tsx
+++ b/packages/nextjs/app/page.tsx
@@ -2,37 +2,179 @@
import Link from "next/link";
import type { NextPage } from "next";
+import { useAccount } from "wagmi";
import { BugAntIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline";
+import { Address } from "~~/components/scaffold-eth";
import { useScaffoldReadContract } from "~~/hooks/scaffold-eth";
+interface Props {
+ children: React.ReactNode;
+ className?: string;
+}
+
+interface BatchUserStatus {
+ connectedAddress: string;
+ isAllowListed: boolean;
+ isCheckedIn: boolean;
+ isLoading: boolean;
+}
+
+const Alert = ({ children, className = "" }: Props) => (
+
{children}
+);
+
+const AlertTitle = ({ children }: Props) => (
+ {children}
+);
+
+const AlertDescription = ({ children }: Props) => {children}
;
+
+const Card = ({ children, className = "" }: Props) => (
+
+ {children}
+
+);
+
+const CardHeader = ({ children, className = "" }: Props) => (
+ {children}
+);
+
+const CardTitle = ({ children }: Props) => (
+ {children}
+);
+
+const CardContent = ({ children, className = "" }: Props) => {children}
;
+
+const StatusSection = ({ connectedAddress, isAllowListed, isCheckedIn, isLoading }: BatchUserStatus) => {
+ if (isLoading) {
+ return (
+
+
+
+
+
+
Checking your status...
+
+
+
+
+ );
+ }
+
+ if (!connectedAddress) {
+ return (
+
+ Connect Your Wallet
+ Please connect your wallet to view your Batch 10 status
+
+ );
+ }
+
+ if (!isAllowListed) {
+ return (
+
+
+
+ Your Status
+ Not a Member
+
+
+
+ You are not currently a member of Batch 10
+
+
+ );
+ }
+
+ if (!isCheckedIn) {
+ return (
+
+
+
+ Your Status
+
+ Ready to Check In
+
+
+
+
+ You are a Batch 10 member! Deploy your contract to check in
+
+
+ );
+ }
+
+ return (
+
+
+
+ Your Status
+ Checked In
+
+
+
+
+ Active with wallet address:
+
+
+
+ );
+};
+
const Home: NextPage = () => {
+ const { address: connectedAddress } = useAccount();
+
const {
data: checkedInCounter,
- error,
- isLoading: contractLoading,
+ error: counterError,
+ isLoading: counterLoading,
} = useScaffoldReadContract({
contractName: "BatchRegistry",
functionName: "checkedInCounter",
});
+ const {
+ data: isAllowListed,
+ error: allowListError,
+ isLoading: allowListLoading,
+ } = useScaffoldReadContract({
+ contractName: "BatchRegistry",
+ functionName: "allowList",
+ args: [connectedAddress],
+ });
+
+ const {
+ data: userContractAddress,
+ error: checkInError,
+ isLoading: checkInLoading,
+ } = useScaffoldReadContract({
+ contractName: "BatchRegistry",
+ functionName: "yourContractAddress",
+ args: [connectedAddress],
+ });
+
+ const error = counterError || allowListError || checkInError;
+ const isLoading = counterLoading || allowListLoading || checkInLoading;
+ const isCheckedIn = userContractAddress && userContractAddress !== "0x0000000000000000000000000000000000000000";
+
return (
- <>
-
-
-
- Welcome to
- Batch 10
-
-
Get started by taking a look at your batch GitHub repository.
-
- {error ? (
-
-
Error fetching contract data: {error.message}
-
- ) : (
-
+
+
+
+ Welcome to
+ Batch 10
+
+
Get started by taking a look at your batch GitHub repository.
+
+ {error ? (
+
+
Error fetching contract data: {error.message}
+
+ ) : (
+
+
Checked in builders count:
- {contractLoading ? (
+ {counterLoading ? (
@@ -40,35 +182,42 @@ const Home: NextPage = () => {
{checkedInCounter !== undefined ? Number(checkedInCounter) : "0"}
)}
- )}
-
-
-
-
-
-
- Tinker with your smart contract using the{" "}
-
- Debug Contracts
- {" "}
- tab.
-
-
-
-
-
- Explore your local transactions with the{" "}
-
- Block Explorer
- {" "}
- tab.
-
-
+
+
+ )}
+
+
+
+
+
+
+
+ Tinker with your smart contract using the{" "}
+
+ Debug Contracts
+ {" "}
+ tab.
+
+
+
+
+
+ Explore your local transactions with the{" "}
+
+ Block Explorer
+ {" "}
+ tab.
+
- >
+
);
};