From ed9e4db680845407398b2a22795b51f65bd8c89c Mon Sep 17 00:00:00 2001 From: fenopy Date: Mon, 9 Sep 2024 08:37:46 -0500 Subject: [PATCH] Merge pull request #16 from MikeRatcliffe/add-prettier --- .husky/pre-commit | 1 + package.json | 8 +++- tools.js | 1 - views/browse_include.twig | 3 +- views/js/browse.js | 4 +- views/js/search.js | 3 +- views/layout.twig | 95 ++++++++++++++++++++++--------------- views/modals/installed.twig | 3 +- views/settings_include.twig | 3 +- 9 files changed, 72 insertions(+), 49 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index e69de29..5e6a7c9 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm run prettier:check diff --git a/package.json b/package.json index 5525018..d00b347 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,16 @@ "dist-win": "electron-builder -w", "dist-mac": "electron-builder -m", "dist-linux": "electron-builder -l", + "prettier:check": "prettier --check \"**/*.{css,js,json,md,twig,yml}\"", + "prettier:format": "prettier --write \"**/*.{css,js,json,md,twig,yml}\"", "postdist": "npm run pack-win && npm run pack-mac", "postinstall": "electron-builder install-app-deps", "pack-win": "cd out/win-unpacked && cp ../windows-install.bat ./ && 7za a sidenoder-$npm_package_version-win.zip ./* && mv sidenoder-$npm_package_version-win.zip ../", - "pack-mac": "cd out/mac && tar -czf sidenoder-$npm_package_version-mac.tar.gz ./* && mv sidenoder-$npm_package_version-mac.tar.gz ../" + "pack-mac": "cd out/mac && tar -czf sidenoder-$npm_package_version-mac.tar.gz ./* && mv sidenoder-$npm_package_version-mac.tar.gz ../", + "prepare": "husky" + }, + "lint-staged": { + "{**/*,*}.{css,js,json,md,twig,yml}": "prettier --write" }, "build": { "appId": "com.sidenoder.app", diff --git a/tools.js b/tools.js index dda4c95..c83b74e 100644 --- a/tools.js +++ b/tools.js @@ -2830,4 +2830,3 @@ async function changeConfig(key, value) { return value; } - diff --git a/views/browse_include.twig b/views/browse_include.twig index 64ded21..666c7b9 100644 --- a/views/browse_include.twig +++ b/views/browse_include.twig @@ -91,7 +91,8 @@
+ class="row row-cols-sm-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5" + >
diff --git a/views/js/browse.js b/views/js/browse.js index 50017e1..ab8a5b5 100644 --- a/views/js/browse.js +++ b/views/js/browse.js @@ -290,8 +290,8 @@ function loadDir(list) {
${item.simpleName} ${ - item.note || "" - }
+ item.note || "" + }
${newribbon} diff --git a/views/js/search.js b/views/js/search.js index 4a8dc9b..953854a 100644 --- a/views/js/search.js +++ b/views/js/search.js @@ -204,7 +204,7 @@ class FindDialog { this.#debounce(() => { const text = $findInput.val(); this._handler(text); - }) + }), ); const $findDelete = $("", { @@ -358,4 +358,3 @@ function sortElements($element, key, asc = true) { items.sort(sortBy(key, asc)); $element.html(items); } - diff --git a/views/layout.twig b/views/layout.twig index 468fe6b..6169182 100644 --- a/views/layout.twig +++ b/views/layout.twig @@ -8,25 +8,36 @@ content="width=device-width, initial-scale=1, shrink-to-fit=no" > - + - - + + - - - - + + + + - - - - + + + + Quest-Sideloader @@ -37,18 +48,17 @@ const { ipcRenderer, /*remote, */ shell } = electron; const { dialog } = remote; - function loadInclude(template, id = null, complete = null) { - $(document).trigger("newTemplate" ); + function loadInclude(template, id = null, complete = null) { + $(document).trigger('newTemplate'); - if (!id) { - $id('mainbody') - // .html('') - .load(template, complete); - } - else { - $(`#${id}`).load(template, complete); + if (!id) { + $id('mainbody') + // .html('') + .load(template, complete); + } else { + $(`#${id}`).load(template, complete); + } } - } function formatEta(seconds) { if (seconds == null) { @@ -251,27 +261,34 @@ ipcRenderer.send('sideload_read_queue', ''); });*/ - document.addEventListener('dragover', (ev) => ev.preventDefault()); - document.addEventListener('drop', (ev) => ev.preventDefault()); + document.addEventListener('dragover', (ev) => ev.preventDefault()); + document.addEventListener('drop', (ev) => ev.preventDefault()); - document.body.addEventListener('drop', (ev) => { - ev.preventDefault(); - if (!ev.dataTransfer.files || !ev.dataTransfer.files.length) return; - - if (ev.dataTransfer.files[0].path.endsWith('.apk')) { - ipcRenderer.send('filedrop', ev.dataTransfer.files[0].path.replace(/\\/g, '/')); - } - }, false); + document.body.addEventListener( + 'drop', + (ev) => { + ev.preventDefault(); + if (!ev.dataTransfer.files || !ev.dataTransfer.files.length) return; - window.addEventListener("resize", () => { - const navPanel = document.querySelector("#nav-panel"); - if (!navPanel) { - return; - } + if (ev.dataTransfer.files[0].path.endsWith('.apk')) { + ipcRenderer.send( + 'filedrop', + ev.dataTransfer.files[0].path.replace(/\\/g, '/'), + ); + } + }, + false, + ); + + window.addEventListener('resize', () => { + const navPanel = document.querySelector('#nav-panel'); + if (!navPanel) { + return; + } - // fix navbar position - navPanel.style.top = $("#topbar").height() + "px"; - }); + // fix navbar position + navPanel.style.top = $('#topbar').height() + 'px'; + }); // actions diff --git a/views/modals/installed.twig b/views/modals/installed.twig index 4463e14..3867990 100644 --- a/views/modals/installed.twig +++ b/views/modals/installed.twig @@ -62,8 +62,7 @@