Skip to content

Commit 84e8526

Browse files
Merge pull request #4979 from OneCommunityGlobal/Diya_Fix_Dashboard_UI
Diya fix(dashboard): 🔥 Dashboard + Leaderboard UI
2 parents 565d0ae + 9b08ab4 commit 84e8526

9 files changed

Lines changed: 82 additions & 61 deletions

File tree

src/components/LeaderBoard/Leaderboard.jsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,22 @@ function LeaderBoard({
176176

177177
useEffect(() => {
178178
const checkAbbreviatedView = () => {
179-
const isAbbrev = window.innerWidth < window.screen.width * 0.75;
179+
const isAbbrev = window.innerWidth < 1500;
180180
setIsAbbreviatedView(isAbbrev);
181181
};
182182

183-
checkAbbreviatedView(); // run on mount
184-
window.addEventListener('resize', checkAbbreviatedView);
183+
let timer;
184+
const debouncedCheck = () => {
185+
clearTimeout(timer);
186+
timer = setTimeout(checkAbbreviatedView, 200); // increase to 200ms
187+
};
185188

186-
return () => window.removeEventListener('resize', checkAbbreviatedView);
189+
checkAbbreviatedView();
190+
window.addEventListener('resize', debouncedCheck);
191+
return () => {
192+
window.removeEventListener('resize', debouncedCheck);
193+
clearTimeout(timer);
194+
};
187195
}, []);
188196

189197
const updateOrganizationData = (usersTaks, contUsers) => {
@@ -691,7 +699,7 @@ function LeaderBoard({
691699
className={`leaderboard table-fixed ${
692700
darkMode ? 'text-light dark-mode bg-yinmn-blue' : ''
693701
} ${isAbbreviatedView ? 'abbreviated-mode' : ''}`}
694-
style={{ minWidth: '500px' }}
702+
style={{ width: '100%', tableLayout: isAbbreviatedView ? 'fixed' : 'auto' }}
695703
>
696704
<thead className="responsive-font-size">
697705
<tr className={darkMode ? 'bg-space-cadet' : ''} style={darkModeStyle}>
@@ -701,12 +709,18 @@ function LeaderBoard({
701709
<th style={darkModeStyle}>
702710
<div className="d-flex align-items-center">
703711
<span className="mr-2">{isAbbreviatedView ? 'Name' : 'Name'}</span>
704-
<span style={{ position: 'relative', top: '2px' }}>
712+
<span
713+
style={{
714+
position: 'relative',
715+
top: isAbbreviatedView ? '-13px' : '2px',
716+
left: isAbbreviatedView ? '10px' : '0px',
717+
}}
718+
>
705719
<EditableInfoModal
706720
areaName="Leaderboard"
707721
areaTitle="Team Members Navigation"
708722
role={loggedInUser.role}
709-
fontSize={18}
723+
fontSize={isAbbreviatedView ? 13 : 18}
710724
isPermissionPage
711725
darkMode={darkMode}
712726
className="p-2"
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
.leaderboard {
22
font-size: 1rem;
3-
} /*1rem = 16px*/
3+
}
44

55
.my-custom-scrollbar {
66
overflow-y: auto;
77
margin-bottom: 1rem;
88
}
99

10-
.leaderboard thead th {
11-
top: 0;
12-
border-top: 10px solid #dee2e6;
13-
border-top-width: 1px;
14-
border-top-style: solid;
15-
border-top-color: rgb(222, 226, 230);
16-
}
17-
18-
.leaderboard tbody tr td,
19-
.leaderboard thead tr th {
20-
text-align: left !important;
21-
}
22-
2310
.dark-leaderboard-row {
2411
background-color: #3a506b;
2512
color: white;
@@ -29,6 +16,7 @@
2916
background-color: #3a506b;
3017
color: white;
3118
}
19+
3220
.dark-leaderboard-row:hover {
3321
background-color: #111831;
3422
}
@@ -38,6 +26,7 @@
3826
color: black;
3927
display: table-row;
4028
}
29+
4130
.light-leaderboard-row th {
4231
background-color: white;
4332
color: black;
@@ -47,52 +36,63 @@
4736
background-color: #f0f8ff;
4837
}
4938

39+
.table-fixed tbody td {
40+
white-space: normal; /* Allow text wrapping within cells */
41+
}
42+
43+
.table-fixed {
44+
font-size: 0.93rem;
45+
overflow-wrap: break-word;
46+
}
47+
48+
.leaderboard thead th {
49+
top: 0;
50+
border-top: 1px solid rgb(222 226 230);
51+
}
52+
53+
.leaderboard tbody tr td,
54+
.leaderboard thead tr th {
55+
text-align: left !important;
56+
}
57+
5058

5159
/* Small devices (landscape phones, 544px and up) */
52-
@media (max-width: 544px) {
60+
@media (545px <= width <= 1119px) {
5361
.leaderboard {
5462
font-size: 0.7rem;
55-
} /*1rem = 16px*/
63+
}
5664

5765
.my-custom-scrollbar {
5866
max-height: 500px;
59-
overflow: scroll;
67+
overflow: auto;
6068
margin-bottom: 1rem;
6169
}
6270

6371
.leaderboard thead th {
72+
white-space: nowrap;
6473
top: 0;
65-
border-top: 10px solid #dee2e6;
66-
border-top-width: 1px;
67-
border-top-style: solid;
68-
border-top-color: rgb(222, 226, 230);
74+
border-top: 1px solid rgb(222 226 230);
6975
}
7076
}
77+
7178
.row {
7279
width: 97%;
7380
}
7481

75-
.table-fixed tbody td {
76-
white-space: normal; /* Allow text wrapping within cells */
77-
}
78-
79-
.table-fixed {
80-
font-size: 0.93rem;
81-
word-break: break-word;
82-
}
83-
84-
.animation {
85-
animation: l-animation 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
86-
}
8782
@keyframes l-animation {
8883
0% {
8984
transform: rotate(0deg);
9085
}
86+
9187
100% {
9288
transform: rotate(360deg);
9389
}
9490
}
9591

92+
.animation {
93+
animation: l-animation 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
94+
}
95+
9696
.leaderboardTotalsTitle {
9797
color: #339cff;
9898
font-weight: bold;
@@ -103,13 +103,12 @@
103103
flex-direction: column;
104104
}
105105

106-
@media screen and (max-width: 544px) {
106+
@media (width <= 980px) {
107107
.responsive-font-size {
108-
font-size: 0.75rem !important;
108+
font-size: 0.5rem !important;
109109
}
110110
}
111111

112-
113112
.leaderboard.abbreviated-mode thead th {
114113
font-size: 0.75rem;
115114
white-space: nowrap;
@@ -120,6 +119,7 @@
120119
padding: 0.5rem 0.3rem;
121120
vertical-align: middle;
122121
}
122+
123123
.trophyTextWhite {
124124
color: #fff;
125125
}

src/components/LeaderBoard/__tests__/Leaderboard.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('Leaderboard page structure', () => {
139139

140140
it('displays correct Total Time label and value', () => {
141141
renderWithProvider(<Leaderboard {...props} />);
142-
const header = screen.getByText('Total Time');
142+
const header = screen.getByRole('columnheader', { name: /Tot(al|\.) Time/i });
143143
expect(header).toBeInTheDocument();
144144

145145
const timeValue = screen.getByTitle('Tangible + Intangible time = Total time');

src/components/TeamMemberTasks/ReviewButton.jsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,6 @@ function ReviewButton({ user, task, updateTask }) {
451451
const buttonFormat = () => {
452452
if (user.personId === myUserId && reviewStatus === 'Unsubmitted') {
453453
return (
454-
// <Button
455-
// className={style['reviewBtn']}
456-
// color="primary"
457-
// onClick={toggleModal}
458-
// style={darkMode ? boxStyleDark : boxStyle}
459-
// disabled={isSubmitting}
460-
// >
461-
// Submit for Review
462-
// </Button>
463454
<button
464455
className={`${style.reviewBtn} btn btn-primary`}
465456
onClick={toggleModal}

src/components/TeamMemberTasks/TeamMemberTask.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ const TeamMemberTask = React.memo(
314314
style={{
315315
fontSize: 24,
316316
cursor: 'pointer',
317-
marginLeft: 6,
318317
color: darkMode ? 'lightgray' : 'black',
319318
}}
320319
title="Click to see user's timelog"
@@ -325,7 +324,6 @@ const TeamMemberTask = React.memo(
325324
fontSize: 16,
326325
cursor: 'pointer',
327326
color: darkMode ? 'lightgray' : 'black',
328-
marginLeft: 6,
329327
paddingTop: 15,
330328
}}
331329
title="Number of weeks this person has completed, based on the total weekly summaries they’ve submitted."
@@ -336,7 +334,11 @@ const TeamMemberTask = React.memo(
336334
{user.role !== 'Volunteer' && (
337335
<div
338336
className="user-role"
339-
style={{ fontSize: '14px', color: darkMode ? 'lightgray' : 'gray' }}
337+
style={{
338+
fontSize: '14px',
339+
color: darkMode ? 'lightgray' : 'gray',
340+
textAlign: 'center',
341+
}}
340342
>
341343
{user.role}
342344
</div>
@@ -499,6 +501,12 @@ const TeamMemberTask = React.memo(
499501
</td>
500502
<td
501503
data-label="Time"
504+
style={{
505+
textAlign: 'center',
506+
verticalAlign: 'middle',
507+
width: '50%',
508+
whiteSpace: 'nowrap',
509+
}}
502510
className={`${styles['team-clocks']} ${darkMode ? 'text-light' : ''}`}
503511
>
504512
<u className={darkMode ? styles['dashboard-team-clocks'] : ''}>

src/components/TeamMemberTasks/reviewButton.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
flex: 0 0 auto;
1313
z-index: 1000;
1414
position: relative;
15+
font-size: 12px;
1516

16-
--bs-btn-font-size: 12px;
1717
--bs-btn-padding-y: 8px;
1818
--bs-btn-padding-x: 8px;
1919

@@ -34,7 +34,7 @@
3434
display: inline-flex;
3535
align-items: center;
3636
margin-top: 6px;
37-
font-size: 14px !important;
37+
font-size: 12px;
3838
font-weight: 500;
3939
line-height: 20px;
4040
padding: 6px 14px !important;

src/components/TeamMemberTasks/style.module.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
display: flex;
115115
align-items: center;
116116
justify-content: center;
117-
gap: 4px;
117+
gap: 10px;
118118
}
119119

120120
.team-member-tasks .team-member-tasks-headers {
@@ -247,7 +247,13 @@
247247

248248
.team-clocks {
249249
display: flex;
250-
justify-content: space-around;
250+
justify-content: center;
251+
align-items: center;
252+
text-align: center;
253+
vertical-align: middle !important;
254+
gap: 4px;
255+
width: 50%;
256+
white-space: nowrap;
251257
}
252258

253259
.team-member-tasks-number {

src/components/common/Clipboard/CopyToClipboard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const CopyToClipboard = ({ writeText, message }) => {
1919
icon={faCopy}
2020
onClick={handleCopyToClipboard}
2121
color={darkMode ? 'lightgrey' : ''}
22-
size="lg"
22+
style={{ fontSize: '16px' }}
2323
/>
2424
);
2525
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.copyToClipboard {
22
cursor: pointer;
33
margin-right: 10px;
4+
font-size: 16px; /* pin it so it never inherits from parent */
5+
flex-shrink: 0; /* prevents it from squishing in flex containers */
46
}

0 commit comments

Comments
 (0)