From 707f0097dcd0772528fd233f796230ec71e52cca Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 19 Feb 2024 14:30:11 +0000 Subject: [PATCH] Add opensource stats --- package.json | 6 ++-- src/components/OpenSourceBanner.astro | 40 ++++++++++++++++++--------- src/components/OpenSourceStat.astro | 13 +++++++++ src/lib/github.ts | 4 +-- 4 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 src/components/OpenSourceStat.astro diff --git a/package.json b/package.json index 3c47d7565..e2bc8eb11 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@astrojs/tailwind": "^5.1.0", "@fingerprintjs/fingerprintjs": "^4.2.2", "@nanostores/react": "^0.7.1", - "@types/react": "^18.2.55", + "@types/react": "^18.2.56", "@types/react-dom": "^18.2.19", "astro": "^4.4.0", "astro-compress": "^2.2.10", @@ -35,7 +35,7 @@ "dracula-prism": "^2.1.16", "jose": "^5.2.2", "js-cookie": "^3.0.5", - "lucide-react": "^0.331.0", + "lucide-react": "^0.334.0", "nanoid": "^5.0.5", "nanostores": "^0.9.5", "node-html-parser": "^6.1.12", @@ -50,7 +50,7 @@ "slugify": "^1.6.6", "tailwind-merge": "^2.2.1", "tailwindcss": "^3.4.1", - "zustand": "^4.5.0" + "zustand": "^4.5.1" }, "devDependencies": { "@playwright/test": "^1.41.2", diff --git a/src/components/OpenSourceBanner.astro b/src/components/OpenSourceBanner.astro index 20225955f..e671f06c8 100644 --- a/src/components/OpenSourceBanner.astro +++ b/src/components/OpenSourceBanner.astro @@ -1,40 +1,54 @@ --- import { getFormattedStars } from '../lib/github'; import Icon from './AstroIcon.astro'; +import { getDiscordInfo } from '../lib/discord'; +import OpenSourceStat from './OpenSourceStat.astro'; const starCount = await getFormattedStars('kamranahmedse/developer-roadmap'); +const discordInfo = await getDiscordInfo(); --- -
-
-

Community

-

+

+
+

Join the Community

+

roadmap.sh is the 6th most starred project on GitHub and is visited by hundreds of thousands of developers every month.

-
+
+ + + +
+ + diff --git a/src/components/OpenSourceStat.astro b/src/components/OpenSourceStat.astro new file mode 100644 index 000000000..4a1d195e7 --- /dev/null +++ b/src/components/OpenSourceStat.astro @@ -0,0 +1,13 @@ +--- +export interface Props { + value: string; + text: string; +} + +const { value, text } = Astro.props; +--- + +
+

{value}

+

{text}

+
diff --git a/src/lib/github.ts b/src/lib/github.ts index 4a3a2e818..26e7988a8 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -6,7 +6,7 @@ const defaultStarCount = 224000; let starCount: number | undefined = undefined; export async function countStars( - repo = 'kamranahmedse/developer-roadmap' + repo = 'kamranahmedse/developer-roadmap', ): Promise { if (starCount) { return starCount; @@ -26,7 +26,7 @@ export async function countStars( } export async function getFormattedStars( - repo = 'kamranahmedse/developer-roadmap' + repo = 'kamranahmedse/developer-roadmap', ): Promise { const stars = import.meta.env.DEV ? defaultStarCount : await countStars(repo);