From ceda605611c9ec2fbe858f3ae29942d56a06ac66 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 4 Feb 2024 00:30:46 +0100 Subject: added icons to more buttons --- src/app/css/grid.css | 1 + src/app/css/launcher.css | 34 ++++++++++++++++++++++++++++++++++ src/app/icons/down.png | Bin 0 -> 343 bytes src/app/icons/downloads.png | Bin 0 -> 313 bytes src/app/icons/open.png | Bin 0 -> 353 bytes src/app/icons/redo.png | Bin 0 -> 754 bytes src/app/icons/search.png | Bin 0 -> 569 bytes src/app/icons/toggles.png | Bin 0 -> 754 bytes src/app/icons/trash.png | Bin 0 -> 265 bytes src/app/index.html | 20 ++++++++++++++++---- src/app/js/browser.js | 31 +++++++++++++++++++++++-------- src/app/js/mods.js | 6 ++++-- 12 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 src/app/icons/down.png create mode 100644 src/app/icons/downloads.png create mode 100644 src/app/icons/open.png create mode 100644 src/app/icons/redo.png create mode 100644 src/app/icons/search.png create mode 100644 src/app/icons/toggles.png create mode 100644 src/app/icons/trash.png diff --git a/src/app/css/grid.css b/src/app/css/grid.css index d44784b..188f32a 100644 --- a/src/app/css/grid.css +++ b/src/app/css/grid.css @@ -78,6 +78,7 @@ } .popup .misc button img { + margin: 0px; opacity: 0.6; width: var(--height); transform: scale(0.5); diff --git a/src/app/css/launcher.css b/src/app/css/launcher.css index 913e732..c43bce1 100644 --- a/src/app/css/launcher.css +++ b/src/app/css/launcher.css @@ -285,6 +285,40 @@ background: rgb(var(--red)) !important; } +button:has(img):not(img:only-child) { + top: 2px; + position: relative; + align-items: center; + display: inline-flex; + justify-content: center; +} + +button:has(img):not(img:only-child) img { + width: 1em; + height: 1em; + height: fit-content; + margin-right: calc(var(--padding) / 3) +} + +button:has(img):has(span) img { + opacity: 0.0; + transition: opacity 0.2s ease-in-out; +} + +button:has(img):has(span):hover img { + opacity: 1.0; +} + +button:has(img):has(span) span { + right: 0.8em; + position: relative; + transition: right 0.2s ease-in-out; +} + +button:has(img):has(span):hover span { + right: 0.1em; +} + button:disabled { opacity: 0.5; pointer-events: none; diff --git a/src/app/icons/down.png b/src/app/icons/down.png new file mode 100644 index 0000000..b1f9abd Binary files /dev/null and b/src/app/icons/down.png differ diff --git a/src/app/icons/downloads.png b/src/app/icons/downloads.png new file mode 100644 index 0000000..8b10638 Binary files /dev/null and b/src/app/icons/downloads.png differ diff --git a/src/app/icons/open.png b/src/app/icons/open.png new file mode 100644 index 0000000..8569c81 Binary files /dev/null and b/src/app/icons/open.png differ diff --git a/src/app/icons/redo.png b/src/app/icons/redo.png new file mode 100644 index 0000000..6777696 Binary files /dev/null and b/src/app/icons/redo.png differ diff --git a/src/app/icons/search.png b/src/app/icons/search.png new file mode 100644 index 0000000..698545f Binary files /dev/null and b/src/app/icons/search.png differ diff --git a/src/app/icons/toggles.png b/src/app/icons/toggles.png new file mode 100644 index 0000000..3f118d1 Binary files /dev/null and b/src/app/icons/toggles.png differ diff --git a/src/app/icons/trash.png b/src/app/icons/trash.png new file mode 100644 index 0000000..d915eb3 Binary files /dev/null and b/src/app/icons/trash.png differ diff --git a/src/app/index.html b/src/app/index.html index 9f0297d..016b708 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -290,10 +290,22 @@
%%gui.mods.title%%
- - - - + + + +
diff --git a/src/app/js/browser.js b/src/app/js/browser.js index caeb8c2..06dc244 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -232,7 +232,11 @@ var Browser = { return } - Browser.msg(``); + Browser.msg(``); + loadmore.addEventListener("click", () => { Browser.loadpkgs(pkgs); Browser.endoflist(! pkgs.length); @@ -261,18 +265,23 @@ var Browser = { Browser.loading(lang("gui.browser.no_results")); } }, - setbutton: (mod, string) => { + setbutton: (mod, string, icon) => { mod = normalize(mod); if (browserEntries.querySelector(`#mod-${mod}`)) { let elems = browserEntries.querySelectorAll(`.el#mod-${mod}`); for (let i = 0; i < elems.length; i++) { + if (icon) { + string = `` + + `${string}`; + } + elems[i].querySelector(".text button").innerHTML = string; } } else { let make = (str) => { if (browserEntries.querySelector(`#mod-${str}`)) { - return Browser.setbutton(str, string); + return Browser.setbutton(str, string, icon); } else { return false; } @@ -392,6 +401,7 @@ function BrowserEl(properties) { browserEntries.innerHTML = ""; } + let installicon = "downloads"; let installstr = lang("gui.browser.install"); let normalized_mods = []; @@ -400,9 +410,11 @@ function BrowserEl(properties) { } if (properties.pkg.local_version) { + installicon = "redo"; installstr = lang("gui.browser.reinstall"); if (properties.pkg.has_update) { + installicon = "downloads"; installstr = lang("gui.browser.update"); } } @@ -420,10 +432,12 @@ function BrowserEl(properties) {
${properties.title}
${properties.description}
@@ -454,9 +468,10 @@ function add_recent_toast(name, timeout = 3000) { ipcRenderer.on("removed-mod", (event, mod) => { setButtons(true); - Browser.setbutton(mod.name, lang("gui.browser.install")); + Browser.setbutton(mod.name, lang("gui.browser.install"), "downloads"); + if (mod.manifest_name) { - Browser.setbutton(mod.manifest_name, lang("gui.browser.install")); + Browser.setbutton(mod.manifest_name, lang("gui.browser.install"), "downloads"); } }) @@ -503,7 +518,7 @@ ipcRenderer.on("installed-mod", (event, mod) => { let name = mod.fancy_name || mod.name; setButtons(true); - Browser.setbutton(name, lang("gui.browser.reinstall")); + Browser.setbutton(name, lang("gui.browser.reinstall"), "redo"); if (mod.malformed) { new Toast({ diff --git a/src/app/js/mods.js b/src/app/js/mods.js index 445fc84..182bddf 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -55,10 +55,12 @@ mods.load = (mods_obj) => {
${mod_details.description}
-- cgit v1.2.3