From 97cc04f9d8cba1c06a1587428e4b76d5d58e1801 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 4 Feb 2024 22:56:05 -0500 Subject: Update projects page to display Alee14-Projects GitHub repositories --- src/components/Guestbook.jsx | 2 +- src/pages/projects.astro | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/Guestbook.jsx b/src/components/Guestbook.jsx index 41d0271..a959b5a 100644 --- a/src/components/Guestbook.jsx +++ b/src/components/Guestbook.jsx @@ -47,7 +47,7 @@ class Guestbook extends Component {

Message from: {g.name}

{formatDate(g.created)}
- {g.website && Website} + {g.website && Website} ))}
diff --git a/src/pages/projects.astro b/src/pages/projects.astro index 33452c8..668217c 100644 --- a/src/pages/projects.astro +++ b/src/pages/projects.astro @@ -2,6 +2,19 @@ import Page from "../layouts/Page.astro"; import projects from "../data/projects.json"; import "../styles/cards.css"; + +let repos; +let error = null; +try { + const alee14_projects = await fetch('https://api.github.com/orgs/alee14-projects/repos'); + repos = await alee14_projects.json(); + repos = repos.filter(repo => !repo.fork); +} catch (err) { + console.error('Failed to fetch projects:', err); + error = err.message; + // You can set repos to an empty array if the fetch fails + repos = []; +} ---
@@ -24,8 +37,21 @@ import "../styles/cards.css"; }) } -

Archived Repositories

-

Alee Productions/AleeCorp Software

+

AleeCorp/Alee Productions GitHub Repositories

+ { error &&
{error}
} +
+ {repos.map((repo) => { + return ( +
+

{repo.name}

+

{repo.description}

+ +
+ ) + })} +