diff --git a/website/public/assets/main.js b/website/public/assets/main.js index e11e0c161..98751f280 100644 --- a/website/public/assets/main.js +++ b/website/public/assets/main.js @@ -106,3 +106,32 @@ function initializeBackToTop() { } initializeBackToTop(); + +async function initializeGitHubStars() { + const link = document.querySelector(".nav-github"); + const count = link?.querySelector(".nav-github-count"); + if (count === null || count === undefined) return; + + try { + const response = await fetch("https://api.github.com/repos/morluto/rea", { + headers: { Accept: "application/vnd.github+json" }, + credentials: "omit", + signal: AbortSignal.timeout(5000), + }); + if (!response.ok) return; + const repository = await response.json(); + const stars = repository.stargazers_count; + if (!Number.isSafeInteger(stars) || stars < 0) return; + + const formatted = new Intl.NumberFormat("en-US").format(stars); + const label = `REA on GitHub (${formatted} ${stars === 1 ? "star" : "stars"})`; + count.textContent = formatted; + count.hidden = false; + link.setAttribute("aria-label", label); + link.setAttribute("title", label); + } catch { + // Keep the repository link usable when GitHub is unavailable. + } +} + +initializeGitHubStars(); diff --git a/website/public/assets/styles.css b/website/public/assets/styles.css index a7694af9b..8a21650a8 100644 --- a/website/public/assets/styles.css +++ b/website/public/assets/styles.css @@ -129,9 +129,9 @@ section[id] { } .header-inner { min-height: 88px; - display: flex; + display: grid; + grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; - justify-content: space-between; gap: 2rem; } .brand { @@ -153,6 +153,7 @@ section[id] { .navigation { display: flex; align-items: center; + justify-content: flex-end; gap: 1.8rem; font-size: 0.9rem; } @@ -171,6 +172,32 @@ section[id] { .navigation .nav-start { color: var(--ink); } +.nav-github { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 44px; + height: 44px; + padding-inline: 10px; + gap: 8px; + border: 1px solid var(--line); + border-radius: 10px; + color: var(--muted); + text-decoration: none; +} +.nav-github:hover { + background: var(--soft); + color: var(--ink); +} +.nav-github svg { + display: block; + flex-shrink: 0; +} +.nav-github-count { + font-size: 0.875rem; + font-weight: 600; + font-variant-numeric: tabular-nums; +} .faq-list { border-top: 1px solid var(--line); } @@ -1078,18 +1105,23 @@ pre code { } .header-inner { min-height: 78px; - flex-wrap: wrap; - justify-content: flex-start; + grid-template-columns: minmax(0, 1fr) auto; gap: 0.55rem; padding-block: 0.8rem; } .navigation { + grid-row: 2; + grid-column: 1 / -1; width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 0.25rem; font-size: 0.875rem; } + .nav-github { + grid-row: 1; + grid-column: 2; + } .hero { padding-block: 3.5rem 3rem; } diff --git a/website/public/faq/index.html b/website/public/faq/index.html index f6e24ca09..9ef107adc 100644 --- a/website/public/faq/index.html +++ b/website/public/faq/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +
diff --git a/website/public/get-started/index.html b/website/public/get-started/index.html index 042c74c45..25b3e57c6 100644 --- a/website/public/get-started/index.html +++ b/website/public/get-started/index.html @@ -25,8 +25,27 @@ ShowcasesGet startedGuidesFAQ - GitHub + + + +
diff --git a/website/public/guides/browser/index.html b/website/public/guides/browser/index.html index b330215c0..1858727d1 100644 --- a/website/public/guides/browser/index.html +++ b/website/public/guides/browser/index.html @@ -25,8 +25,27 @@ ShowcasesGet startedGuidesFAQ - GitHub + + + +
diff --git a/website/public/guides/index.html b/website/public/guides/index.html index d6c953d4d..b84b11176 100644 --- a/website/public/guides/index.html +++ b/website/public/guides/index.html @@ -25,8 +25,27 @@ ShowcasesGet startedGuidesFAQ - GitHub + + + +
diff --git a/website/public/guides/javascript/index.html b/website/public/guides/javascript/index.html index e7186f0ce..b7d559c50 100644 --- a/website/public/guides/javascript/index.html +++ b/website/public/guides/javascript/index.html @@ -25,8 +25,27 @@ ShowcasesGet startedGuidesFAQ - GitHub + + + +
diff --git a/website/public/guides/native/index.html b/website/public/guides/native/index.html index ba28535c3..d5fd3005e 100644 --- a/website/public/guides/native/index.html +++ b/website/public/guides/native/index.html @@ -25,8 +25,27 @@ ShowcasesGet startedGuidesFAQ - GitHub + + + +
diff --git a/website/public/index.html b/website/public/index.html index c08ccca61..e315e63ff 100644 --- a/website/public/index.html +++ b/website/public/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +
diff --git a/website/public/showcase/ctf/index.html b/website/public/showcase/ctf/index.html index e7055038e..d3ed8e85c 100644 --- a/website/public/showcase/ctf/index.html +++ b/website/public/showcase/ctf/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +
diff --git a/website/public/showcase/dx-ball/index.html b/website/public/showcase/dx-ball/index.html index 12cc6854f..8394bb56c 100644 --- a/website/public/showcase/dx-ball/index.html +++ b/website/public/showcase/dx-ball/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +
diff --git a/website/public/showcase/index.html b/website/public/showcase/index.html index 23a112d9b..4f3083563 100644 --- a/website/public/showcase/index.html +++ b/website/public/showcase/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +
diff --git a/website/public/showcase/notion/index.html b/website/public/showcase/notion/index.html index d5dacc178..134d173c5 100644 --- a/website/public/showcase/notion/index.html +++ b/website/public/showcase/notion/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +
diff --git a/website/public/showcase/th04/index.html b/website/public/showcase/th04/index.html index 1fd59e707..84937ee32 100644 --- a/website/public/showcase/th04/index.html +++ b/website/public/showcase/th04/index.html @@ -26,8 +26,27 @@ Get started Guides FAQ - GitHub + + + +