Skip to content

Commit ed90efd

Browse files
committed
2024-10-14 - cert badge changes
1 parent 7cbf05e commit ed90efd

File tree

1 file changed

+76
-5
lines changed

1 file changed

+76
-5
lines changed

web-ui/src/components/earned-certifications/EarnedCertificationBadges.jsx

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,82 @@ const EarnedCertificationBadges = ({ memberId, certifications }) => {
5454
const cert = certifications.find(c => c.id === earnedCert.certificationId);
5555
// If no matching cert is found, skip rendering for that earnedCert
5656
if (!cert) return null;
57-
return (
58-
<Tooltip key={earnedCert.id} title={cert.name}>
59-
<img alt={cert.name} src={cert.badgeUrl} />
60-
</Tooltip>
61-
);
57+
if (cert.badgeUrl && cert.badgeUrl.trim().length > 0) {
58+
return (
59+
<Tooltip
60+
key={earnedCert.id}
61+
title={
62+
<>
63+
{cert.name} <br />
64+
Issued on: {earnedCert.earnedDate} <br />
65+
Expires on: {earnedCert.expirationDate}
66+
</>
67+
}
68+
>
69+
{earnedCert.validationUrl ? (
70+
<a href={earnedCert.validationUrl} target="_blank" rel="noopener noreferrer">
71+
<img
72+
alt={`${cert.name}, Issued on: ${earnedCert.earnedDate}, Expires on: ${earnedCert.expirationDate}`}
73+
src={cert.badgeUrl}
74+
/>
75+
</a>
76+
) : (
77+
<img
78+
alt={`${cert.name}, Issued on: ${earnedCert.earnedDate}, Expires on: ${earnedCert.expirationDate}`}
79+
src={cert.badgeUrl}
80+
/>
81+
)}
82+
</Tooltip>
83+
);
84+
} else {
85+
return (
86+
<>
87+
{earnedCert.validationUrl ? (
88+
<a href={earnedCert.validationUrl} target="_blank" rel="noopener noreferrer" style={{ textDecoration: 'none' }}>
89+
<Chip
90+
sx={{
91+
height: 'auto',
92+
'& .MuiChip-label': {
93+
display: 'block',
94+
whiteSpace: 'normal',
95+
},
96+
}}
97+
className="chip"
98+
color="primary"
99+
key={earnedCert.id}
100+
label={
101+
<>
102+
{cert.name} <br />
103+
Issued on: {earnedCert.earnedDate}<br />
104+
Expires on: {earnedCert.expirationDate}
105+
</>
106+
}
107+
/>
108+
</a>
109+
) : (
110+
<Chip
111+
sx={{
112+
height: 'auto',
113+
'& .MuiChip-label': {
114+
display: 'block',
115+
whiteSpace: 'normal',
116+
},
117+
}}
118+
className="chip"
119+
color="primary"
120+
key={earnedCert.id}
121+
label={
122+
<>
123+
{cert.name} <br />
124+
Issued on: {earnedCert.earnedDate}<br />
125+
Expires on: {earnedCert.expirationDate}
126+
</>
127+
}
128+
/>
129+
)}
130+
</>
131+
);
132+
}
62133
})}
63134
</CardContent>
64135
</Card>

0 commit comments

Comments
 (0)