-
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.
Merge pull request #15 from melanke/batch11-badges
Showing badges for members - for issue #5
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 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
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,39 @@ | ||
import { useAccount } from "wagmi"; | ||
import { BookmarkSquareIcon, IdentificationIcon, SignalSlashIcon } from "@heroicons/react/24/outline"; | ||
import { useScaffoldReadContract } from "~~/hooks/scaffold-eth"; | ||
|
||
export const UserBadges = () => { | ||
const { address } = useAccount(); | ||
|
||
const { data: isBuilderOfBatch11 } = useScaffoldReadContract({ | ||
contractName: "BatchRegistry", | ||
functionName: "allowList", | ||
args: [address], | ||
}); | ||
|
||
const { data: contractAddress } = useScaffoldReadContract({ | ||
contractName: "BatchRegistry", | ||
functionName: "yourContractAddress", | ||
args: [address], | ||
}); | ||
|
||
const madeCheckin = contractAddress && contractAddress !== "0x0000000000000000000000000000000000000000"; | ||
|
||
return ( | ||
<div className="flex gap-2 mr-2"> | ||
{madeCheckin ? ( | ||
<div className="tooltip tooltip-bottom" data-tip="A builder of batch 11 with confirmed checkin"> | ||
<BookmarkSquareIcon className="h-7 w-7 p-1 bg-secondary-content text-secondary rounded-full" /> | ||
</div> | ||
) : isBuilderOfBatch11 ? ( | ||
<div className="tooltip tooltip-bottom" data-tip="A builder of batch 11"> | ||
<IdentificationIcon className="h-7 w-7 p-1 bg-secondary-content text-secondary rounded-full" /> | ||
</div> | ||
) : ( | ||
<div className="tooltip tooltip-bottom" data-tip="Not a builder of batch 11"> | ||
<SignalSlashIcon className="h-7 w-7 p-1 opacity-50" /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; |