Skip to content

Feature/team confirm reject buttons on project detail #59

Description

@dcl10

Description

The project detail page renders proposed teams read-only. Users with the ManageProjects role should be able to confirm or reject each proposed team directly from this page.

Backend behaviour (already implemented):

  • PUT /api/projects/{projectId}/teams/{teamId}/confirm — marks the team Confirmed and, if the project is currently Open, transitions it to TeamConfirmed. Requires CanManageProjects policy.
  • PUT /api/projects/{projectId}/teams/{teamId}/reject — marks the team Rejected; no side-effect on the project or other teams. Requires CanManageProjects policy.
  • Confirming one team does not auto-reject other proposed teams.
  • Both actions return the updated TeamDto.
  • Both return 409 Conflict if the team is not in Proposed status.

Auth: Buttons should only render when currentUser.role === "ManageProjects".

Frontend pattern to follow: InvitationCard.tsx + app/invitations/actions.ts — server actions that call the API, then revalidatePath, consumed by a client component using useTransition for pending state.

Tasks

  • Add confirmTeam(projectId, teamId, token) and rejectTeam(projectId, teamId, token) to frontend/lib/api/projects.ts (return Team type via apiRequest)
  • Add confirmTeamAction(projectId, teamId) and rejectTeamAction(projectId, teamId) server actions to frontend/app/projects/[projectId]/actions.ts; revalidate /projects/${projectId} on success
  • Extract team rendering into a new client component frontend/app/projects/[projectId]/_TeamCard.tsx; show confirm/reject buttons only when canManage && team.status === "Proposed"; mirror InvitationCard pattern (useTransition, disabled during pending, error display)
  • Update frontend/app/projects/[projectId]/page.tsx to fetch currentUser in parallel with project, derive canManage = currentUser.role === "ManageProjects", and pass it to <TeamCard>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions