Skip to content
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

Feat: show connected wallet info #22

Merged

Conversation

DimaKush
Copy link
Contributor

@DimaKush DimaKush commented Jan 9, 2025

Description

Added builder status indicators (batch membership and check-in status) to the wallet connection dropdown.

Changes

  • Created useBuilderStatus hook to fetch status from BatchRegistry contract
  • Added status icons to AddressInfoDropdown component
  • Shows green icons for allowlisted and checked-in addresses

Testing

  1. Connect wallet
  2. Verify batch member icon (group) appears if address is allowlisted
  3. Verify check-in icon appears if address has checked in

Screenshot

Screenshot 2025-01-09 at 19-32-55 Debug Contracts Scaffold-ETH 2

Related Issues

Closes #7

This PR includes:

  • The new useBuilderStatus hook
  • Modified AddressInfoDropdown component
  • Proper imports and status indicators

The changes are focused and minimal, adding the requested functionality without unnecessary modifications.

ENS/address: 0x845D62b5405aAAe6b95CF3fbf33968A1E71a9cAD

Copy link

vercel bot commented Jan 9, 2025

@DimaKush is attempting to deploy a commit to the BuidlGuidl Team on Vercel.

A member of the Team first needs to authorize it.

@derrekcoleman
Copy link
Member

Thank you for the PR, @DimaKush! I appreciate your detailed description and screenshot, very professional.

Let's take a step back and consider the goal of the issue. The idea is to give the user visual feedback for whether they are (1) on the allowList and (2) checkedIn or not. Your current implementation shows these icons inside of the wallet component, making it impossible (or at least not obvious) to hover these icons and discover what they are trying to say. Maybe moving them next to (but outside of) the wallet component would make this UX more discoverable.

Thinking about state for a moment, there are several possible paths:

  • No wallet connected (we want user to connect)
  • Connected, not on allowList (we want to let them know)
  • Connected, on allowList, not checkedIn (we want them to checkIn)
  • Connected, on allowList, checkedIn (we want them to feel successful)

How might you represent each of these states in a way that helps the user discover the next step they need to take? Right now you show green icons for true states, but what about "failing gracefully" and guiding the user for false states?

@FrankiePower
Copy link

@DimaKush i think you did a good job. but i have an idea for something. if you want you can let me do it or make improvement to yours or do it instead

Screenshot from 2025-01-10 09-34-58

@derrekcoleman if @DimaKush is okay with it, i can do this. or we could just go which whatever he has. this is just the idea i had for it and i thought to share

@DimaKush
Copy link
Contributor Author

DimaKush commented Jan 10, 2025

@FrankiePower Yep looks good, but on mobile we don't have a lot of space at Header. So I moved this to main page.

@FrankiePower
Copy link

okay @DimaKush . also if you don't mind i'd like to see a preview (screenshot) of what it looks like

@DimaKush
Copy link
Contributor Author

image
image
image

@All-Khwarizmi
Copy link
Contributor

All-Khwarizmi commented Jan 10, 2025

I'm not working on this but reading through your work I thought we could mix it together.

Since I would prefer the current user status information to be displayed in the header, it would be nice to have a more concise unique badge, instead of two, that is responsible for displaying the user status.

Enregistrement.de.l.ecran.2025-01-10.a.15.59.12.mov

What do you think?

@FrankiePower
Copy link

i think i also like what @All-Khwarizmi is proposing. we can find a way to implement the responsiveness for other screens. but then you'd also have to find a way to display what @DimaKush is trying to display.

@derrekcoleman
Copy link
Member

I love this conversation! This design "problem" appears all of the time - we want the information to be obvious/available (e.g. in the header of all pages), but need it to be concise/unobtrusive (e.g. make sense on mobile).

Personally, I like the pattern of using attention-grabbing icons (imagine ❗ for error states) with on-hover/on-click tooltips that the user can easily discover to learn more in 1-2 sentences.

@DimaKush
Copy link
Contributor Author

Move Status Component to Header

Moved batch status from homepage to header for better UX. Users can now see their allowlist/check-in status from any page.

Before

  • Status only visible on homepage
  • Had to navigate back to check status
  • Easy to miss important state changes

After

  • Always visible in header
  • Quick access to GitHub/batch links
  • Immediate feedback on status changes
  • Works well on mobile/desktop

Changes

  • Moved UserStateInBatch component into Header

Screenshots

Screenshot from 2025-01-12 11-50-05
Screenshot from 2025-01-12 11-50-23
Screenshot from 2025-01-12 11-51-46

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
batch12.buidlguidl.com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 20, 2025 3:10am

Copy link
Member

@derrekcoleman derrekcoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really nice! Thanks for incorporating all of our feedback, @DimaKush. I think the URLs are a really nice touch 👌

