leaderboard repos

This commit is contained in:
tree🌴 2024-02-14 13:24:14 +01:00
parent 2079a12c23
commit ec4fc36a15
4 changed files with 942 additions and 910 deletions

View file

@ -35,7 +35,7 @@ import contributors from '../contributors.json';
<div>{config.landing.community}</div> <div>{config.landing.community}</div>
<div class="flex gap-4 flex-wrap my-14 items-center"> <div class="flex gap-4 flex-wrap my-14 items-center">
{contributors.map((contrib) => ( {contributors.items.map((contrib) => (
<div><a href={contrib.html_url} target="_blank" title={contrib.login}><img src={contrib.avatar_url} class="w-16 rounded-full aspect-square"></a></div> <div><a href={contrib.html_url} target="_blank" title={contrib.login}><img src={contrib.avatar_url} class="w-16 rounded-full aspect-square"></a></div>
))} ))}
</div> </div>

View file

@ -1,4 +1,22 @@
[ {
"repos": [
"web3privacy/web3privacy",
"web3privacy/data",
"web3privacy/docs",
"web3privacy/web",
"web3privacy/brand",
"web3privacy/events",
"web3privacy/explorer",
"web3privacy/explorer-data",
"web3privacy/explorer-app",
"web3privacy/news",
"web3privacy/news-app",
"web3privacy/w3ps1",
"web3privacy/grants",
"web3privacy/old-website",
"web3privacy/web3privacy-app-old"
],
"items": [
{ {
"login": "Msiusko", "login": "Msiusko",
"id": 116563801, "id": 116563801,
@ -903,3 +921,4 @@
"contributions": 1 "contributions": 1
} }
] ]
}

View file

@ -5,7 +5,7 @@ import contributors from '../contributors.json';
const points = {} const points = {}
let i = 0; let i = 0;
for (const c of contributors) { for (const c of contributors.items) {
const key = `c:${c.contributions}` const key = `c:${c.contributions}`
if (!points[key]) { if (!points[key]) {
points[key] = { arr: [c.login], start: i } points[key] = { arr: [c.login], start: i }
@ -34,11 +34,11 @@ function getPoint (num){
<tr> <tr>
<th></th> <th></th>
<th class="pb-4 uppercase" colspan="2">Contributor</th> <th class="pb-4 uppercase" colspan="2">Contributor</th>
<th align="left" class="pb-4 uppercase"># Contributions</th> <th align="left" class="pb-4 uppercase"># Commits</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{contributors.map((contrib, i) => ( {contributors.items.map((contrib, i) => (
<tr> <tr>
<td align="right"> <td align="right">
{[getPoint(contrib.contributions)].map((r) => ( {[getPoint(contrib.contributions)].map((r) => (
@ -64,6 +64,16 @@ function getPoint (num){
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="middle-pane-medium flex items-center justify-center">
<div class="mt-20">
<h2>Eligible repositories</h2>
<div class="mt-6">
{contributors.repos.map(repo => (
<div><a href=`https://github.com/${repo}` class="hover:underline">@{repo}</a></div>
))}
</div>
</div>
</div>
</BaseLayout> </BaseLayout>

View file

@ -61,7 +61,10 @@ async function getContributors() {
return output.sort((x, y) => y.contributions > x.contributions ? 1 : -1); return output.sort((x, y) => y.contributions > x.contributions ? 1 : -1);
} }
const contributors = await getContributors(); const contributors = {
repos: contributorRepos,
items: await getContributors(),
};
await Deno.writeTextFile( await Deno.writeTextFile(
"./src/contributors.json", "./src/contributors.json",
JSON.stringify(contributors, null, 2), JSON.stringify(contributors, null, 2),