fix: wire real data into agent profile Volunteers section#799
Open
nadavosa wants to merge 1 commit into
Open
Conversation
VolunteerAgents.tsx never fetched any data — useTabTransitions was called with a hardcoded [], so the section always showed 0 in every tab even when volunteers were genuinely matched via the agent's opportunities. Wires it up to the new GET /agent/:id/volunteer-linked endpoint (need4deed-org/be#759), mirroring OpportunityVolunteers.tsx's existing fetch/tabs/mutation pattern. Also fixes two latent bugs in the never-rendered sibling components: - AccordionVolunteer used statusEngagement/statusType field names that don't exist on ApiVolunteerOpportunityGet (it's engagement/ volunteeringType), and a hardcoded placeholder date. - The "go to profile" link used the opportunity-volunteer match id instead of the volunteer's own id, which would have routed to the wrong profile page.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
VolunteerAgents.tsx(the "Ehrenamtliche"/Volunteers section on the NGO/agent's own profile) never fetched any data —useTabTransitionswas called with a hardcoded[], so every status tab always showed 0, even when the NGO genuinely had volunteers matched via its opportunities.Related Issues
Closes #777
Changes
VolunteerAgentsup to the newGET /agent/:id/volunteer-linkedendpoint (feat(#759): add GET /agent/:id/volunteer-linked be#762 / feat: GET /agent/:id/volunteer-linked — volunteers connected to an agent via its opportunities be#759), mirroringOpportunityVolunteers.tsx's existing fetch/tabs/mutation pattern (sameuseTabTransitions, sameuseUpdateOpportunityVolunteerStatus/useDeleteOpportunityVolunteerhooks)AccordionVolunteer/VolunteerDetailcomponents (they existed fully built but were never imported byVolunteerAgents.tsx)MappedVolunteerAgenttype now aliasesApiVolunteerOpportunityGetdirectly (the actual shape the endpoint returns) instead of an ad-hocApiVolunteerGetList & { status }comboAccordionVolunteer.tsx:statusEngagement/statusTypefield names that don't exist onApiVolunteerOpportunityGet(the real fields areengagement/volunteeringType) — always evaluated toundefinedvolunteer.id(the opportunity-volunteer match id) instead ofvolunteer.volunteerId— would have routed to the wrong profile page12.02.2025) in favor of the realupdatedAtNote
No backend available in my working environment to test the full round-trip live (needs need4deed-org/be#762 merged and deployed first). Typecheck, lint, and the pre-commit hooks all pass. The component logic mirrors
OpportunityVolunteers.tsxclosely — would appreciate a manual check once both PRs are merged to a shared environment.Depends on
GET /agent/:id/volunteer-linkedendpoint this relies on)Checklist
OpportunityVolunteers.tsx/VolunteerOpportunities.tsx, which also have no test coverage