Could you please use git rebase to drop the first commit related to your personal page? Once it's gone from the commit history, you can git push --force to update this PR as if it was never there. This is your chance to practice git-fu 🥷

Copy link
Member

@derrekcoleman derrekcoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! I love the way you've factored it.

Now I'm really pushing you to polish the core code and get it production-ready (i.e. easier to maintain later) before we merge 🏋️

packages/nextjs/components/UserStateInBatch.tsx Outdated Show resolved Hide resolved
packages/nextjs/components/UserStateInBatch.tsx Outdated Show resolved Hide resolved
@DimaKush DimaKush force-pushed the feat--Show-connected-wallet-info branch from 905fe1c to b9e3dcd Compare January 16, 2025 10:54
@DimaKush
Copy link
Contributor Author

refactor: improve wallet disconnected state UX and reduce code duplication

  • Replace null return with disconnected state UI
  • Add wallet icon and config for disconnected state
  • Show helpful message when wallet isn't connected
  • Extract builder state logic into custom hook useBuilderState
  • Add warning type to notification system
  • Reduce repetition in state/notification management
  • Improve component reusability by decoupling state and display logic
  • Move state configs to single file for better maintainability
  • Centralize builder state type definitions

image

Copy link
Member

@derrekcoleman derrekcoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates, @DimaKush! It's looking very solid.

Found a little UI bug where there isn't any spacing when wallet connected and is on "wrong network" (not OP Mainnet)
Screenshot 2025-01-16 at 12 33 33 PM

Please remember to respond to and resolve previous review comments as you address them. It makes it much easier for the review (or other people taking a look at the PR) to come back and see what has changed since the last review.

- Add network validation for Optimism mainnet
- Show wallet icon with warning style for wrong network
- Add helpful notification to switch networks
- Use wagmi's useChainId for reliable network detection
- Maintain consistent UI with other wallet states
- Add wrong network to builder state types and configs
@DimaKush
Copy link
Contributor Author

Thank you for feedback, @derrekcoleman !

Thanks for the updates, @DimaKush! It's looking very solid.

Found a little UI bug where there isn't any spacing when wallet connected and is on "wrong network" (not OP Mainnet) Screenshot 2025-01-16 at 12 33 33 PM

Please remember to respond to and resolve previous review comments as you address them. It makes it much easier for the review (or other people taking a look at the PR) to come back and see what has changed since the last review.

Summarize of all changes in this PR:

Display User State In Batch Feature

This PR adds comprehensive user state display functionality with improved UX and code organization.

Purpose

This feature helps users understand their current state in the builder system and guides them through the necessary steps to participate.

Files Changed & Their Purpose

🎯 Core Logic

hooks/useBuilderState.ts

  • Purpose: Central source of truth for builder state management
  • Handles all state checks (wallet, network, allowlist, check-in)
  • Provides type-safe state configs and notifications
  • Single responsibility: determine and provide user's current state

🎨 UI Components

components/builderState/BuilderStateIcon.tsx

  • Purpose: Visual indicator for user's current state
  • Shows different icons based on state (wallet, check mark, group)
  • Provides consistent visual feedback through colors and animations
  • Handles hover tooltips for quick status understanding

components/builderState/BuilderNotification.tsx

  • Purpose: Interactive feedback system
  • Shows actionable notifications with relevant links
  • Guides users through required steps
  • Provides clear feedback for state changes

components/BuilderStateInBatch.tsx

  • Purpose: Main container component
  • Orchestrates state and UI components
  • Handles user interactions
  • Maintains consistent layout across states

Technical Details

  • DRY code with shared styles and configs
  • Type-safe state management
  • Proper error handling
  • Consistent styling

@phipsae phipsae requested a review from derrekcoleman January 21, 2025 13:22
Copy link
Member

@derrekcoleman derrekcoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm proud of this PR, DimaKush - and I hope you are too. Great code organization across and within files and good job covering lots of edge-cases in a consistent way.

Comment on lines +11 to +13
const baseStyles = "h-6 w-6 cursor-pointer";
const warningStyles = `${baseStyles} text-warning animate-pulse`;
const walletStyles = `${warningStyles} mr-2`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tailwind purists will say not to do it this way, but I think this kind of "inheritance" pattern is easy to read, understand, and maintain in this case!

Comment on lines +16 to +20
notAllowlisted: <UserGroupIcon className={warningStyles} />,
notCheckedIn: <CheckCircleIcon className={warningStyles} />,
checkedIn: <CheckCircleIcon className={`${baseStyles} text-success`} />,
disconnected: <WalletIcon className={walletStyles} />,
wrongNetwork: <WalletIcon className={walletStyles} />,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@derrekcoleman derrekcoleman merged commit fdd34bd into BuidlGuidl:main Jan 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6. Show connected wallet info
4 participants