Skip to content

Commit eb6e767

Browse files
ui: redesign Authors & Maintainers with leaderboard
1 parent 4cd1ff3 commit eb6e767

2 files changed

Lines changed: 109 additions & 4 deletions

File tree

public/css/style.css

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ div.page>section h2 {
258258
ul {
259259
margin-top: var(--default-margin);
260260
}
261-
ul + ul {
261+
262+
ul+ul {
262263
margin-right: 20px;
263264
}
264265

@@ -283,7 +284,8 @@ ul>li>a {
283284
color: var(--secondary-text-color);
284285
}
285286

286-
ul>li>p,ul>li>span {
287+
ul>li>p,
288+
ul>li>span {
287289
font-size: 18px;
288290
}
289291

@@ -347,3 +349,84 @@ li[role=link]:focus {
347349
display: 100%;
348350
}
349351
}
352+
353+
.box-stats,
354+
.box-stats-resume>.one-stat {
355+
background: var(--card-background, transparent);
356+
transition: transform 0.15s ease, box-shadow 0.15s ease;
357+
}
358+
359+
.box-stats:hover,
360+
.box-stats-resume>.one-stat:hover {
361+
transform: translateY(-2px);
362+
}
363+
364+
ul>li>a span {
365+
white-space: nowrap;
366+
overflow: hidden;
367+
text-overflow: ellipsis;
368+
}
369+
370+
.npm-packages-item:hover {
371+
background: rgba(255, 255, 255, 0.04);
372+
border-radius: 4px;
373+
}
374+
375+
.box-stats-resume>.one-stat span {
376+
font-size: 1.3rem;
377+
letter-spacing: 1px;
378+
}
379+
380+
.box-stats-container.charts {
381+
box-shadow: inset 0 0 0 1px var(--faded-border-color);
382+
}
383+
384+
.authors-leaderboard {
385+
margin-top: 20px;
386+
max-width: 650px;
387+
margin-left: auto;
388+
margin-right: auto;
389+
padding: 0;
390+
}
391+
392+
.authors-leaderboard li {
393+
display: grid;
394+
grid-template-columns: 40px 1fr 60px;
395+
align-items: center;
396+
gap: 10px;
397+
padding: 10px 14px;
398+
margin-bottom: 8px;
399+
border-radius: 10px;
400+
background: rgba(255, 255, 255, 0.04);
401+
border: 1px solid var(--faded-border-color);
402+
font-family: "mononoki";
403+
}
404+
405+
.authors-leaderboard .rank {
406+
font-weight: bold;
407+
text-align: center;
408+
}
409+
410+
.authors-leaderboard .rank-1 {
411+
border-color: gold;
412+
}
413+
414+
.authors-leaderboard .rank-2 {
415+
border-color: silver;
416+
}
417+
418+
.authors-leaderboard .rank-3 {
419+
border-color: #cd7f32;
420+
}
421+
422+
.author-email {
423+
white-space: nowrap;
424+
overflow: hidden;
425+
text-overflow: ellipsis;
426+
}
427+
428+
.author-count {
429+
font-weight: bold;
430+
color: var(--main-color);
431+
text-align: right;
432+
}

views/template.html

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,37 @@ <h3><span>[[=Object.keys(z.npm_stats.deps.node).length]]</span>Node.js Core Depe
153153
<i class="fas fa-user"></i>
154154
<h3>Authors & Maintainers</h3>
155155
</div>
156+
156157
<div class="box-avatar">
157158
[[ for (const [email, count] of Object.entries(z.npm_stats.authors)) { ]]
158159
<div class="avatar" data-email="[[=email]]">
159-
<a href="#" target="_blank" rel="noopener"></a>
160160
<p>[[=count]]</p>
161161
</div>
162162
[[ } ]]
163163
</div>
164+
165+
<p class="authors-total">
166+
Total Contributors: [[=Object.keys(z.npm_stats.authors).length]]
167+
</p>
168+
169+
[[
170+
let sortedAuthors = Object.entries(z.npm_stats.authors)
171+
.sort((a, b) => b[1] - a[1])
172+
.slice(0, 10);
173+
]]
174+
175+
<ul class="authors-leaderboard">
176+
[[ let index = 0; ]]
177+
[[ for (const [email, count] of sortedAuthors) { ]]
178+
<li class="rank-[[=index+1]]">
179+
<span class="rank">[[=index+1]]</span>
180+
<span class="author-email">[[=email]]</span>
181+
<span class="author-count">[[=count]]</span>
182+
</li>
183+
[[ index++; ]]
184+
[[ } ]]
185+
</ul>
186+
164187
</div>
165188
</div>
166189
[[ if (Object.keys(z.npm_stats.scorecards).length > 0) { ]]
@@ -326,7 +349,6 @@ <h3>Authors & Maintainers</h3>
326349
<div class="box-avatar">
327350
[[ for (const [email, count] of Object.entries(z.git_stats.authors)) { ]]
328351
<div class="avatar" data-email="[[=email]]">
329-
<a href="#" target="_blank" rel="noopener"></a>
330352
<p>[[=count]]</p>
331353
</div>
332354
[[ } ]]

0 commit comments

Comments
 (0)