-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
benhur
committed
Aug 26, 2024
1 parent
c9de764
commit 76d600d
Showing
6 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useAccount } from "wagmi"; | ||
import { useIsCheckedIn } from "~~/hooks/scaffold-eth/useIsCheckedIn"; | ||
|
||
export const CheckInFlag = () => { | ||
const isCheckedIn = useIsCheckedIn(); | ||
const { isConnected } = useAccount(); | ||
return ( | ||
<button | ||
className={`${isCheckedIn ? "bg-green-600" : "bg-red-500 mr-3"} ${isConnected ? "" : "hidden"} px-3 py-2 sm:py-1.5 rounded-full shadow-xl font-semibold text-sm `} | ||
onClick={() => | ||
isCheckedIn | ||
? alert(`You have checkedIn using the above contract ${isCheckedIn}`) | ||
: window.open("https://github.com/BuidlGuidl/batch8.buidlguidl.com/issues/10", "_blank") | ||
} | ||
> | ||
<span className="hidden sm:inline-block">{isCheckedIn ? "CheckedIn 🎉" : "CheckIn 🤔"}</span> | ||
<span className="sm:hidden"> {isCheckedIn ? "🎉" : "🤔"}</span> | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { useScaffoldReadContract } from "./useScaffoldReadContract"; | ||
import { useAccount } from "wagmi"; | ||
|
||
//Checks whether they are a member of batch 8! | ||
export const useCheckIsMember = () => { | ||
const { address } = useAccount(); | ||
const { data } = useScaffoldReadContract({ | ||
contractName: "BatchRegistry", | ||
functionName: "allowList", | ||
args: [address], | ||
}); | ||
|
||
return data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useScaffoldReadContract } from "./useScaffoldReadContract"; | ||
import { useAccount } from "wagmi"; | ||
|
||
export const useIsCheckedIn = () => { | ||
const { address } = useAccount(); | ||
const { data } = useScaffoldReadContract({ | ||
contractName: "BatchRegistry", | ||
functionName: "yourContractAddress", | ||
args: [address], | ||
}); | ||
if (data == "0x0000000000000000000000000000000000000000") { | ||
return false; | ||
} | ||
return data; | ||
}; |