-
Notifications
You must be signed in to change notification settings - Fork 16
connected wallet info #47
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
Merged
phipsae
merged 5 commits into
BuidlGuidl:main
from
nnennaokoye:feat/connected-wallet-info
May 29, 2025
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,71 @@ | ||
| "use client"; | ||
|
|
||
| import { zeroAddress } from "viem"; | ||
| import { useAccount } from "wagmi"; | ||
| import { CheckCircleIcon, UserGroupIcon, XCircleIcon } from "@heroicons/react/24/solid"; | ||
| import { useScaffoldReadContract } from "~~/hooks/scaffold-eth"; | ||
|
|
||
| export const BatchStatusIndicators = () => { | ||
| const { address: userAddress } = useAccount(); | ||
|
|
||
| // Check if address is in allowList (batch member) | ||
| const { data: allowListStatus, isLoading: isLoadingAllowList } = useScaffoldReadContract({ | ||
| contractName: "BatchRegistry", | ||
| functionName: "allowList", | ||
| args: [userAddress ?? zeroAddress], | ||
| chainId: 42161, | ||
| }); | ||
|
|
||
| // Check if address has checked in | ||
| const { data: contractAddress, isLoading: isLoadingContractAddress } = useScaffoldReadContract({ | ||
| contractName: "BatchRegistry", | ||
| functionName: "yourContractAddress", | ||
| args: [userAddress ?? zeroAddress], | ||
| chainId: 42161, | ||
| }); | ||
|
|
||
| const isInBatch = !!allowListStatus; | ||
| const isCheckedIn = contractAddress && contractAddress !== zeroAddress; | ||
|
|
||
| if (!userAddress) return null; | ||
|
|
||
| const isLoading = isLoadingAllowList || isLoadingContractAddress; | ||
|
|
||
| return ( | ||
| <div className="flex items-center space-x-2 mx-1"> | ||
| {isLoading ? ( | ||
| <div className="loading loading-spinner loading-xs"></div> | ||
| ) : ( | ||
| <> | ||
| {/* Batch Membership Indicator */} | ||
| <div | ||
| className={`tooltip tooltip-bottom ${!isInBatch ? "tooltip-error" : ""}`} | ||
| data-tip={isInBatch ? "Batch Member" : "Not a Batch Member"} | ||
| > | ||
| <div | ||
| className={`flex items-center justify-center w-6 h-6 rounded-full ${isInBatch ? "bg-primary/20" : "bg-error/20"}`} | ||
| > | ||
| <UserGroupIcon className={`h-5 w-5 ${isInBatch ? "text-primary font-bold" : "text-error"}`} /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Check-in Status Indicator */} | ||
| <div | ||
| className={`tooltip tooltip-bottom ${!isCheckedIn ? "tooltip-error" : ""}`} | ||
| data-tip={isCheckedIn ? "Checked In" : "Not Checked In"} | ||
| > | ||
| <div | ||
| className={`flex items-center justify-center w-6 h-6 rounded-full ${isCheckedIn ? "bg-success/20" : "bg-error/20"}`} | ||
| > | ||
| {isCheckedIn ? ( | ||
| <CheckCircleIcon className="h-4 w-4 text-success" /> | ||
| ) : ( | ||
| <XCircleIcon className="h-4 w-4 text-error" /> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, it’s almost perfect!
There’s just a small problem:
The content is overflowing the page’s width. Now, with the addition of your component, the page has an unnecessary horizontal scrollbar.
Maybe this is happening because of the tooltips, but that’s just a guess.
You can try different ways to fix it, but I believe you could either tweak the tooltip position or move the badges to the left of the connect button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, please review