Skip to content

Commit a715a63

Browse files
Merge pull request #3838 from OneCommunityGlobal/dharmik/forntend/pr_review_team_analytics_dashboard_create_routes
Dharmik/forntend/pr review team analytics dashboard create routes
2 parents 4266e6c + 537e25d commit a715a63

11 files changed

Lines changed: 985 additions & 865 deletions

File tree

package-lock.json

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Auth/PermissionWatcher.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getUserProfile } from '../../actions/userProfile';
99

1010
function PermissionWatcher() {
1111
const dispatch = useDispatch();
12-
const { isAuthenticated, forceLogoutAt } = useSelector(state => state.auth);
12+
const { isAuthenticated, forceLogoutAt } = useSelector(state => state.auth || {});
1313
const userProfile = useSelector(state => state.userProfile);
1414
const isAcknowledged = userProfile?.permissions?.isAcknowledged !== false;
1515
const [isAckLoading, setIsAckLoading] = useState(false);

src/components/BMDashboard/LessonsLearnt/LessonsLearntChart.jsx

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function ChartTitle({ title }) {
5353
return <h2 className={styles.chartTitle}>{title}</h2>;
5454
}
5555

56-
export default function LessonsLearntChart() {
56+
const LessonsLearntChart = () => {
5757
const [selectedProjects, setSelectedProjects] = useState([]);
5858
const [startDate, setStartDate] = useState(null);
5959
const [endDate, setEndDate] = useState(null);
@@ -116,19 +116,34 @@ export default function LessonsLearntChart() {
116116
</div>
117117

118118
<div className={styles.chartWrapper}>
119-
{isLoading ? <p>Loading...</p> : <Bar data={chartData} options={chartOptions} />}
120-
<div className={styles.percentageLabels}>
121-
{lessonsData.map((d, idx) => (
122-
<span
123-
key={idx}
124-
className={styles.percentageLabel}
125-
style={{ left: `${(idx + 0.5) * (100 / lessonsData.length)}%` }}
126-
>
127-
{d.percentage}%
128-
</span>
129-
))}
130-
</div>
119+
{isLoading ? (
120+
<p>Loading...</p>
121+
) : lessonsData.length === 0 ? (
122+
<p>No lessons data available for the selected criteria</p>
123+
) : (
124+
<>
125+
<Bar data={chartData} options={chartOptions} />
126+
<div className={styles.percentageLabels}>
127+
{lessonsData.map((d, idx) => (
128+
<span
129+
key={idx}
130+
className={styles.percentageLabel}
131+
style={{
132+
left:
133+
lessonsData.length > 0
134+
? `${(idx + 0.5) * (100 / lessonsData.length)}%`
135+
: '0%',
136+
}}
137+
>
138+
{d.percentage}%
139+
</span>
140+
))}
141+
</div>
142+
</>
143+
)}
131144
</div>
132145
</div>
133146
);
134-
}
147+
};
148+
149+
export default LessonsLearntChart;
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { useParams } from 'react-router-dom';
2+
import { Container, Row, Col, Card, CardBody, Badge } from 'reactstrap';
3+
4+
function PRDashboardDetails() {
5+
const { prId } = useParams();
6+
7+
return (
8+
<Container fluid>
9+
<Row>
10+
<Col xs="12">
11+
<h1>PR Details - PR {prId}</h1>
12+
<p>Detailed PR view (comments, CI/CD status)</p>
13+
</Col>
14+
</Row>
15+
<Row>
16+
<Col md="8">
17+
<Card>
18+
<CardBody>
19+
<h4>Description</h4>
20+
<p>
21+
This is a detailed view of PR {prId}. Here you would see the full description,
22+
commits, and changes.
23+
</p>
24+
25+
<h5>CI/CD Status</h5>
26+
<ul>
27+
<li>
28+
Build: <Badge color="success">Passed</Badge>
29+
</li>
30+
<li>
31+
Tests: <Badge color="success">Passed</Badge>
32+
</li>
33+
<li>
34+
Lint: <Badge color="warning">Warning</Badge>
35+
</li>
36+
<li>
37+
Security: <Badge color="danger">Failed</Badge>
38+
</li>
39+
</ul>
40+
41+
<h5>Comments</h5>
42+
<div className="border p-3 mb-2">
43+
<strong>John Developer:</strong> Initial implementation completed
44+
</div>
45+
<div className="border p-3 mb-2">
46+
<strong>Alice Reviewer:</strong> Looks good, just need to fix the linting issues
47+
</div>
48+
</CardBody>
49+
</Card>
50+
</Col>
51+
<Col md="4">
52+
<Card>
53+
<CardBody>
54+
<h4>PR Info</h4>
55+
<p>
56+
<strong>Author:</strong> John Developer
57+
</p>
58+
<p>
59+
<strong>Status:</strong> <Badge color="info">Open</Badge>
60+
</p>
61+
<p>
62+
<strong>Reviews:</strong> 17
63+
</p>
64+
<p>
65+
<strong>Commits:</strong> 3
66+
</p>
67+
<p>
68+
<strong>Files Changed:</strong> 5
69+
</p>
70+
</CardBody>
71+
</Card>
72+
</Col>
73+
</Row>
74+
</Container>
75+
);
76+
}
77+
78+
export default PRDashboardDetails;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Container, Row, Col, Card, CardBody } from 'reactstrap';
2+
3+
function PRDashboardOverview() {
4+
return (
5+
<Container fluid>
6+
<Row>
7+
<Col xs="12">
8+
<h1>PR Dashboard Overview</h1>
9+
<p>Summary metrics (Open PRs, Stale PRs, Avg. Review Time)</p>
10+
</Col>
11+
</Row>
12+
<Row>
13+
<Col md="4">
14+
<Card>
15+
<CardBody>
16+
<h3>45</h3>
17+
<p>Open PRs</p>
18+
</CardBody>
19+
</Card>
20+
</Col>
21+
<Col md="4">
22+
<Card>
23+
<CardBody>
24+
<h3>12</h3>
25+
<p>Stale PRs</p>
26+
</CardBody>
27+
</Card>
28+
</Col>
29+
<Col md="4">
30+
<Card>
31+
<CardBody>
32+
<h3>2.3 days</h3>
33+
<p>Avg Review Time</p>
34+
</CardBody>
35+
</Card>
36+
</Col>
37+
</Row>
38+
</Container>
39+
);
40+
}
41+
42+
export default PRDashboardOverview;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Container, Row, Col, Table } from 'reactstrap';
2+
3+
function PRDashboardPromotionEligibility() {
4+
return (
5+
<Container fluid>
6+
<Row>
7+
<Col xs="12">
8+
<h1>Promotion Eligibility</h1>
9+
<p>Table of members with eligibility flags</p>
10+
</Col>
11+
</Row>
12+
<Row>
13+
<Col xs="12">
14+
<Table striped>
15+
<thead>
16+
<tr>
17+
<th>Reviewer</th>
18+
<th>Weekly Requirements</th>
19+
<th>Required PRs</th>
20+
<th>Total Reviews</th>
21+
<th>Status</th>
22+
</tr>
23+
</thead>
24+
<tbody>
25+
<tr>
26+
<td>Akshay - Jayaram</td>
27+
<td>10</td>
28+
<td>20</td>
29+
<td>0</td>
30+
<td>
31+
<span className="badge badge-success">Has Met</span>
32+
</td>
33+
</tr>
34+
<tr>
35+
<td>Jessica</td>
36+
<td>10</td>
37+
<td>7</td>
38+
<td>2</td>
39+
<td>
40+
<span className="badge badge-danger">Has not Met</span>
41+
</td>
42+
</tr>
43+
<tr>
44+
<td>SuniIkotte</td>
45+
<td>7</td>
46+
<td>7</td>
47+
<td>1</td>
48+
<td>
49+
<span className="badge badge-danger">Has not Met</span>
50+
</td>
51+
</tr>
52+
</tbody>
53+
</Table>
54+
</Col>
55+
</Row>
56+
</Container>
57+
);
58+
}
59+
60+
export default PRDashboardPromotionEligibility;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { Container, Row, Col, ListGroup, ListGroupItem } from 'reactstrap';
2+
3+
function PRDashboardTopReviewedPRs() {
4+
return (
5+
<Container fluid>
6+
<Row>
7+
<Col xs="12">
8+
<h1>Top Reviewed PRs</h1>
9+
<p>Sorted list of PRs by review activity</p>
10+
</Col>
11+
</Row>
12+
<Row>
13+
<Col xs="12">
14+
<ListGroup>
15+
<ListGroupItem className="d-flex justify-content-between align-items-center">
16+
<div>
17+
<strong>PR 104: Improve error handling</strong>
18+
<p className="mb-0 text-muted">Optimize performance and error handling</p>
19+
</div>
20+
<span className="badge badge-primary badge-pill">35 reviews</span>
21+
</ListGroupItem>
22+
<ListGroupItem className="d-flex justify-content-between align-items-center">
23+
<div>
24+
<strong>PR 108: Optimize performance</strong>
25+
<p className="mb-0 text-muted">Performance improvements across the app</p>
26+
</div>
27+
<span className="badge badge-primary badge-pill">40 reviews</span>
28+
</ListGroupItem>
29+
<ListGroupItem className="d-flex justify-content-between align-items-center">
30+
<div>
31+
<strong>PR 106: Fix styling issue</strong>
32+
<p className="mb-0 text-muted">CSS fixes and UI improvements</p>
33+
</div>
34+
<span className="badge badge-primary badge-pill">29 reviews</span>
35+
</ListGroupItem>
36+
<ListGroupItem className="d-flex justify-content-between align-items-center">
37+
<div>
38+
<strong>PR 110: Add new component</strong>
39+
<p className="mb-0 text-muted">New React component implementation</p>
40+
</div>
41+
<span className="badge badge-primary badge-pill">27 reviews</span>
42+
</ListGroupItem>
43+
</ListGroup>
44+
</Col>
45+
</Row>
46+
</Container>
47+
);
48+
}
49+
50+
export default PRDashboardTopReviewedPRs;

