Skip to content

Commit a92cffa

Browse files
Merge pull request #4346 from OneCommunityGlobal/VIBGYOR_Colors_Pr_Review_Team_Dashboard
Ramsundar - Fix Default-check PR promotion checkboxes and add VIBGYOR colors
2 parents 6411f91 + ce06deb commit a92cffa

3 files changed

Lines changed: 48 additions & 21 deletions

File tree

src/components/PRPromotions/DisplayBox.jsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import './DisplayBox.css';
2+
import styles from './DisplayBox.module.css';
33

44
export default function DisplayBox({ onClose }) {
55
const mockPromotionData = [
@@ -13,6 +13,8 @@ export default function DisplayBox({ onClose }) {
1313
{ week: '2024-06-15', prCount: 10 },
1414
{ week: '2024-06-22', prCount: 18 },
1515
{ week: '2024-06-29', prCount: 14 },
16+
{ week: '2024-07-06', prCount: 16 },
17+
{ week: '2024-07-13', prCount: 20 },
1618
],
1719
},
1820
{
@@ -29,7 +31,7 @@ export default function DisplayBox({ onClose }) {
2931
},
3032
];
3133

32-
const [checkedItems, setCheckedItems] = useState(Array(mockPromotionData.length).fill(false));
34+
const [checkedItems, setCheckedItems] = useState(new Array(mockPromotionData.length).fill(true));
3335
const allChecked = checkedItems.every(Boolean);
3436

3537
const handleCheckedBoxChange = index => {
@@ -39,14 +41,16 @@ export default function DisplayBox({ onClose }) {
3941
};
4042

4143
const handleSelectAll = () => {
42-
setCheckedItems(Array(mockPromotionData.length).fill(!allChecked));
44+
setCheckedItems(new Array(mockPromotionData.length).fill(!allChecked));
4345
};
4446

4547
return (
46-
<div className="overlay">
47-
<div className="popup">
48-
<h2 className="popup-heading">Are you sure you want to promote these PR reviewers?</h2>
49-
<table className="popup-table">
48+
<div className={styles.overlay}>
49+
<div className={styles.popup}>
50+
<h2 className={styles['popup-heading']}>
51+
Are you sure you want to promote these PR reviewers?
52+
</h2>
53+
<table className={styles['popup-table']}>
5054
<thead>
5155
<tr>
5256
<th>
@@ -78,10 +82,10 @@ export default function DisplayBox({ onClose }) {
7882
<td>{promotion.teamCode}</td>
7983
<td>{promotion.teamReviewerName}</td>
8084
<td>
81-
{promotion.weeklyPRs.map(pr => (
85+
{promotion.weeklyPRs.map((pr, prIndex) => (
8286
<span
8387
key={`${promotion.prReviewer}-${pr.week}`}
84-
className={`pr-count-badge color-${pr.week}`}
88+
className={`${styles['pr-count-badge']} ${styles[`color-${prIndex}`]}`}
8589
>
8690
{pr.prCount}
8791
</span>
@@ -91,11 +95,11 @@ export default function DisplayBox({ onClose }) {
9195
))}
9296
</tbody>
9397
</table>
94-
<div className="button-row">
95-
<button type="button" className="button" onClick={onClose}>
98+
<div className={styles['button-row']}>
99+
<button type="button" className={styles.button} onClick={onClose}>
96100
Cancel
97101
</button>
98-
<button type="button" className="button" disabled={!checkedItems.some(Boolean)}>
102+
<button type="button" className={styles.button} disabled={!checkedItems.some(Boolean)}>
99103
Confirm
100104
</button>
101105
</div>

src/components/PRPromotions/DisplayBox.css renamed to src/components/PRPromotions/DisplayBox.module.css

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
max-width: 800px;
1616
width: 100%;
1717
border: 6px solid black;
18-
border-radius: 8px;
1918
}
2019

2120
.popup-heading {
2221
text-align: center;
2322
font-size: 20px;
24-
/* font-weight: bold; */
2523
margin-bottom: 16px;
2624
color: black;
2725
}
@@ -58,6 +56,21 @@
5856
color: #000;
5957
}
6058

59+
.promoteButton {
60+
padding: 8px 16px;
61+
border-radius: 4px;
62+
border: none;
63+
cursor: pointer;
64+
background-color: #f0f0f0;
65+
color: black;
66+
font-weight: bold;
67+
}
68+
69+
.button-row .button:last-child:not(:disabled):hover {
70+
background-color: #2563eb;
71+
color: white;
72+
}
73+
6174
.button:disabled {
6275
background-color: #ccc;
6376
cursor: not-allowed;
@@ -82,20 +95,30 @@
8295
}
8396

8497
.color-0 {
85-
background-color: rgb(154, 93, 181);
98+
background-color: #9400D3;
8699
}
100+
87101
.color-1 {
88-
background-color: rgb(77, 82, 174);
102+
background-color: #4B0082;
89103
}
90104

91105
.color-2 {
92-
background-color: rgb(87, 150, 198);
106+
background-color: #0000FF;
93107
}
94108

95109
.color-3 {
96-
background-color: rgb(95, 191, 95);
110+
background-color: #00FF00;
97111
}
98112

99113
.color-4 {
100-
background-color: #cbe360;
114+
background-color: #FFFF00;
101115
}
116+
117+
.color-5 {
118+
background-color: #FF7F00;
119+
}
120+
121+
.color-6 {
122+
background-color: #FF0000;
123+
}
124+

src/components/PRPromotions/PRPromotionsPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from 'react';
22
import DisplayBox from './DisplayBox';
3-
import './DisplayBox.css';
3+
import styles from './DisplayBox.module.css';
44

55
export default function PromotionsPage() {
66
const [showModal, setShowModal] = useState(false);
@@ -16,7 +16,7 @@ export default function PromotionsPage() {
1616
return (
1717
<div>
1818
<h1>Promotions Page</h1>
19-
<button type="button" className="button" onClick={handleOpenModal}>
19+
<button type="button" className={styles.promoteButton} onClick={handleOpenModal}>
2020
Promote ?
2121
</button>
2222
{showModal && <DisplayBox onClose={handleCloseModal} />}

0 commit comments

Comments
 (0)