Skip to content

Feat/adoption approval buttons#300

Open
Mitch5000 wants to merge 7 commits intoamina69:mainfrom
Mitch5000:feat/adoption-approval-buttons
Open

Feat/adoption approval buttons#300
Mitch5000 wants to merge 7 commits intoamina69:mainfrom
Mitch5000:feat/adoption-approval-buttons

Conversation

@Mitch5000
Copy link
Copy Markdown

Implement ApprovalDecisionButtons Component

Summary
Approve/reject buttons for adoption approvals with rejection reason modal.

Changes

  • ApprovalDecisionButtons` component with conditional rendering
  • Approve button (one-click submission)
  • Reject button (opens modal for reason)
  • Toast notifications on success/error
  • submitApprovalDecision` method in adoptionApprovalsService
  • 18 unit tests

Tests
All passing - covers visibility, mutations, modals, and accessibility

Closes #178

Mitch5000 added 5 commits March 29, 2026 19:49
…-party approval UI

- Create PendingApprovalBadge component showing pending approval count
- Integrate badge into Navbar on Approvals nav link
- Add approvalService with GET /shelter/approvals endpoint
- Implement usePendingApprovals hook with 5-minute polling
- Create ApprovalsPage for managing pending approvals
- Add comprehensive unit tests (32 total):
  * PendingApprovalBadge component tests (9)
  * usePendingApprovals hook tests (8)
  * approvalService tests (6)
  * Navbar integration tests (9)
  * ApprovalsPage tests (10)

Features:
- Red badge displaying pending approval count
- '9+' display cap for counts above 9
- Role-based visibility (SHELTER & ADMIN only)
- Badge auto-hides when count reaches 0
- Real-time polling every 5 minutes
- Loading, error, and forbidden states
- Type-safe API responses
- Full error handling
- Added AdoptionApprovalsState and ApprovalParty types to adoption.ts
- Created adoptionApprovalsService with getAdoptionApprovals method
- Implemented useAdoptionApprovals hook with:
  * Fetches from GET /adoption/:id/approvals endpoint
  * Returns {required, given, pending, quorumMet, escrowAccountId, isLoading, isError}
  * Polls every 30s while quorumMet is false
  * Stops polling once quorum is reached
  * Stale time set to 30 seconds

- Added MSW handlers with pre-quorum and post-quorum mock shapes:
  * adoption-pending: shows 3 required, 1 given, 2 pending, quorumMet: false
  * adoption-approved: shows 3 required, 3 given, 0 pending, quorumMet: true

- Added comprehensive unit tests (18 total):
  * useAdoptionApprovals hook tests (12 tests)
  * adoptionApprovalsService tests (6 tests)
  * Covers polling behavior, quorum state transitions, error handling
  * Tests verify polling stops when quorumMet becomes true
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@Mitch5000 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[Frontend · Multi-party approval UI] Create ApproveRejectButtons component

1 participant