Skip to content

Commit cc10b64

Browse files
Merge pull request #4951 from OneCommunityGlobal/Sayali_PR_Grading_Task_38_DarkMode_ReviewerName
Sayali: dark mode visibility for reviewer name in PR grading dashboard
2 parents 1e04ff9 + d39ac6c commit cc10b64

4 files changed

Lines changed: 64 additions & 16 deletions

File tree

src/components/PRGradingDashboard/GradingTable.jsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import PropTypes from 'prop-types';
12
import React from 'react';
2-
import ReviewerRow from './ReviewerRow';
33
import AddPRModal from './AddPRModal';
44
import styles from './GradingTable.module.css';
5+
import ReviewerRow from './ReviewerRow';
56

67
function GradingTable({
78
gradings,
89
onUpdatePRsReviewed,
910
onAddPRClick,
1011
openAddModal,
1112
onAddGradedPR,
13+
darkMode,
1214
}) {
1315
return (
1416
// <div className={styles.tableWrapper}>
@@ -28,6 +30,7 @@ function GradingTable({
2830
grading={grading}
2931
onUpdatePRsReviewed={onUpdatePRsReviewed}
3032
onAddPRClick={onAddPRClick}
33+
darkMode={darkMode}
3134
/>
3235
{openAddModal === grading.reviewer && (
3336
<tr className={styles.modalRow}>
@@ -47,5 +50,24 @@ function GradingTable({
4750
// </div>
4851
);
4952
}
53+
GradingTable.propTypes = {
54+
gradings: PropTypes.arrayOf(
55+
PropTypes.shape({
56+
reviewer: PropTypes.string.isRequired,
57+
prsReviewed: PropTypes.number.isRequired,
58+
prsNeeded: PropTypes.number.isRequired,
59+
}),
60+
).isRequired,
61+
onUpdatePRsReviewed: PropTypes.func.isRequired,
62+
onAddPRClick: PropTypes.func.isRequired,
63+
openAddModal: PropTypes.string,
64+
onAddGradedPR: PropTypes.func.isRequired,
65+
darkMode: PropTypes.bool,
66+
};
67+
68+
GradingTable.defaultProps = {
69+
openAddModal: null,
70+
darkMode: false,
71+
};
5072

5173
export default GradingTable;

src/components/PRGradingDashboard/PRGradingDashboard.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import React, { useState, useEffect } from 'react';
21
import axios from 'axios';
2+
import { useEffect, useState } from 'react';
3+
import { useSelector } from 'react-redux';
34
import { toast } from 'react-toastify';
4-
import GradingTable from './GradingTable';
5-
import SummaryList from './SummaryList';
6-
import ConfirmationModal from './ConfirmationModal';
75
import AddReviewerModal from './AddReviewerModal';
6+
import ConfirmationModal from './ConfirmationModal';
7+
import GradingTable from './GradingTable';
88
import styles from './PRGradingDashboard.module.css';
99
import { SelectionProvider } from './SelectionContext';
10+
import SummaryList from './SummaryList';
1011

1112
const TEAM_CODE = 'TeamA';
1213
const TEAM_NAME = 'Team Alpha';
@@ -34,6 +35,7 @@ const mockData = [
3435
];
3536

3637
function PRGradingDashboard() {
38+
const darkMode = useSelector(state => state.theme.darkMode);
3739
const [gradings, setGradings] = useState([]);
3840
const [loading, setLoading] = useState(true);
3941
const [saving, setSaving] = useState(false);
@@ -267,6 +269,7 @@ function PRGradingDashboard() {
267269
onAddPRClick={setOpenAddModal}
268270
openAddModal={openAddModal}
269271
onAddGradedPR={requestAddGradedPR}
272+
darkMode={darkMode}
270273
/>
271274
</div>
272275

src/components/PRGradingDashboard/ReviewerRow.jsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react';
21
import { Plus } from 'lucide-react';
2+
import PropTypes from 'prop-types';
33
import styles from './ReviewerRow.module.css';
44
import { useRowSelection } from './SelectionContext';
55

6-
function ReviewerRow({ grading, onUpdatePRsReviewed, onAddPRClick }) {
6+
function ReviewerRow({ grading, onUpdatePRsReviewed, onAddPRClick, darkMode }) {
77
const { activeId, selectRow } = useRowSelection();
88

99
const handlePRsReviewedChange = e => {
@@ -24,7 +24,11 @@ function ReviewerRow({ grading, onUpdatePRsReviewed, onAddPRClick }) {
2424
return (
2525
<tr className={styles.row}>
2626
<td className={styles.cell}>
27-
<button className={styles.reviewerName} onClick={() => selectRow(grading.reviewer)}>
27+
<button
28+
className={styles.reviewerName}
29+
onClick={() => selectRow(grading.reviewer)}
30+
style={darkMode ? { color: '#f9fafb' } : {}}
31+
>
2832
{grading.reviewer}
2933
</button>
3034
</td>
@@ -36,6 +40,9 @@ function ReviewerRow({ grading, onUpdatePRsReviewed, onAddPRClick }) {
3640
onChange={handlePRsReviewedChange}
3741
onBlur={handleBlur}
3842
className={styles.prsReviewedInput}
43+
style={
44+
darkMode ? { backgroundColor: '#374151', color: '#f9fafb', borderColor: '#4b5563' } : {}
45+
}
3946
/>
4047
</td>
4148
<td className={styles.cell}>
@@ -54,5 +61,19 @@ function ReviewerRow({ grading, onUpdatePRsReviewed, onAddPRClick }) {
5461
</tr>
5562
);
5663
}
64+
ReviewerRow.propTypes = {
65+
grading: PropTypes.shape({
66+
reviewer: PropTypes.string.isRequired,
67+
prsReviewed: PropTypes.number.isRequired,
68+
prsNeeded: PropTypes.number.isRequired,
69+
}).isRequired,
70+
onUpdatePRsReviewed: PropTypes.func.isRequired,
71+
onAddPRClick: PropTypes.func.isRequired,
72+
darkMode: PropTypes.bool,
73+
};
74+
75+
ReviewerRow.defaultProps = {
76+
darkMode: false,
77+
};
5778

5879
export default ReviewerRow;

src/components/PRGradingDashboard/ReviewerRow.module.css

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
font-weight: 500;
1717
color: #111827;
1818
cursor: pointer;
19+
background: none;
20+
border: none;
21+
padding: 0;
1922
}
2023

2124
.prsReviewedInput {
@@ -30,7 +33,7 @@
3033
.prsReviewedInput:focus {
3134
outline: none;
3235
border-color: #2563eb;
33-
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
36+
box-shadow: 0 0 0 2px rgb(37 99 235 / 50%);
3437
}
3538

3639
.prsNeeded {
@@ -50,17 +53,17 @@
5053
border: none;
5154
cursor: pointer;
5255
transition: all 0.2s;
53-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
56+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
5457
}
5558

5659
.addButton:hover {
5760
background-color: #1d4ed8;
58-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
61+
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 10%);
5962
}
6063

6164
.addButton:focus {
6265
outline: none;
63-
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5), 0 0 0 4px rgba(37, 99, 235, 0.1);
66+
box-shadow: 0 0 0 2px rgb(37 99 235 / 50%), 0 0 0 4px rgb(37 99 235 / 10%);
6467
}
6568

6669
.addButtonIcon {
@@ -90,7 +93,7 @@
9093

9194
:global(.dark-mode) .prsReviewedInput:focus {
9295
border-color: #3b82f6;
93-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
96+
box-shadow: 0 0 0 2px rgb(59 130 246 / 50%);
9497
}
9598

9699
:global(.dark-mode) .addButton {
@@ -103,6 +106,5 @@
103106
}
104107

105108
:global(.dark-mode) .addButton:focus {
106-
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5), 0 0 0 4px rgba(37, 99, 235, 0.1);
107-
}
108-
109+
box-shadow: 0 0 0 2px rgb(37 99 235 / 50%), 0 0 0 4px rgb(37 99 235 / 10%);
110+
}

0 commit comments

Comments
 (0)