feat(applicant): mentor list + request-change dialog (PR8 Task 7)

- /applicant/mentor renders all co-mentors as cards
- New "Request a mentor change" dialog opens a free-form reason + optional
  per-mentor target; calls mentor.requestChange and shows admin-routed
  confirmation toast
- Pending-request guard disables the button until the admin resolves
This commit is contained in:
Matt
2026-05-22 17:09:06 +02:00
parent ee47c0305f
commit ba115f71a0
3 changed files with 423 additions and 152 deletions

View File

@@ -1319,9 +1319,10 @@ export const applicantRouter = router({
mentorAssignments: {
include: {
mentor: {
select: { id: true, name: true, email: true },
select: { id: true, name: true, email: true, expertiseTags: true },
},
},
orderBy: { assignedAt: 'asc' },
},
wonAwards: {
select: { id: true, name: true },
@@ -1492,6 +1493,17 @@ export const applicantRouter = router({
logoUrl = await provider.getDownloadUrl(project.logoKey)
}
// Does this user have an open mentor-change request for this project?
// (Used by the applicant mentor page to disable the "Request a change" button.)
const myPendingChangeRequest = await ctx.prisma.mentorChangeRequest.findFirst({
where: {
projectId: project.id,
requestedByUserId: ctx.user.id,
status: 'PENDING',
},
select: { id: true },
})
return {
project: {
...project,
@@ -1505,6 +1517,7 @@ export const applicantRouter = router({
hasPassedIntake: !!passedIntake,
isIntakeOpen: !!activeIntakeRound,
logoUrl,
hasPendingMentorChangeRequest: !!myPendingChangeRequest,
}
}),