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

fix: hide credit class entry if no credit class #2214

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

flagrede
Copy link
Collaborator

@flagrede flagrede commented Nov 14, 2023

Description

Closes: #2205

Hide credit class entry in the user dropdown menu if the user has no credit class.

The credit class item was displayed in the user menu because if the allowed list param is not activated on the current chain, we display it by default. See this hook for more info.

The tab was not displayed in the user profile because we also checked the number of credit classes created there. This PR adds the same check for the user menu entry.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • provided a link to the relevant issue or specification
  • provided instructions on how to test
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

How to test

  1. https://deploy-preview-2214--regen-marketplace.netlify.app/

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items
.

I have...

  • confirmed all author checklist items have been addressed
  • reviewed code correctness and readability
  • verified React components follow DRY principles
  • reviewed documentation is accurate
  • reviewed tests
  • manually tested (if applicable)

Copy link

netlify bot commented Nov 14, 2023

Deploy Preview for regen-website ready!

Name Link
🔨 Latest commit a900c31
🔍 Latest deploy log https://app.netlify.com/sites/regen-website/deploys/655c863a0814a900084faa6d
😎 Deploy Preview https://deploy-preview-2214--regen-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@flagrede flagrede requested a review from a team November 14, 2023 11:24
@flagrede
Copy link
Collaborator Author

@erikalogie you can check that we no longer display the credit class entry incorrectly here: https://deploy-preview-2214--regen-marketplace.netlify.app/

@erikalogie
Copy link
Collaborator

@flagrede looks good!

@blushi
Copy link
Member

blushi commented Nov 15, 2023

Logging in with a credit class admin regen1df675r9vnf7pdedn4sf26svdsem3ugavgxmy46: http://redwood.regen.network:1317/regen/ecocredit/v1/classes-by-admin/regen1df675r9vnf7pdedn4sf26svdsem3ugavgxmy46, I'm now not seeing the credit classes tab/menu item at all:

image

It's still there on the public profile: https://deploy-preview-2214--regen-marketplace.netlify.app/profiles/regen1df675r9vnf7pdedn4sf26svdsem3ugavgxmy46/credit-classes

@flagrede
Copy link
Collaborator Author

@blushi good catch, I forgot to send back the user address in userProfileItems this fixed here: a04491a

@flagrede flagrede force-pushed the fix-2205-credit-classes-dropdown branch from a04491a to c284e7e Compare November 20, 2023 13:13
} = useProfileItems({});
const { activeAccount } = useAuth();
const { wallet, isConnected, accountByAddr } = useWallet();
} = useProfileItems({ address: wallet?.address });
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} = useProfileItems({ address: wallet?.address });
} = useProfileItems({});

@flagrede flagrede requested a review from blushi November 21, 2023 10:28
Copy link
Member

@blushi blushi left a comment

Choose a reason for hiding this comment

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

tACK

@blushi blushi merged commit f9afea6 into dev Nov 21, 2023
11 checks passed
@blushi blushi deleted the fix-2205-credit-classes-dropdown branch November 21, 2023 15:18
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.

User "credit classes" dropdown menu item appearing when it shouldn't
3 participants