Skip to content

Commit 65be553

Browse files
committed
updated profile card
1 parent 5bf6804 commit 65be553

File tree

3 files changed

+124
-39
lines changed

3 files changed

+124
-39
lines changed

frontend/src/components/dashboard/Badge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const Badge: React.FC<BadgeProps> = ({
1313
icon,
1414
iconSrc,
1515
children,
16-
bgColor = "#F5F5F5",
17-
textColor = "#6B7280"
16+
bgColor = "rgba(179, 206, 209, 0.3)",
17+
textColor = "#056067"
1818
}) => {
1919
return (
2020
<Box

frontend/src/components/dashboard/ProfileCard.tsx

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface ProfileCardProps {
1919
timezone: string;
2020
diagnosis: string;
2121
treatments: string[];
22+
experiences?: string[];
2223
initials: string;
2324
};
2425
time?: Date;
@@ -56,10 +57,10 @@ const ProfileCard: React.FC<ProfileCardProps> = ({
5657
>
5758
{formatTime(time)}
5859
</Text>
59-
<Box
60-
w="4px"
61-
h="314px"
62-
bg="#5F989D"
60+
<Box
61+
w="4px"
62+
h="371px"
63+
bg="#5F989D"
6364
borderRadius="11px"
6465
/>
6566
</HStack>
@@ -89,9 +90,9 @@ const ProfileCardContent: React.FC<{
8990
onViewContact?: () => void;
9091
}> = ({ participant, onScheduleCall, onViewContact }) => {
9192
return (
92-
<Box
93+
<Box
9394
w="675px"
94-
h="314px"
95+
h="371px"
9596
border="1px solid #D5D7DA"
9697
borderRadius="8px"
9798
bg="white"
@@ -153,7 +154,7 @@ const ProfileCardContent: React.FC<{
153154

154155
{/* Treatment Information - Left aligned to the box */}
155156
<Box mt={4}>
156-
<Text
157+
<Text
157158
fontSize="1.125rem"
158159
fontWeight={600}
159160
color="#1D3448"
@@ -164,22 +165,46 @@ const ProfileCardContent: React.FC<{
164165
>
165166
Treatment Information
166167
</Text>
167-
<HStack gap={4} wrap="wrap">
168+
<HStack gap={2} wrap="wrap">
168169
{participant.treatments.map((treatment: string, index: number) => (
169-
<Text
170+
<Badge
170171
key={index}
171-
fontSize="1rem"
172-
fontWeight={400}
173-
color="#495D6C"
174-
fontFamily="'Open Sans', sans-serif"
175-
lineHeight="100%"
176-
letterSpacing="0%"
172+
bgColor="#EEF4FF"
173+
textColor="#3538CD"
177174
>
178-
{treatment}
179-
</Text>
175+
{treatment}
176+
</Badge>
180177
))}
181178
</HStack>
182179
</Box>
180+
181+
{/* Experience Information */}
182+
{participant.experiences && participant.experiences.length > 0 && (
183+
<Box mt={4}>
184+
<Text
185+
fontSize="1.125rem"
186+
fontWeight={600}
187+
color="#1D3448"
188+
fontFamily="'Open Sans', sans-serif"
189+
lineHeight="1.875rem"
190+
letterSpacing="0%"
191+
mb="16px"
192+
>
193+
Experience Information
194+
</Text>
195+
<HStack gap={2} wrap="wrap">
196+
{participant.experiences.map((experience: string, index: number) => (
197+
<Badge
198+
key={index}
199+
bgColor="#FDF2FA"
200+
textColor="#C11574"
201+
>
202+
{experience}
203+
</Badge>
204+
))}
205+
</HStack>
206+
</Box>
207+
)}
183208
</VStack>
184209

185210
{/* Action Button - Positioned at bottom */}

frontend/src/pages/volunteer/dashboard.tsx

Lines changed: 80 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,24 @@ import {
88
import { VolunteerDashboardLayout } from '@/components/dashboard/VolunteerDashboardLayout';
99
import ProfileCard from '@/components/dashboard/ProfileCard';
1010
import { getCurrentUser } from '@/APIClients/authAPIClient';
11+
import baseAPIClient from '@/APIClients/baseAPIClient';
12+
13+
interface MatchedParticipant {
14+
id: number;
15+
name: string;
16+
pronouns: string;
17+
age: number;
18+
timezone: string;
19+
diagnosis: string;
20+
treatments: string[];
21+
experiences: string[];
22+
initials: string;
23+
}
1124

1225
const VolunteerDashboardPage: React.FC = () => {
1326
const [userName, setUserName] = useState('');
14-
const [matchedParticipants, setMatchedParticipants] = useState([]);
27+
const [matchedParticipants, setMatchedParticipants] = useState<MatchedParticipant[]>([]);
28+
const [loading, setLoading] = useState(true);
1529

1630
useEffect(() => {
1731
const loadData = async () => {
@@ -22,26 +36,72 @@ const VolunteerDashboardPage: React.FC = () => {
2236
setUserName(firstName);
2337
}
2438

25-
// TODO: Fetch matched participants from API
26-
// const fetchMatches = async () => {
27-
// try {
28-
// const response = await baseAPIClient.get('/matching/my-matches');
29-
// setMatchedParticipants(response.data.matches);
30-
// } catch (error) {
31-
// console.error('Error fetching matches:', error);
32-
// }
33-
// };
34-
// fetchMatches();
39+
// Fetch matched participants from API
40+
try {
41+
const response = await baseAPIClient.get('/matches/volunteer/me');
42+
const matches = response.data.matches || [];
43+
44+
// Filter matches that need to be scheduled (pending or awaiting_volunteer_acceptance)
45+
const matchesNeedingScheduling = matches.filter((match: any) => {
46+
const status = match.matchStatus?.toLowerCase() || '';
47+
return status === 'pending' || status === 'awaiting_volunteer_acceptance';
48+
});
49+
50+
// Transform API response to match ProfileCard format
51+
const transformedMatches = matchesNeedingScheduling.map((match: any) => {
52+
const participant = match.participant;
53+
const firstName = participant.firstName || '';
54+
const lastName = participant.lastName || '';
55+
const fullName = `${firstName} ${lastName}`.trim();
56+
57+
return {
58+
id: match.id, // Use match ID instead of participant UUID
59+
name: fullName || participant.email,
60+
pronouns: participant.pronouns?.join('/') || '',
61+
age: participant.age || 0,
62+
timezone: participant.timezone || 'N/A',
63+
diagnosis: participant.diagnosis || 'N/A',
64+
treatments: participant.treatments || [],
65+
experiences: participant.experiences || [],
66+
initials: `${firstName.charAt(0)}${lastName.charAt(0)}`.toUpperCase() || '?'
67+
};
68+
});
69+
70+
setMatchedParticipants(transformedMatches);
71+
} catch (error) {
72+
console.error('Error fetching matches:', error);
73+
} finally {
74+
setLoading(false);
75+
}
3576
};
3677

3778
loadData();
3879
}, []);
3980

81+
if (loading) {
82+
return (
83+
<VolunteerDashboardLayout>
84+
<Box display="flex" justifyContent="center" w="100%">
85+
<Box w="711px">
86+
<Text
87+
fontSize="16px"
88+
color="#6B7280"
89+
fontFamily="'Open Sans', sans-serif"
90+
textAlign="left"
91+
>
92+
Loading matches...
93+
</Text>
94+
</Box>
95+
</Box>
96+
</VolunteerDashboardLayout>
97+
);
98+
}
99+
40100
return (
41101
<VolunteerDashboardLayout>
42102
<Box display="flex" justifyContent="center" w="100%">
43103
<Box w="711px">
44-
<Heading
104+
<Heading
45105
fontSize="2.25rem"
46106
fontWeight={600}
47107
lineHeight="100%"
@@ -51,29 +111,29 @@ const VolunteerDashboardPage: React.FC = () => {
51111
textAlign="left"
52112
mb={2}
53113
>
54-
{matchedParticipants.length > 0
114+
{matchedParticipants.length > 0
55115
? `Participants have matched with you, ${userName}!`
56116
: `No New Matches${userName ? `, ${userName}` : ''}`
57117
}
58118
</Heading>
59-
60-
<Text
61-
fontSize="16px"
62-
color="#6B7280"
119+
120+
<Text
121+
fontSize="16px"
122+
color="#6B7280"
63123
fontFamily="'Open Sans', sans-serif"
64124
textAlign="left"
65125
mb={8}
66126
>
67-
{matchedParticipants.length > 0
127+
{matchedParticipants.length > 0
68128
? "Please schedule calls with your matches."
69129
: "Keep an eye out on your inbox! We'll notify you when we match you with a participant."
70130
}
71131
</Text>
72132

73133
{matchedParticipants.length > 0 && (
74134
<VStack gap={6} align="flex-start">
75-
{matchedParticipants.map((participant: any) => (
76-
<ProfileCard
135+
{matchedParticipants.map((participant) => (
136+
<ProfileCard
77137
key={participant.id}
78138
participant={participant}
79139
onScheduleCall={() => {

0 commit comments

Comments
 (0)