Skip to content

Commit df275b1

Browse files
ui: paginate version history with 'Show older versions' (12 at a time)
1 parent cd237a9 commit df275b1

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

index.html

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,11 +3106,30 @@ <h2 class="section-title">
31063106
lucide.createIcons();
31073107
}
31083108

3109-
// Render version history
3110-
function renderVersionHistory(versions) {
3109+
// Render version history with incremental loading
3110+
let __allVersions = [];
3111+
let __visibleVersionCount = 0;
3112+
const __LOAD_INCREMENT = 12; // number of versions to reveal per click
3113+
3114+
function renderVersionHistory(versions, options = {}) {
3115+
// Initialize backing store
3116+
if (Array.isArray(versions)) {
3117+
__allVersions = versions;
3118+
}
3119+
if (typeof options.visibleCount === "number") {
3120+
__visibleVersionCount = options.visibleCount;
3121+
}
3122+
3123+
// Clamp
3124+
if (!__visibleVersionCount || __visibleVersionCount < 1) {
3125+
__visibleVersionCount = Math.min(__LOAD_INCREMENT, __allVersions.length || 0);
3126+
}
3127+
31113128
const versionList = document.getElementById("version-list");
31123129

3113-
const versionsHTML = versions
3130+
const toRender = (__allVersions || []).slice(0, __visibleVersionCount);
3131+
3132+
const versionsHTML = toRender
31143133
.map((version, versionIndex) => {
31153134
// Prioritize platforms and remove duplicates for this version
31163135
const prioritizedPlatforms = getPrioritizedPlatforms(
@@ -3178,8 +3197,30 @@ <h2 class="section-title">
31783197
})
31793198
.join("");
31803199

3200+
// Render versions
31813201
versionList.innerHTML = versionsHTML;
31823202

3203+
// Render/Update "Show older versions" control
3204+
const existingMore = document.getElementById("load-more-versions");
3205+
if (existingMore) existingMore.remove();
3206+
3207+
if (__visibleVersionCount < (__allVersions || []).length) {
3208+
const moreBtn = document.createElement("button");
3209+
moreBtn.id = "load-more-versions";
3210+
moreBtn.className = "expand-toggle";
3211+
moreBtn.style.marginTop = "0.75rem";
3212+
moreBtn.innerHTML = '<span>Show older versions</span><span class="expand-icon" style="transform: rotate(45deg); margin-left: 0.25rem"></span>';
3213+
moreBtn.addEventListener("click", (e) => {
3214+
e.preventDefault();
3215+
__visibleVersionCount = Math.min(
3216+
__visibleVersionCount + __LOAD_INCREMENT,
3217+
(__allVersions || []).length,
3218+
);
3219+
renderVersionHistory(undefined, { visibleCount: __visibleVersionCount });
3220+
});
3221+
versionList.parentElement.appendChild(moreBtn);
3222+
}
3223+
31833224
// Re-initialize Lucide icons for dynamic content
31843225
lucide.createIcons();
31853226
}
@@ -3379,7 +3420,7 @@ <h2 class="section-title">
33793420
// Update all sections with dynamic data
33803421
updateVersionInfo(latestVersion);
33813422
setupSmartDownload(latestVersion);
3382-
renderVersionHistory(data.versions);
3423+
renderVersionHistory(data.versions, { visibleCount: 12 });
33833424
}
33843425

33853426
// Setup interactivity

0 commit comments

Comments
 (0)