From 5d8f753659a1b1dc4f453297ab6c1adaf3c3c4a9 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Thu, 29 Jan 2026 03:20:34 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Improve=20code=20readability=20b?= =?UTF-8?q?y=20reformatting=20imports,=20refining=20filter=20and=20sort=20?= =?UTF-8?q?logic,=20and=20simplifying=20function=20syntax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/composables/useGamemasterFiles.js | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/code/websites/pokedex.online/src/composables/useGamemasterFiles.js b/code/websites/pokedex.online/src/composables/useGamemasterFiles.js index 6dd07fd..235e9ef 100644 --- a/code/websites/pokedex.online/src/composables/useGamemasterFiles.js +++ b/code/websites/pokedex.online/src/composables/useGamemasterFiles.js @@ -1,6 +1,9 @@ import { ref, computed, watch } from 'vue'; import { perfMonitor } from '@/utilities/performance-utils.js'; -import { extractJsonPaths, extractJsonPathsLazy } from '@/utilities/json-utils.js'; +import { + extractJsonPaths, + extractJsonPathsLazy +} from '@/utilities/json-utils.js'; import { useLocalStorage } from '@/composables/useLocalStorage.js'; /** @@ -55,16 +58,18 @@ export function useGamemasterFiles(client) { const seen = new Set(); const order = { pokemon: 1, allForms: 2, moves: 3, raw: 4 }; - return availableFiles.value.filter(file => { - const type = getFileType(file.filename); - if (seen.has(type)) return false; - seen.add(type); - return true; - }).sort((a, b) => { - const typeA = getFileType(a.filename); - const typeB = getFileType(b.filename); - return (order[typeA] ?? 999) - (order[typeB] ?? 999); - }); + return availableFiles.value + .filter(file => { + const type = getFileType(file.filename); + if (seen.has(type)) return false; + seen.add(type); + return true; + }) + .sort((a, b) => { + const typeA = getFileType(a.filename); + const typeB = getFileType(b.filename); + return (order[typeA] ?? 999) - (order[typeB] ?? 999); + }); }); /** @@ -244,17 +249,14 @@ export function useGamemasterFiles(client) { return; // Already visible } - const newEndIndex = Math.min( - lineNumber + 1000, - fileLines.value.length - ); + const newEndIndex = Math.min(lineNumber + 1000, fileLines.value.length); updateDisplayLines(0, newEndIndex); } /** * Watch for file selection changes */ - watch(selectedFile, async (newFile) => { + watch(selectedFile, async newFile => { if (newFile) { await loadFile(); }