diff --git a/src/env.d.ts b/src/env.d.ts index f964fe0..c96d614 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1 +1,9 @@ /// + +interface ImportMetaEnv { + readonly GITHUB_ACCESS_TOKEN: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index e878255..e0da90c 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -60,7 +60,8 @@ rocketsPoint: { min: 0, max: 100, - } + }, + autoresize: true, }) fireworks.start() diff --git a/src/pages/projects.astro b/src/pages/projects.astro index 0862dcf..6b29876 100644 --- a/src/pages/projects.astro +++ b/src/pages/projects.astro @@ -3,7 +3,17 @@ import Layout from "../layouts/Layout.astro"; import Navbar from "../components/widgets/Navbar.astro"; import Container from "../components/atoms/Container.astro"; -const projects = [ +interface Project { + name: string; + link: string; + desc: string; + stats?: { + forks: number; + stars: number; + }; +} + +const projects: Project[] = [ { name: "HyLib", link: "https://github.com/xHyroM/HyLib", @@ -22,14 +32,52 @@ const projects = [ { name: "Mashe", link: "https://github.com/xHyroM/mashe", - desc: "Simple, fast, and easy to use Event Handling for Java." + desc: "Simple, fast, and easy to use Event Handling for Java.", }, { name: "Mumblum", link: "https://github.com/xHyroM/mumblum", - desc: "Mumblum is a simple, modern discord bot in JDA." + desc: "Mumblum is a simple, modern discord bot in JDA.", + }, + { + name: "setup-bun", + link: "https://github.com/xHyroM/setup-bun", + desc: "Set up your GitHub Actions workflow with a specific version of Bun.", + }, + { + name: "Roles Bot", + link: "https://github.com/xHyroM/roles-bot", + desc: "Discord bot for \"button\" roles, using Cloudflare Workers.", + }, + { + name: "Bun Discord Bot", + link: "https://github.com/xHyroM/bun-discord-bot", + desc: "Official serverless discord bot for bun discord server." + }, + { + name: "hykord", + link: "https://github.com/xHyroM/hykord", + desc: "My @discord client modification." + }, + { + name: "frog", + link: "https://github.com/xHyroM/frog", + desc: "Frog is an extremely simple language based on the monkey language." } ]; + +for (const project of projects) { + const repository = await (await fetch(`https://api.github.com/repos/${project.link.slice(19)}`, { + headers: { + 'Authorization': `Bearer ${import.meta.env.GITHUB_ACCESS_TOKEN}` + } + })).json(); + + project.stats = { + forks: repository.forks, + stars: repository.stargazers_count + } +} --- @@ -44,7 +92,7 @@ const projects = [ projects.map((project) => ( - + {project.name} @@ -54,7 +102,7 @@ const projects = [ alt="" class="w-[21px] h-[21px] translate-y-[1px]" /> - 4 + {project.stats!.stars} {" "} @@ -63,7 +111,7 @@ const projects = [ alt="" class="w-[21px] h-[21px] translate-y-[1px]" /> - 9 + {project.stats!.forks}
4
{project.stats!.stars}
9
{project.stats!.forks}