From 3c5275047ac9273e024ecd47309b7ae4e280f075 Mon Sep 17 00:00:00 2001 From: dperolio Date: Mon, 21 Feb 2022 17:24:37 -0500 Subject: [PATCH] more misc minor code cleanup --- renderer/src/api/settings/store/Store.js | 3 +++ renderer/src/builtins/addon-manager/commands/disable.js | 1 - renderer/src/builtins/addon-manager/commands/enable.js | 1 - renderer/src/builtins/addon-manager/commands/index.js | 2 -- renderer/src/builtins/addon-manager/commands/install.js | 1 - renderer/src/builtins/addon-manager/commands/list.js | 1 - renderer/src/builtins/addon-manager/commands/manage.js | 1 - renderer/src/builtins/addon-manager/commands/reload.js | 1 - renderer/src/builtins/addon-manager/commands/settings.js | 1 - renderer/src/builtins/addon-manager/commands/stop.js | 1 - renderer/src/builtins/addon-manager/commands/uninstall.js | 1 - .../src/builtins/attributes/modules/components/Anchor.js | 8 ++++---- renderer/src/builtins/attributes/modules/index.js | 1 - renderer/src/entities/Plugin.js | 4 ++-- 14 files changed, 9 insertions(+), 18 deletions(-) diff --git a/renderer/src/api/settings/store/Store.js b/renderer/src/api/settings/store/Store.js index 09d8ceb1..71e79ff1 100644 --- a/renderer/src/api/settings/store/Store.js +++ b/renderer/src/api/settings/store/Store.js @@ -5,6 +5,9 @@ import { join } from 'path'; import { Directories, ActionTypes } from '@vizality/constants'; import { Flux, FluxDispatcher } from '@vizality/webpack'; +/** + * Failsafe to make sure a settings folder exists. + */ if (!existsSync(Directories.SETTINGS)) { mkdirSync(Directories.SETTINGS, { recursive: true }); } diff --git a/renderer/src/builtins/addon-manager/commands/disable.js b/renderer/src/builtins/addon-manager/commands/disable.js index c8855a87..877d753a 100644 --- a/renderer/src/builtins/addon-manager/commands/disable.js +++ b/renderer/src/builtins/addon-manager/commands/disable.js @@ -3,7 +3,6 @@ import { toPlural, toTitleCase } from '@vizality/util/string'; export default { command: 'disable', description: 'Disables a currently enabled addon, or disable all addons.', - icon: 'RadioEmpty', options: [ { name: 'id', required: true }, { name: 'all', required: true } diff --git a/renderer/src/builtins/addon-manager/commands/enable.js b/renderer/src/builtins/addon-manager/commands/enable.js index 4c6d69f0..02d66380 100644 --- a/renderer/src/builtins/addon-manager/commands/enable.js +++ b/renderer/src/builtins/addon-manager/commands/enable.js @@ -3,7 +3,6 @@ import { toPlural, toTitleCase } from '@vizality/util/string'; export default { command: 'enable', description: 'Enables a currently disabled addon, or enable all addons.', - icon: 'RadioSelected', options: [ { name: 'id', required: true }, { name: 'all', required: true } diff --git a/renderer/src/builtins/addon-manager/commands/index.js b/renderer/src/builtins/addon-manager/commands/index.js index d22f6ab1..e8f96cdb 100644 --- a/renderer/src/builtins/addon-manager/commands/index.js +++ b/renderer/src/builtins/addon-manager/commands/index.js @@ -26,8 +26,6 @@ export function registerCommands (type) { vizality.api.commands.registerCommand({ command: type, description: `Commands related to ${type}s.`, - // Not using Theme.svg icon here because it gets cut off - icon: type === 'plugin' ? 'Plugin' : 'Palette', options: [ { name: 'settings', required: true }, { name: 'manage', required: true }, diff --git a/renderer/src/builtins/addon-manager/commands/install.js b/renderer/src/builtins/addon-manager/commands/install.js index 33b0880f..b8d9d666 100644 --- a/renderer/src/builtins/addon-manager/commands/install.js +++ b/renderer/src/builtins/addon-manager/commands/install.js @@ -3,7 +3,6 @@ import { toPlural } from '@vizality/util/string'; export default { command: 'install', description: 'Installs an addon.', - icon: 'CloudDownload', options: [ { name: 'url', required: true }, { name: 'id', required: true } diff --git a/renderer/src/builtins/addon-manager/commands/list.js b/renderer/src/builtins/addon-manager/commands/list.js index d1921c06..f0365f4c 100644 --- a/renderer/src/builtins/addon-manager/commands/list.js +++ b/renderer/src/builtins/addon-manager/commands/list.js @@ -8,7 +8,6 @@ import { open as openModal } from '@vizality/modal'; export default { command: 'list', description: 'Displays a list of currently installed addons.', - icon: 'MoreInfo', options: [ { name: 'all', required: true }, { name: 'enabled', required: true }, diff --git a/renderer/src/builtins/addon-manager/commands/manage.js b/renderer/src/builtins/addon-manager/commands/manage.js index af324caf..1dd9bbfd 100644 --- a/renderer/src/builtins/addon-manager/commands/manage.js +++ b/renderer/src/builtins/addon-manager/commands/manage.js @@ -7,7 +7,6 @@ import { FormTitle } from '@vizality/components'; export default { command: 'manage', description: 'Allows you to manage your addons directly in chat.', - icon: 'Wrench', executor (_, type) { const result = { type: 'rich', diff --git a/renderer/src/builtins/addon-manager/commands/reload.js b/renderer/src/builtins/addon-manager/commands/reload.js index 088e64c7..68c53763 100644 --- a/renderer/src/builtins/addon-manager/commands/reload.js +++ b/renderer/src/builtins/addon-manager/commands/reload.js @@ -3,7 +3,6 @@ import { toPlural, toTitleCase } from '@vizality/util/string'; export default { command: 'reload', description: 'Reloads a currently enabled addon, or reload all addons.', - icon: 'Retry', options: [ { name: 'id', required: true }, { name: 'all', required: true } diff --git a/renderer/src/builtins/addon-manager/commands/settings.js b/renderer/src/builtins/addon-manager/commands/settings.js index a3f52a2e..cece94d6 100644 --- a/renderer/src/builtins/addon-manager/commands/settings.js +++ b/renderer/src/builtins/addon-manager/commands/settings.js @@ -6,7 +6,6 @@ import { FormTitle, Anchor } from '@vizality/components'; export default { command: 'settings', description: `Allows you to change an addon's settings directly in chat.`, - icon: 'Settings', options: [ { name: 'id', required: true } ], diff --git a/renderer/src/builtins/addon-manager/commands/stop.js b/renderer/src/builtins/addon-manager/commands/stop.js index 771da9fd..736f8010 100644 --- a/renderer/src/builtins/addon-manager/commands/stop.js +++ b/renderer/src/builtins/addon-manager/commands/stop.js @@ -3,7 +3,6 @@ import { toPlural } from '@vizality/util/string'; export default { command: 'stop', description: 'Temporarily disables all addons. Reload Discord to restore.', - icon: 'NotAllowed', async executor (_, type) { try { await vizality.manager[toPlural(type)].stop(); diff --git a/renderer/src/builtins/addon-manager/commands/uninstall.js b/renderer/src/builtins/addon-manager/commands/uninstall.js index 0eac2e3d..76e71523 100644 --- a/renderer/src/builtins/addon-manager/commands/uninstall.js +++ b/renderer/src/builtins/addon-manager/commands/uninstall.js @@ -3,7 +3,6 @@ import { toPlural, toTitleCase } from '@vizality/util/string'; export default { command: 'uninstall', description: 'Uninstalls an addon.', - icon: 'Trash', options: [ { name: 'id', required: true } ], diff --git a/renderer/src/builtins/attributes/modules/components/Anchor.js b/renderer/src/builtins/attributes/modules/components/Anchor.js index 4dddf651..84b8cf42 100644 --- a/renderer/src/builtins/attributes/modules/components/Anchor.js +++ b/renderer/src/builtins/attributes/modules/components/Anchor.js @@ -29,7 +29,7 @@ export default builtin => { } /** - * + * */ if (props.href?.startsWith('#')) { props.onClick = evt => { @@ -62,7 +62,7 @@ export default builtin => { } /** - * Force Vizality route links open within the app. + * Force Vizality route links to open within the app. */ if (vizalityRegex.test(props.href)) { const route = props.href?.replace(discordRegex, ''); @@ -77,7 +77,7 @@ export default builtin => { } /** - * Force Vizality protocol links open within the app. + * Force Vizality protocol links to open within the app. */ if (vizalityProtocolRegex.test(props.href)) { const route = props.href?.replace(vizalityProtocolRegex, ''); @@ -92,7 +92,7 @@ export default builtin => { } /* - * Force user links open in user profile modals within the app. + * Force user links to open in user profile modals within the app. */ if (userRegex.test(props.href)) { const userId = props.href?.replace(userRegex, ''); diff --git a/renderer/src/builtins/attributes/modules/index.js b/renderer/src/builtins/attributes/modules/index.js index b66eef3e..1f67841d 100644 --- a/renderer/src/builtins/attributes/modules/index.js +++ b/renderer/src/builtins/attributes/modules/index.js @@ -30,7 +30,6 @@ export * as Avatar from './components/Avatar'; export * as Role from './components/Role'; // --- Popouts export * as UserModal from './components/modals/User'; - export * as ImageCarouselModal from './components/modals/ImageCarousel'; // --- Popouts export * as UserPopouts from './components/popouts/User'; diff --git a/renderer/src/entities/Plugin.js b/renderer/src/entities/Plugin.js index 3e92f3b0..6735fd0a 100644 --- a/renderer/src/entities/Plugin.js +++ b/renderer/src/entities/Plugin.js @@ -1,4 +1,4 @@ -import { log, warn, error, MODULES } from '@vizality/util/logger'; +import { log, warn, error, PRESET_LABELS } from '@vizality/util/logger'; import { toPlural, toTitleCase } from '@vizality/util/string'; import { resolveCompiler } from '@vizality/compilers'; import { unpatchAll } from '@vizality/patcher'; @@ -255,7 +255,7 @@ export default class Plugin extends Updatable { /** * Set up a shorthand for the watcher labels used below. */ - const watcherLabels = this._labels.concat({ text: 'Watcher', color: MODULES.watcher.toString() }); + const watcherLabels = this._labels.concat({ text: 'Watcher', color: PRESET_LABELS.watcher.toString() }); /** *