From b4e8fe2b581bb4c62fc9e366029fa0cd4df114c4 Mon Sep 17 00:00:00 2001 From: subhraneel2005 Date: Wed, 4 Mar 2026 14:47:54 +0530 Subject: [PATCH 1/2] feat(planet): implement progressive loading for project cards --- planet/js/GlobalPlanet.js | 56 +++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/planet/js/GlobalPlanet.js b/planet/js/GlobalPlanet.js index 17b248861f..d6ba1100c1 100644 --- a/planet/js/GlobalPlanet.js +++ b/planet/js/GlobalPlanet.js @@ -245,25 +245,35 @@ class GlobalPlanet { } else if (l === this.page + 1) { this.downloadProjectsToCache( toDownload, + function (id) { + this.renderSingleProject(id); + }.bind(this), function () { - this.render(data); + this.hideLoading(); this.showLoadMore(); + this.index += this.page; }.bind(this) ); } else { this.downloadProjectsToCache( toDownload, + function (id) { + this.renderSingleProject(id); + }.bind(this), function () { - this.render(data); + this.hideLoading(); this.hideLoadMore(); + this.index += this.page; }.bind(this) ); } } - downloadProjectsToCache(data, callback) { + downloadProjectsToCache(data, onEachComplete, onAllComplete) { const Planet = this.Planet; this.loadCount = data.length; + this.loadedCount = 0; + const totalCount = data.length; for (let i = 0; i < data.length; i++) { (function () { @@ -272,20 +282,35 @@ class GlobalPlanet { id, function (d) { const tempid = id; - this.addProjectToCache(tempid, d, callback); + this.addProjectToCache( + tempid, + d, + onEachComplete, + onAllComplete, + totalCount + ); }.bind(this) ); - }.bind(this)()); + }).bind(this)(); } } - addProjectToCache(id, data, callback) { + addProjectToCache(id, data, onEachComplete, onAllComplete, totalCount) { if (data.success) { this.cache[id] = data.data; this.cache[id].ProjectData = null; this.loadCount -= 1; + this.loadedCount += 1; - if (this.loadCount <= 0) callback(); + if (onEachComplete) { + onEachComplete(id); + } + + this.updateLoadingProgress(this.loadedCount, totalCount); + + if (this.loadCount <= 0 && onAllComplete) { + onAllComplete(); + } } else this.throwOfflineError(); } @@ -293,7 +318,7 @@ class GlobalPlanet { this.Planet.ServerInterface.getProjectDetails( id, function (d) { - this.addProjectToCache(id, d, callback); + this.addProjectToCache(id, d, null, callback, 1); }.bind(this) ); } @@ -375,6 +400,16 @@ class GlobalPlanet { this.afterAddProjects(); } + renderSingleProject(id) { + if (this.cache.hasOwnProperty(id)) { + const g = new GlobalCard(this.Planet); + g.init(id); + g.render(); + this.cards.push(g); + jQuery(".tooltipped").tooltip({ delay: 50 }); + } + } + afterAddProjects() { this.index += this.page; this.hideLoading(); @@ -408,6 +443,11 @@ class GlobalPlanet { document.getElementById("global-load").style.display = "block"; } + updateLoadingProgress(loaded, total) { + // Progress is shown by cards appearing incrementally + // The loading spinner remains visible until all projects are loaded + } + hideLoadMore() { document.getElementById("load-more-projects").style.display = "none"; this.loadButtonShown = false; From 20258ea4182d860ab71c08753042a3d07a1aa1ba Mon Sep 17 00:00:00 2001 From: subhraneel2005 Date: Thu, 5 Mar 2026 16:29:30 +0530 Subject: [PATCH 2/2] re-trigger CI