Skip to content

Commit 75e6352

Browse files
Copilotekizito96
andauthored
Remove roadmap.md and fix header.js instant navigation
Agent-Logs-Url: https://github.com/Prescott-Data/nexus-framework/sessions/cf0c72d4-33bf-4cdc-a755-2386d8a83d1c Co-authored-by: ekizito96 <87319861+ekizito96@users.noreply.github.com>
1 parent a1411b5 commit 75e6352

2 files changed

Lines changed: 36 additions & 100 deletions

File tree

docs/javascripts/header.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,49 @@
44
- Moves theme palette toggle to far-right
55
- Opens external tabs in new window
66
*/
7-
document.addEventListener('DOMContentLoaded', function () {
7+
function initHeader() {
88

99
/* ── 1. Version chip — live from GitHub API ─────────── */
1010
var title = document.querySelector('.md-header__title');
11-
var chip;
12-
if (title) {
11+
var chip = document.querySelector('.nx-version-chip');
12+
13+
// Skip if already injected (instant navigation guard)
14+
if (!chip && title) {
1315
chip = document.createElement('span');
1416
chip.className = 'nx-version-chip';
1517
chip.textContent = '…';
1618
title.insertAdjacentElement('afterend', chip);
1719
}
1820

1921
/* Fetch the LATEST tag from GitHub — single source of truth */
20-
fetch('https://api.github.com/repos/Prescott-Data/nexus-framework/tags')
21-
.then(function (r) { return r.json(); })
22-
.then(function (tags) {
23-
if (Array.isArray(tags) && tags.length > 0) {
24-
var latestVersion = tags[0].name;
25-
if (chip) chip.textContent = latestVersion;
22+
if (chip) {
23+
fetch('https://api.github.com/repos/Prescott-Data/nexus-framework/tags')
24+
.then(function (r) { return r.json(); })
25+
.then(function (tags) {
26+
if (Array.isArray(tags) && tags.length > 0) {
27+
var latestVersion = tags[0].name;
28+
if (chip) chip.textContent = latestVersion;
2629

27-
/* Also update hero badge if present */
28-
var heroBadge = document.getElementById('nx-hero-version-badge');
29-
if (heroBadge) {
30-
heroBadge.innerHTML = latestVersion + ' &middot; Apache 2.0 &middot; Production Ready';
30+
/* Also update hero badge if present */
31+
var heroBadge = document.getElementById('nx-hero-version-badge');
32+
if (heroBadge) {
33+
heroBadge.innerHTML = latestVersion + ' &middot; Apache 2.0 &middot; Production Ready';
34+
}
3135
}
32-
}
33-
})
34-
.catch(function () {
35-
/* On network failure, hide chip entirely rather than showing stale data */
36-
if (chip) chip.style.display = 'none';
37-
});
36+
})
37+
.catch(function () {
38+
/* On network failure, hide chip entirely rather than showing stale data */
39+
if (chip) chip.style.display = 'none';
40+
});
41+
}
3842

3943
/* ── 2. GitHub stars widget ─────────────────────────── */
4044
var inner = document.querySelector('.md-header__inner');
4145
var palette = document.querySelector('form[data-md-component="palette"]');
42-
if (inner && palette) {
46+
var existingGhBtn = document.querySelector('.nx-gh-btn');
47+
48+
// Skip if already injected (instant navigation guard)
49+
if (inner && palette && !existingGhBtn) {
4350
var ghBtn = document.createElement('a');
4451
ghBtn.href = 'https://github.com/Prescott-Data/nexus-framework';
4552
ghBtn.target = '_blank';
@@ -77,4 +84,12 @@ document.addEventListener('DOMContentLoaded', function () {
7784
}
7885
});
7986

80-
});
87+
}
88+
89+
// Run on first load
90+
document.addEventListener('DOMContentLoaded', initHeader);
91+
92+
// Re-run on every instant navigation (Material for MkDocs SPA mode)
93+
if (typeof document$ !== 'undefined') {
94+
document$.subscribe(initHeader);
95+
}

docs/reference/roadmap.md

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)