Skip to content

Add return grant button to grant cards (#175) #189

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
merged 6 commits into from
Jun 17, 2025

Conversation

rocristoi
Copy link
Contributor

Summary of the problem

Problem #175 - there is no button to return grants on the mobile app, this adds one.

Describe your changes

I've added a "Cancel Grant" button to each Grant Card. When clicked, it displays a warning message—just like the one on HCB Web—informing the user about the action they're about to take. The user can either cancel or confirm the action. If confirmed, the grant is canceled using the new HCB V4 API endpoint: /api/v4/card_grants/:id/cancel. A spinner appears on the button to provide feedback to the client and prevent duplicate API calls, and an error alert is shown if the API request fails.

Checklist

  • Descriptive PR title (Does the title explain the changes in a concise manner?)
  • Tag related issues so they auto-close on merge
  • Easily digestible commits (Are the commits small and easy to understand?) video
  • CI passes (Do the GitHub checks pass?)
  • Tested by submitter before requesting review (Does it work in development iOS/android? )
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-05-25.at.12.27.55.mp4

@rocristoi rocristoi requested a review from a team as a code owner May 25, 2025 09:44
@Luke-Oldenburg
Copy link
Collaborator

Does this work for managers too? If so the button should appear as cancel grant to them unless it's their own grant also.

@rocristoi
Copy link
Contributor Author

I'll look into this later this week.

@rocristoi
Copy link
Contributor Author

Simulator Screenshot - iPhone 16 Pro - 2025-06-17 at 21 29 40
Added a check to see if the user is the card's org manager and stored it inside a useState called isOrgManager. The screenshot represents what a manager sees.

Copy link
Collaborator

@thedev132 thedev132 left a comment

Choose a reason for hiding this comment

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

LGTM :) You didn't need to add isOrgManager you can just say if they aren't the cardholder as this is cleaner towards admins. Made the fixes accordingly

@thedev132 thedev132 merged commit be72fe2 into hackclub:main Jun 17, 2025
4 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.

3 participants