Skip to content

Commit 64328c2

Browse files
richieb21YashK2005
andauthored
Frontend for admin-facing matching screens (#85)
## Notion ticket link <!-- Please replace with your ticket's URL --> [Admin Dashboard Matching Pages](https://www.notion.so/uwblueprintexecs/Admin-Dash-Matching-Pages-27210f3fb1dc800aa962c0bb5c09ba15) <!-- Give a quick summary of the implementation details, provide design justifications if necessary --> ## Implementation description * Added API clients to send in matches along with fetching rankings for a user * Added description to the existing taskAPIClient to add notes * Added profile + notes modals * Added component for scrollable table <!-- What should the reviewer do to verify your changes? Describe expected results and include screenshots when appropriate --> ## Steps to test 1. Log in as admin 2. Go to directory 3. Click on a participant and click matching 4. Should see full matching table sorted by matching score decreasing <!-- Draw attention to the substantial parts of your PR or anything you'd like a second opinion on --> ## What should reviewers focus on? * Verify the matching is accurate and the styling is nice TODO: - Add a way to sort asc/desc on each column - Make scrollbar light ## Checklist - [ ] My PR name is descriptive and in imperative tense - [ ] My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits - [ ] I have run the appropriate linter(s) - [ ] I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR --------- Co-authored-by: YashK2005 <[email protected]>
1 parent d62bf1c commit 64328c2

File tree

6 files changed

+882
-0
lines changed

6 files changed

+882
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* API Client for match endpoints
3+
*/
4+
5+
import baseAPIClient from './baseAPIClient';
6+
7+
export interface MatchCreateRequest {
8+
participantId: string;
9+
volunteerIds: string[];
10+
matchStatus?: string;
11+
}
12+
13+
export interface MatchResponse {
14+
id: number;
15+
participantId: string;
16+
volunteerId: string;
17+
matchStatus: string;
18+
chosenTimeBlockId?: number | null;
19+
createdAt: string;
20+
updatedAt?: string | null;
21+
}
22+
23+
export interface MatchCreateResponse {
24+
matches: MatchResponse[];
25+
}
26+
27+
export const matchAPIClient = {
28+
/**
29+
* Create matches between a participant and volunteers
30+
* @param request Match creation request
31+
* @returns Created matches
32+
*/
33+
createMatches: async (request: MatchCreateRequest): Promise<MatchCreateResponse> => {
34+
const response = await baseAPIClient.post<MatchCreateResponse>('/matches/', request);
35+
return response.data;
36+
},
37+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* API Client for matching endpoints
3+
*/
4+
5+
import baseAPIClient from './baseAPIClient';
6+
7+
export interface AdminMatchCandidate {
8+
volunteerId: string;
9+
firstName: string | null;
10+
lastName: string | null;
11+
email: string;
12+
timezone: string | null;
13+
age: number | null;
14+
diagnosis: string | null;
15+
treatments: string[];
16+
experiences: string[];
17+
matchScore: number;
18+
}
19+
20+
export interface AdminMatchesResponse {
21+
matches: AdminMatchCandidate[];
22+
}
23+
24+
export const matchingAPIClient = {
25+
/**
26+
* Get potential volunteer matches for a participant (admin only)
27+
* @param participantId Participant user ID
28+
* @returns List of volunteer matches with full details and scores
29+
*/
30+
getAdminMatches: async (participantId: string): Promise<AdminMatchesResponse> => {
31+
const response = await baseAPIClient.get<AdminMatchesResponse>(
32+
`/matching/admin/${participantId}`,
33+
);
34+
return response.data;
35+
},
36+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* API Client for ranking endpoints
3+
*/
4+
5+
import baseAPIClient from './baseAPIClient';
6+
7+
export interface RankingPreference {
8+
kind: 'quality' | 'treatment' | 'experience';
9+
id: number;
10+
scope: 'self' | 'loved_one';
11+
rank: number;
12+
name: string;
13+
}
14+
15+
export const rankingAPIClient = {
16+
/**
17+
* Get ranking preferences for a user (admin only)
18+
* @param userId User ID
19+
* @param target Target role ('patient' or 'caregiver')
20+
* @returns List of ranking preferences
21+
*/
22+
getPreferences: async (
23+
userId: string,
24+
target: 'patient' | 'caregiver',
25+
): Promise<RankingPreference[]> => {
26+
const response = await baseAPIClient.get<RankingPreference[]>(
27+
`/ranking/preferences/${userId}`,
28+
{
29+
params: { target },
30+
},
31+
);
32+
return response.data;
33+
},
34+
};

0 commit comments

Comments
 (0)