mirror of
https://github.com/web3privacy/web
synced 2024-10-15 18:26:27 +02:00
fix leaderboard
This commit is contained in:
parent
8b66c7bb38
commit
5fcd547c3d
2 changed files with 45 additions and 7 deletions
|
@ -88,7 +88,7 @@ import cfonts from 'cfonts';
|
|||
<div class="middle-pane-medium mt-8 sm:mt-14 mb-2 sm:mb-8">
|
||||
<div class="leading-none flex justify-center text-[4px] sm:text-[8px] text-white">
|
||||
{/*<img src="/page-events.png" class="h-8 sm:h-14" title="Events" />*/}
|
||||
<pre><code>{cfonts.render(title + ' ', { font: '', maxLength: 1000 }).string}</code></pre>
|
||||
<pre><code>{cfonts.render(title + ' ', { font: '', maxLength: 1500 }).string}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -3,23 +3,61 @@
|
|||
import BaseLayout from '../layouts/base.astro';
|
||||
import contributors from '../contributors.json';
|
||||
|
||||
const points = {}
|
||||
let i = 0;
|
||||
for (const c of contributors) {
|
||||
const key = `c:${c.contributions}`
|
||||
if (!points[key]) {
|
||||
points[key] = { arr: [c.login], start: i }
|
||||
} else {
|
||||
points[key].arr.push(c.login)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
function getPoint (num){
|
||||
const key = `c:${num}`
|
||||
const obj = points[key];
|
||||
return `${obj.start+1}${obj.arr.length > 1 ? '-'+(obj.start+1+obj.arr.length) : ''}`;
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
<BaseLayout title="Leaderboard">
|
||||
|
||||
<div class="middle-pane-medium mt-10">
|
||||
<table class="w3pn-leaderboard-table w-1/2">
|
||||
<div class="middle-pane-medium mt-10 flex items-center justify-center">
|
||||
<!--code><pre>
|
||||
{JSON.stringify(points, null, 2)}
|
||||
</pre></code-->
|
||||
<table class="w3pn-leaderboard-table w-full sm:w-5/6 md:w-2/3 lg:w-1/2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="pb-4 uppercase" colspan="2">Contributor</th>
|
||||
<th align="left" class="pb-4 uppercase"># Contribs</th>
|
||||
<th align="left" class="pb-4 uppercase"># Contributions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{contributors.map((contrib) => (
|
||||
{contributors.map((contrib, i) => (
|
||||
<tr>
|
||||
<td align="right" class="py-2 px-4"><div class="w-16 h-16"><img src={contrib.avatar_url} class="rounded-full" /></div></td>
|
||||
<td class="px-2"><a href={contrib.html_url} target="_blank" class="hover:underline">{contrib.login}</a></td>
|
||||
<td align="right">
|
||||
{[getPoint(contrib.contributions)].map((r) => (
|
||||
<div>
|
||||
{r < 3 &&
|
||||
<span class="mr-4">
|
||||
{r === "1" && "🥇"}
|
||||
{r === "2" && "🥈"}
|
||||
{r === "3" && "🥉"}
|
||||
</span>
|
||||
}
|
||||
<b>{r}.</b>
|
||||
</div>
|
||||
))}
|
||||
</td>
|
||||
<td align="right" class="py-3 px-4"><div class="w-16 h-16"><img src={contrib.avatar_url} class="rounded-full border" /></div></td>
|
||||
<td class="px-2">
|
||||
<a href={contrib.html_url} target="_blank" class="hover:underline">{contrib.login}</a>
|
||||
</td>
|
||||
<td class="text-white pl-10 text-lg pr-4" align="left">{contrib.contributions}</td>
|
||||
</tr>
|
||||
))}
|
||||
|
|
Loading…
Reference in a new issue