From 019886ecb0df58e19f8e6e47d84634f8999aaf26 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Wed, 4 May 2022 14:59:46 -0700 Subject: [PATCH] disabled themes, replaced with styles --- src/i18n/en_US.json | 6 +++ src/i18n/source/en_US.json | 5 +++ src/main/base/browserwindow.ts | 9 ++++ src/renderer/less/pages.less | 17 +++++++ src/renderer/main/vueapp.js | 4 +- src/renderer/views/pages/installed-themes.ejs | 45 +++++++++++++------ src/renderer/views/pages/settings.ejs | 29 +----------- src/renderer/views/pages/themes-github.ejs | 16 +++---- 8 files changed, 77 insertions(+), 54 deletions(-) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index 78413968..7d85fa35 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -73,6 +73,7 @@ "term.viewAs": "View As", "term.viewAs.coverArt": "Cover Art", "term.viewAs.list": "List", + "term.dynamic": "Dynamic", "term.size": "Size", "term.size.normal": "Normal", "term.size.compact": "Compact", @@ -391,6 +392,11 @@ "settings.header.visual.theme.github.page": "Themes from GitHub", "settings.option.visual.theme.github.install.confirm": "Are you sure you want to install {{ repo }}?", "settings.prompt.visual.theme.github.URL": "Enter the URL of the theme you want to install", + "settings.prompt.visual.theme.uninstallTheme": "Are you sure you want to uninstall {{ theme }}?", + "settings.option.visual.theme.checkForUpdates": "Check for updates", + "settings.option.visual.theme.manageStyles": "Manage Styles", + "settings.option.visual.theme.uninstall": "Uninstall", + "settings.option.visual.theme.viewInfo": "View Info", "settings.notyf.visual.theme.install.success": "Theme installed successfully", "settings.notyf.visual.theme.install.error": "Theme installation failed", "settings.header.visual.plugin": "Plugin", diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index 71d7a3d8..7d85fa35 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -392,6 +392,11 @@ "settings.header.visual.theme.github.page": "Themes from GitHub", "settings.option.visual.theme.github.install.confirm": "Are you sure you want to install {{ repo }}?", "settings.prompt.visual.theme.github.URL": "Enter the URL of the theme you want to install", + "settings.prompt.visual.theme.uninstallTheme": "Are you sure you want to uninstall {{ theme }}?", + "settings.option.visual.theme.checkForUpdates": "Check for updates", + "settings.option.visual.theme.manageStyles": "Manage Styles", + "settings.option.visual.theme.uninstall": "Uninstall", + "settings.option.visual.theme.viewInfo": "View Info", "settings.notyf.visual.theme.install.success": "Theme installed successfully", "settings.notyf.visual.theme.install.error": "Theme installation failed", "settings.header.visual.plugin": "Plugin", diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index b920b66e..790b662f 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -715,6 +715,15 @@ export class BrowserWindow { // validate the path is in the themes directory try { if (path.startsWith(themesDir)) { + // get last dir in path, can be either / or \ and may have a trailing slash + const themeName = path.split(/[\\\/]/).pop() + if(themeName == "Themes" || themeName == "themes") { + BrowserWindow.win.webContents.send("theme-uninstalled", { + path: path, + status: 3 + }); + return + } // if path is directory, delete it if (lstatSync(path).isDirectory()) { await rmdirSync(path, { recursive: true }); diff --git a/src/renderer/less/pages.less b/src/renderer/less/pages.less index 6325faa1..652574a6 100644 --- a/src/renderer/less/pages.less +++ b/src/renderer/less/pages.less @@ -1180,6 +1180,23 @@ align-items: center; } + .handle { + height: 100%; + display: flex; + justify-content: center; + align-items: center; + } + + .list-group-item { + + &:hover { + cursor: grab; + } + &:active { + cursor: grabbing; + } + } + .removeItem { border : 0px; background : transparent; diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 12e37e89..e957839d 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -596,9 +596,7 @@ const app = new Vue({ }, async init() { let self = this - if (this.cfg.visual.theme != "default.less" && this.cfg.visual.theme != "") { - this.setTheme(this.cfg.visual.theme) - } + if (this.cfg.visual.styles.length != 0) { await this.reloadStyles() } diff --git a/src/renderer/views/pages/installed-themes.ejs b/src/renderer/views/pages/installed-themes.ejs index 5a23eb05..007e98ee 100644 --- a/src/renderer/views/pages/installed-themes.ejs +++ b/src/renderer/views/pages/installed-themes.ejs @@ -4,19 +4,25 @@