Skip to content

Commit bb8e388

Browse files
committed
fixed versions
1 parent 9531902 commit bb8e388

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

src/components/Project.astro

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ function getColor(language: string) {
3838
))
3939
}
4040
</div>
41-
<p
42-
data-path={path}
43-
class="project-version px-2 rounded-lg text-white bg-green-600"
44-
>
45-
</p>
41+
<p data-path={path} class="project-version px-2 rounded-lg text-white"></p>
4642
</div>
4743
<div class="mb-16">
4844
<p>{description}</p>
@@ -78,6 +74,7 @@ function getColor(language: string) {
7874
return;
7975
}
8076
element.innerHTML = version;
77+
element.classList.add("bg-green-600");
8178
}
8279
});
8380
</script>

src/pages/[project].placeholder

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
import Layout from "../layouts/Layout.astro";
3+
import About from "../sections/About.astro";
4+
import Contact from "../sections/Contact.astro";
5+
import Projects from "../sections/Projects.astro";
6+
import Team from "../sections/Team.astro";
7+
---
8+
9+
<Layout>
10+
<About />
11+
<Projects />
12+
<Team />
13+
<Contact />
14+
</Layout>

src/server/githubReleaseCache.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const cache = new Map<string, ReleaseCache>();
1111

1212
async function fetchLatestRelease(repo: string) {
1313
const res = await fetch(
14-
`https://api.github.com/repos/Nexoscript/${repo}/releases/latest`,
14+
`https://api.github.com/repos/Nexoscript/${repo}/releases`,
1515
{
1616
headers: {
1717
Accept: "application/vnd.github+json",
@@ -24,8 +24,11 @@ async function fetchLatestRelease(repo: string) {
2424

2525
const json = await res.json();
2626

27+
// The GitHub releases API returns an array, so get the first release
28+
const latest = Array.isArray(json) && json.length > 0 ? json[0] : null;
29+
2730
cache.set(repo, {
28-
title: json.name ?? json.tag_name ?? null,
31+
title: latest ? latest.name ?? latest.tag_name ?? null : null,
2932
fetchedAt: Date.now(),
3033
});
3134
}

0 commit comments

Comments
 (0)