From c47a877a36119cbb144cefa72483001dd194f2d1 Mon Sep 17 00:00:00 2001 From: GabiZar Date: Wed, 25 Feb 2026 20:21:07 +0100 Subject: [PATCH] Add pagination system to mod search --- main.js | 11 ++-- renderer/index.html | 20 ++++++ renderer/renderer.js | 145 ++++++++++++++++++++++++++++--------------- renderer/style.css | 9 ++- 4 files changed, 129 insertions(+), 56 deletions(-) diff --git a/main.js b/main.js index ff917e7..45bec86 100644 --- a/main.js +++ b/main.js @@ -33,7 +33,9 @@ let sevenZipPath = path7za; const Nexus = NexusModule.default; let nexus; let installedCachedModList; +let installedTotalModsCount; let onlineCachedModList; +let onlineTotalModsCount; const bepinexFiles = [".doorstop_version", "changelog.txt", "doorstop_config.ini", "winhttp.dll"]; let bepinexVersion; @@ -438,12 +440,12 @@ ipcMain.handle("get-mods", async (event, type) => { if (!installedCachedModList) { await searchInstalledMods(""); } - return installedCachedModList; + return { modsInfo: installedCachedModList, installedTotalCount: installedTotalModsCount }; } else if (type == "mods-online") { if (!onlineCachedModList) { await searchNexusMods(""); } - return onlineCachedModList; + return { mods: onlineCachedModList, onlineTotalCount: onlineTotalModsCount }; } }); @@ -603,7 +605,7 @@ async function searchNexusMods(keywords, offset = 0, count = 10, sortFilter = "d } } - return data.mods.totalCount; + onlineTotalModsCount = data.mods.totalCount; } ipcMain.handle("search-installed-mods", async (event, keywords, offset, count, sortFilter, sortOrder) => { @@ -629,7 +631,8 @@ async function searchInstalledMods(keywords, offset = 0, count = 10, sortFilter modsInfoSorted = modsInfoFiltered.sort((a, b) => sortFactor * (a[sortFilter] - b[sortFilter])); } - installedCachedModList = modsInfoSorted; + installedTotalModsCount = modsInfoSorted.length; + installedCachedModList = modsInfoSorted.slice(offset, offset + count); } ////////////////////////////////////////////////////// diff --git a/renderer/index.html b/renderer/index.html index afcbf2b..33d9128 100644 --- a/renderer/index.html +++ b/renderer/index.html @@ -110,6 +110,16 @@
+
+
+ + +
+
+ + +
+