Skip to content

Commit 6b49316

Browse files
committed
Fix leaderboard tooltip and show repository streaks
1 parent b95df14 commit 6b49316

2 files changed

Lines changed: 73 additions & 24 deletions

File tree

Frontend/src/components/TopContributorsRepos.jsx

Lines changed: 72 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,84 @@ const TopContributorsRepos = () => {
2626
<h3>
2727
Top Contributors{" "}
2828
<span
29+
style={{
30+
position: "relative",
31+
display: "inline-block",
32+
marginLeft: "6px"
33+
}}
34+
>
35+
<span
2936
tabIndex="0"
3037
aria-label="Leaderboard streak info"
31-
title="A streak increases for every consecutive 7-day period where a user closes at least 3 issues. Streak resets if threshold is not met."
32-
style={{ cursor: "pointer", border: "1px solid black", borderRadius: "50%", padding: "2px 6px", fontSize: "12px" }}
38+
style={{
39+
cursor: "pointer",
40+
border: "1px solid black",
41+
borderRadius: "50%",
42+
padding: "2px 6px",
43+
fontSize: "12px",
44+
display: "inline-block"
45+
}}
46+
onMouseEnter={(e) => {
47+
const tooltip = e.currentTarget.nextElementSibling;
48+
if (tooltip) tooltip.style.visibility = "visible";
49+
if (tooltip) tooltip.style.opacity = "1";
50+
}}
51+
onMouseLeave={(e) => {
52+
const tooltip = e.currentTarget.nextElementSibling;
53+
if (tooltip) tooltip.style.visibility = "hidden";
54+
if (tooltip) tooltip.style.opacity = "0";
55+
}}
3356
>
3457
i
3558
</span>
36-
</h3>
37-
<ul>
38-
{topContributors.map((user) => (
39-
<li key={user.name}>
40-
{user.name} 🔥 {user.currentStreak} {user.currentStreak === 1 ? "week" : "weeks"} streak ({user.count})
41-
</li>
42-
))}
43-
</ul>
44-
</div>
45-
46-
{/* Render list of top repositories by activity count */}
47-
<div>
48-
<h3>Top Repositories</h3>
49-
<ul>
50-
{topRepos.map((repo) => (
51-
<li key={repo.name}>
52-
{repo.name} ({repo.count})
53-
</li>
54-
))}
55-
</ul>
56-
</div>
59+
60+
<span
61+
style={{
62+
visibility: "hidden",
63+
opacity: 0,
64+
transition: "opacity 0.2s ease",
65+
position: "absolute",
66+
top: "28px",
67+
left: "50%",
68+
transform: "translateX(-50%)",
69+
backgroundColor: "#222",
70+
color: "#fff",
71+
padding: "8px 10px",
72+
borderRadius: "6px",
73+
fontSize: "12px",
74+
width: "260px",
75+
zIndex: 1000,
76+
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
77+
textAlign: "left"
78+
}}
79+
>
80+
A streak increases for every consecutive 7-day period where a user closes at least 3 issues. Streak resets if threshold is not met.
81+
</span>
82+
</span>
83+
</h3>
84+
85+
<ul>
86+
{topContributors.map((user) => (
87+
<li key={user.name}>
88+
{user.name} 🔥 {user.currentStreak}{" "}
89+
{user.currentStreak === 1 ? "week" : "weeks"} streak ({user.count})
90+
</li>
91+
))}
92+
</ul>
93+
</div>
94+
95+
{/* Render list of top repositories by activity count */}
96+
<div>
97+
<h3>Top Repositories</h3>
98+
<ul>
99+
{topRepos.map((repo) => (
100+
<li key={repo.name}>
101+
{repo.name} ({repo.count})
102+
</li>
103+
))}
104+
</ul>
57105
</div>
106+
</div>
58107
);
59108
};
60109

Frontend/src/features/home/routes/Home.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const Home = () => {
5050
<span
5151
tabIndex="0"
5252
aria-label="Leaderboard streak info"
53-
title="A streak increases for every consecutive 7-day period where a user closes at least 1 issue. Streak resets if threshold is not met."
53+
title="A streak increases for every consecutive 7-day period where a user closes at least 3 issues. Streak resets if threshold is not met."
5454
style={{
5555
cursor: "pointer",
5656
border: "1px solid black",

0 commit comments

Comments
 (0)