src/components/Header/Header.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ export function Header(props) {
519519
</DropdownItem>
520520
</>
521521
)}
522+
<DropdownItem divider />
523+
<DropdownItem tag={Link} to="/pr-dashboard/overview" className={fontColor}>
524+
PR Team Analytics
525+
</DropdownItem>
522526
</DropdownMenu>
523527
</UncontrolledDropdown>
524528
)}
@@ -591,6 +595,7 @@ export function Header(props) {
591595
onClickClose={() => setPopup(prevPopup => !prevPopup)}
592596
/>
593597
)}
598+
<PermissionWatcher props={props} />
594599
{props.auth.isAuthenticated && props.userProfile?.permissions?.isAcknowledged === false && (
595600
<PopUpBar
596601
firstName={viewingUser?.firstName || firstName}

src/components/PermissionsManagement/UserPermissionsPopUp.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function UserPermissionsPopUp({
4343

4444
const setToDefault = () => {
4545
setUserPermissions([]);
46+
setUserRemovedDefaultPermissions([]);
4647
};
4748

4849
useEffect(() => {

src/routes.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ import CPDashboard from './components/CommunityPortal';
120120
import ActivityList from './components/CommunityPortal/Activities/ActivityList';
121121
import Feedbackform from './components/CommunityPortal/Activities/Feedbackform';
122122
import FollowUpEmailTemplate from './components/CommunityPortal/Activities/FollowUpEmailTemplate';
123-
124123
// import AddActivities from './components/CommunityPortal/Activities/AddActivities';
125124
// import ActvityDetailPage from './components/CommunityPortal/Activities/ActivityDetailPage';
126125
import Register from './components/CommunityPortal/Activities/Register/Register';
@@ -148,6 +147,10 @@ import FeedbackModal from './components/HGNHelpSkillsDashboard/FeedbackModal';
148147
import ActivityAgenda from './components/CommunityPortal/Activities/ActivityAgenda';
149148
// HGN PR Dashboard
150149
import PRReviewTeamAnalytics from './components/HGNPRDashboard/PRReviewTeamAnalytics';
150+
import PRDashboardOverview from './components/HGNPRDashboard/PRDashboardOverview';
151+
import PRDashboardPromotionEligibility from './components/HGNPRDashboard/PRDashboardPromotionEligibility';
152+
import PRDashboardTopReviewedPRs from './components/HGNPRDashboard/PRDashboardTopReviewedPRs';
153+
import PRDashboardDetails from './components/HGNPRDashboard/PRDashboardDetails';
151154
import PromotionEligibility from './components/HGNPRDashboard/PromotionEligibility';
152155

153156
// eslint-disable-next-line import/order, import/no-unresolved

0 commit comments

Comments
 (0)