diff --git a/package.json b/package.json index a2eb1f2..4f7c61f 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "talks": "deno run --allow-all utils/talks.js", "explorer": "deno run --allow-all utils/explorer.js", "events-ext": "deno run --allow-all utils/events-ext.js", + "db-repo": "deno run --allow-all utils/db-repo.js", "sync-all": "npm run core && npm run contribs && npm run articles && npm run talks && npm run explorer && npm run events-ext" }, "dependencies": { diff --git a/src/config.yaml b/src/config.yaml index 4e262b1..36cace2 100644 --- a/src/config.yaml +++ b/src/config.yaml @@ -16,8 +16,8 @@ header: # url: /articles #- name: Leaderboard # url: /leaderboard - - name: Explorer - link: explorer + #- name: Explorer + # link: explorer - name: News link: news - name: Docs diff --git a/src/db-repo.json b/src/db-repo.json new file mode 100644 index 0000000..a51cc64 --- /dev/null +++ b/src/db-repo.json @@ -0,0 +1,5 @@ +{ + "count": "550+", + "contributors": 30, + "stars": 302 +} \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 712d8de..206546a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,6 +6,7 @@ import core from '../core.json'; import articles from '../articles.json'; import talks from '../talks.json'; import explorer from '../explorer.json'; +import dbRepo from '../db-repo.json'; import { isPast, format } from 'date-fns'; const events = core.events; @@ -44,15 +45,22 @@ for (const ev of events) { -
-
Explorer
+
+ + +
{dbRepo.stars}
-
{explorer.projects}
+
{dbRepo.count}
Projects
-
{explorer.contributors}
+
{dbRepo.contributors}
Contributors
diff --git a/src/styles/base.css b/src/styles/base.css index 692be5a..520205b 100644 --- a/src/styles/base.css +++ b/src/styles/base.css @@ -207,6 +207,11 @@ .icon.small { @apply w-6 h-6; } + + .icon.star { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16' fill='white' class='octicon octicon-star' aria-hidden='true'%3E%3Cpath d='M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z'%3E%3C/path%3E%3C/svg%3E"); + background-size: 100% 100%; + } .icon.twitter { background-image: url('data:image/svg+xml,'); diff --git a/utils/db-repo.js b/utils/db-repo.js new file mode 100644 index 0000000..e08ce58 --- /dev/null +++ b/utils/db-repo.js @@ -0,0 +1,26 @@ + + +// projects count +const resp = await fetch("https://raw.githubusercontent.com/web3privacy/web3privacy/main/README.md"); +const text = await resp.text(); +const [_, count] = text.match(/([\d\+]+) privacy projects/) + +// contributors +const response = await fetch(`https://api.github.com/repos/web3privacy/web3privacy/contributors`,); +const repoContributors = await response.json(); + +// stars +const respRepo = await fetch('https://api.github.com/repos/web3privacy/web3privacy') +const repo = await respRepo.json(); + +const data = { + count, + contributors: repoContributors.length, + stars: repo.stargazers_count, +} + +await Deno.writeTextFile( + "./src/db-repo.json", + JSON.stringify(data, null, 2), + ); + console.log(`File ./src/db-repo.json saved`); \ No newline at end of file