Skip to content

fix: wire real data into agent profile Volunteers section#799

Open
nadavosa wants to merge 1 commit into
developfrom
777-agent-volunteers-section
Open

fix: wire real data into agent profile Volunteers section#799
nadavosa wants to merge 1 commit into
developfrom
777-agent-volunteers-section

Conversation

@nadavosa

Copy link
Copy Markdown
Collaborator

Description

VolunteerAgents.tsx (the "Ehrenamtliche"/Volunteers section on the NGO/agent's own profile) never fetched any data — useTabTransitions was 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

  • Wires VolunteerAgents up to the new GET /agent/:id/volunteer-linked endpoint (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), mirroring OpportunityVolunteers.tsx's existing fetch/tabs/mutation pattern (same useTabTransitions, same useUpdateOpportunityVolunteerStatus/useDeleteOpportunityVolunteer hooks)
  • Renders the previously-unused AccordionVolunteer/VolunteerDetail components (they existed fully built but were never imported by VolunteerAgents.tsx)
  • MappedVolunteerAgent type now aliases ApiVolunteerOpportunityGet directly (the actual shape the endpoint returns) instead of an ad-hoc ApiVolunteerGetList & { status } combo
  • Fixed two latent bugs in the never-rendered AccordionVolunteer.tsx:
    • Used statusEngagement/statusType field names that don't exist on ApiVolunteerOpportunityGet (the real fields are engagement/volunteeringType) — always evaluated to undefined
    • "Go to profile" linked to volunteer.id (the opportunity-volunteer match id) instead of volunteer.volunteerId — would have routed to the wrong profile page
    • Also removed a hardcoded placeholder date (12.02.2025) in favor of the real updatedAt

Note

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.tsx closely — would appreciate a manual check once both PRs are merged to a shared environment.

Depends on

Checklist

  • WITHIN THE SCOPE OF AN ISSUE; No unnecessary files included
  • Tests added/updated — no dedicated tests, consistent with OpportunityVolunteers.tsx/VolunteerOpportunities.tsx, which also have no test coverage
  • Documentation updated
  • CI passes

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.
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.

bug: volunteers not shown under their NGO despite being connected via opportunities

1 participant