Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Frontend/src/components/charts/ContributorImpactChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export const ContributorImpactChart = ({ data }) => {
<XAxis
type="number"
dataKey="timeContributing"
name="Commits"
tick={{ fill: "#6B7280", fontSize: 12 }}
label={{
value: "Time Contributing",
name="Time Contributing"
tick={{ fill: "#6B7280", fontSize: 12 }}
label={{
Expand Down
73 changes: 43 additions & 30 deletions Frontend/src/components/charts/PRMergeSuccessRateChart.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { useState } from "react";

import {
BarChart,
Bar,
XAxis,
YAxis,
Tooltip,
Legend,
ResponsiveContainer
ResponsiveContainer,
} from "recharts";

import { getPRMergeRates } from "../../utils/prMergeRateHelper";

const PRMergeSuccessRateChart = ({ selectedTeam }) => {
const data = getPRMergeRates(selectedTeam);

const [tooltipVisible, setTooltipVisible] = useState(false);

return (
<div>
<h3>
Expand All @@ -21,42 +25,39 @@ const PRMergeSuccessRateChart = ({ selectedTeam }) => {
style={{
position: "relative",
display: "inline-block",
marginLeft: "6px"
marginLeft: "6px",
}}
>
<span
tabIndex="0"
aria-label="PR Merge Success Rate info"
style={{
cursor: "pointer",
border: "1px solid black",
borderRadius: "50%",
padding: "2px 6px",
style={{
cursor: "pointer",
border: "1px solid black",
borderRadius: "50%",
padding: "2px 6px",
fontSize: "12px",
display: "inline-block"
display: "inline-block",
}}
onMouseEnter={(e) => {
const tooltip = e.currentTarget.nextElementSibling;
if (tooltip) {
tooltip.style.visibility = "visible";
tooltip.style.opacity = "1";
}
}}
onMouseLeave={(e) => {
const tooltip = e.currentTarget.nextElementSibling;
if (tooltip) {
tooltip.style.visibility = "hidden";
tooltip.style.opacity = "0";
}
}}
>
onMouseEnter={() => setTooltipVisible(true)}
onMouseLeave={() => setTooltipVisible(false)}
// Changed by adding onFocus/onBlur so keyboard users (Tab key) can also
// trigger the tooltip
onFocus={() => setTooltipVisible(true)}
onBlur={() => setTooltipVisible(false)}
onClick={() => setTooltipVisible((v) => !v)}
>
i
</span>

<span
style={{
visibility: "hidden",
opacity: 0,
// Position: default below-and-centered. On narrow viewports the
// parent flex container should be `overflow: visible`; for a
// production app replace with Floating UI for true boundary checks.
// Changed visibility, now driven by tooltipVisible
visibility: tooltipVisible ? "visible" : "hidden",
opacity: tooltipVisible ? 1 : 0,
transition: "opacity 0.2s ease",
position: "absolute",
top: "28px",
Expand All @@ -70,13 +71,19 @@ const PRMergeSuccessRateChart = ({ selectedTeam }) => {
fontWeight: "400",
lineHeight: "1.4",
width: "260px",
// Added maxWidth to prevent clipping on narrow screens.
maxWidth: "min(260px, 90vw)",
zIndex: 1000,
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
textAlign: "left",
border: "1px solid #e5e7eb"
border: "1px solid #e5e7eb",
// Prevent the tooltip itself from receiving mouse events so
pointerEvents: "none",
}}
>
This chart compares each contributor’s lifetime PR merge success rate with their recent sprint performance. It helps show both long-term consistency and current activity.
This chart compares each contributor’s lifetime PR merge success
rate with their recent sprint performance. It helps show both
long-term consistency and current activity.
</span>
</span>
</h3>
Expand All @@ -85,16 +92,22 @@ const PRMergeSuccessRateChart = ({ selectedTeam }) => {
<ResponsiveContainer>
<BarChart data={data} barGap={10}>
<XAxis dataKey="contributor" />
<YAxis tickFormatter={(value) => `${value * 100}%`} />
{/* Changed by adding .toFixed(0) to match the Tooltip formatter below.
Without it, fractional values like 0.3333 render as "33.3333333%"
on the Y-axis ticks, while the hover tooltip correctly shows "33%". */}
<YAxis tickFormatter={(value) => `${(value * 100).toFixed(0)}%`} />
<Tooltip formatter={(value) => `${(value * 100).toFixed(0)}%`} />
<Legend />
{/* Changed Sprint bar color changed from #22C55E (green) to #F59E0B
(amber). The original green is hard to distinguish from the indigo
(#4F46E5)*/}
<Bar dataKey="lifetimeRate" name="Lifetime" fill="#4F46E5" />
<Bar dataKey="sprintRate" name="Sprint" fill="#22C55E" />
<Bar dataKey="sprintRate" name="Sprint" fill="#F59E0B" />
</BarChart>
</ResponsiveContainer>
</div>
</div>
);
};

export default PRMergeSuccessRateChart;
export default PRMergeSuccessRateChart;
2 changes: 1 addition & 1 deletion Frontend/src/utils/transformContributorData.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ const initUser = (name) => ({
issuesClosed: 0,
prsOpened: 0,
timeContributing: 0,
});
});
Loading