Skip to content

Commit 7899b7f

Browse files
Merge pull request #3459 from OneCommunityGlobal/shashank_fix_Anniversary_Component
Shashank - Darkmode compatibility and profile picture fallback
2 parents f25e247 + f3f0990 commit 7899b7f

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

src/components/TotalOrgSummary/AnniversaryCelebrated/AnniversaryCelebrated.jsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { useHistory } from 'react-router-dom';
2-
import { IoPersonOutline } from 'react-icons/io5';
32
import { SiGmail } from 'react-icons/si';
43
import Loading from 'components/common/Loading';
54
import sixMonthsAward from '../images/sixMonthsAward.svg';
65
import oneYearAward from '../images/oneYearAward.svg';
76

8-
export default function AnniversaryCelebrated({ isLoading, data }) {
7+
export default function AnniversaryCelebrated({ isLoading, data, darkMode }) {
98
const history = useHistory();
109
const sixMonthsData = data?.['6Months'] || { comparisonPercentage: 0 };
1110
const oneYearData = data?.['1Year'] || { comparisonPercentage: 0 };
@@ -17,7 +16,6 @@ export default function AnniversaryCelebrated({ isLoading, data }) {
1716
const handleEmailClick = email => {
1817
history.push('/sendemail', { state: { email } });
1918
};
20-
2119
const getAnniversaryListItem = (userData = [], anniversaryMonths = 6) => {
2220
const { _id, profilePic, email, firstName, lastName } = userData;
2321
return (
@@ -31,24 +29,28 @@ export default function AnniversaryCelebrated({ isLoading, data }) {
3129
margin: '10px 15px',
3230
}}
3331
>
34-
{profilePic ? (
35-
<img
36-
src={profilePic}
37-
alt="profile"
38-
className="rounded-circle ms-5"
39-
style={{ width: '30px', height: '30px' }}
40-
/>
41-
) : (
42-
<IoPersonOutline size={30} className="" />
43-
)}
32+
<img
33+
src={profilePic || '/profilepic.webp'}
34+
alt="profile"
35+
onError={e => {
36+
e.currentTarget.onerror = null;
37+
e.currentTarget.src = '/profilepic.webp';
38+
}}
39+
className="rounded-circle ms-5"
40+
style={{ width: '30px', height: '30px' }}
41+
/>
42+
4443
<SiGmail
4544
size={30}
4645
color="red"
47-
className=""
48-
style={{ cursor: 'pointer' }}
46+
style={{ cursor: 'pointer', display: 'block' }}
4947
onClick={() => handleEmailClick(email)}
5048
/>
51-
<p className="m-0 align-self-center">{`${firstName} ${lastName}`}</p>
49+
50+
<p
51+
className="m-0 align-self-center"
52+
style={{ color: darkMode ? '#fff' : '#000' }}
53+
>{`${firstName} ${lastName}`}</p>
5254
<img
5355
src={anniversaryMonths === 6 ? sixMonthsAward : oneYearAward}
5456
alt="six months award"
@@ -81,13 +83,13 @@ export default function AnniversaryCelebrated({ isLoading, data }) {
8183
}}
8284
>
8385
<p style={{ display: 'flex', gap: '5px', marginBottom: '5px' }}>
84-
<span style={{ color: 'gray' }}>6 months: </span>
86+
<span style={{ color: darkMode ? '#fff' : 'gray' }}>6 months: </span>
8587
<span className={`text-center ${is6MonthsPositive ? 'text-success' : 'text-danger'}`}>
8688
{`${is6MonthsPositive ? '+' : ''}${sixMonthsPercent}%`}
8789
</span>
8890
</p>
8991
<p style={{ display: 'flex', gap: '5px' }}>
90-
<span style={{ color: 'gray' }}>1 year: </span>
92+
<span style={{ color: darkMode ? '#fff' : 'gray' }}>1 year: </span>
9193
<span className={`text-center ${isOneYearPositive ? 'text-success' : 'text-danger'}`}>
9294
{`${isOneYearPositive ? '+' : ''}${oneYearPercent}%`}
9395
</span>

0 commit comments

Comments
 (0)