From db3186d6075e9ef0e99bf5dc0d5552337f19e1fa Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 10 Apr 2025 21:45:23 -0400 Subject: [PATCH] Patch Fixes --- src/equicordplugins/_core/equicordHelper.tsx | 7 -- .../betterBanReasons/index.tsx | 65 ++++++++++--------- .../betterBanReasons/style.css | 30 +++++++-- src/plugins/banger/index.ts | 2 +- 4 files changed, 59 insertions(+), 45 deletions(-) diff --git a/src/equicordplugins/_core/equicordHelper.tsx b/src/equicordplugins/_core/equicordHelper.tsx index bfd67722..0d7e9108 100644 --- a/src/equicordplugins/_core/equicordHelper.tsx +++ b/src/equicordplugins/_core/equicordHelper.tsx @@ -45,13 +45,6 @@ export default definePlugin({ replace: "return $1;" } ] - }, - { - find: '"Slate: Unable to find syntax characters"', - replacement: { - match: /((let )(\i)=\i\.indexOf\(\i,(\i)\)),/, - replace: "$1;if ($3 === -1) {return $4;}$2" - } } ] }); diff --git a/src/equicordplugins/betterBanReasons/index.tsx b/src/equicordplugins/betterBanReasons/index.tsx index 401235e1..3c01939c 100644 --- a/src/equicordplugins/betterBanReasons/index.tsx +++ b/src/equicordplugins/betterBanReasons/index.tsx @@ -4,53 +4,55 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import "./style.css"; +import "./styles.css"; import { definePluginSettings } from "@api/Settings"; +import { classNameFactory } from "@api/Styles"; +import { DeleteIcon, PlusIcon } from "@components/Icons"; import { Devs } from "@utils/constants"; import { getIntlMessage } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { Button, Forms, TextInput } from "@webpack/common"; +const cl = classNameFactory("vc-bbr-"); + function ReasonsComponent() { - const { reasons } = settings.use(["reasons"]); + const { reasons } = settings.store; return ( - {reasons.map((reason: string, index: number) => ( + {reasons.map((r, i) => (
{ - reasons[index] = v; - settings.store.reasons = [...reasons]; + reasons[i] = v; + settings.store.reasons = reasons; }} placeholder="Reason" />
))} - +
+ +
); } @@ -59,10 +61,10 @@ const settings = definePluginSettings({ reasons: { description: "Your custom reasons", type: OptionType.COMPONENT, - default: [""], + default: [] as string[], component: ReasonsComponent, }, - textInputDefault: { + isTextInputDefault: { type: OptionType.BOOLEAN, description: 'Shows a text input instead of a select menu by default. (Equivalent to clicking the "Other" option)' } @@ -74,9 +76,9 @@ export default definePlugin({ authors: [Devs.Inbestigator], patches: [ { - find: "#{intl::BAN_MULTIPLE_CONFIRM_TITLE}", + find: "#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}", replacement: [{ - match: /\[\{name:\i\.\i\.string\(\i\.\i#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}\).+?\}\]/, + match: /\[(\{((name|value):\i\.\i\.string\(\i\.\i\.\i\),?){2}\},?){3}\]/, replace: "$self.getReasons()" }, { @@ -86,17 +88,16 @@ export default definePlugin({ } ], getReasons() { - const reasons = settings.store.reasons.length - ? settings.store.reasons + const storedReasons = settings.store.reasons.filter((r: string) => r.trim()); + const reasons: string[] = storedReasons.length + ? storedReasons : [ getIntlMessage("BAN_REASON_OPTION_SPAM_ACCOUNT"), getIntlMessage("BAN_REASON_OPTION_HACKED_ACCOUNT"), - getIntlMessage("BAN_REASON_OPTION_BREAKING_RULES") + getIntlMessage("BAN_REASON_OPTION_BREAKING_RULES"), ]; return reasons.map(s => ({ name: s, value: s })); }, - getDefaultState() { - return settings.store.textInputDefault ? 1 : 0; - }, + getDefaultState: () => settings.store.isTextInputDefault ? 1 : 0, settings, }); diff --git a/src/equicordplugins/betterBanReasons/style.css b/src/equicordplugins/betterBanReasons/style.css index 02fb4bbf..a1ba64ea 100644 --- a/src/equicordplugins/betterBanReasons/style.css +++ b/src/equicordplugins/betterBanReasons/style.css @@ -1,11 +1,31 @@ .vc-bbr-reason-wrapper { display: grid; - padding: 0; - padding-bottom: 0.5rem; - gap: 0.5rem; - grid-template-columns: 6fr 1fr; + padding-bottom: 12px; + gap: 4px 12px; + align-items: center; + grid-template-columns: 1fr 24px; } .vc-bbr-remove-button { - height: 100%; + color: var(--text-muted); +} + +.vc-bbr-remove-button:hover { + color: var(--button-danger-background-hover); +} + +.vc-bbr-add-button { + justify-content: start !important; + border: 0; + padding: 2px 12px; + color: var(--text-muted) !important; + font-size: 16px; +} + +.vc-bbr-add-button div { + display: flex; + justify-content: start; + align-items: center; + gap: 12px; + margin: 0 !important; } diff --git a/src/plugins/banger/index.ts b/src/plugins/banger/index.ts index f13fd351..504091e4 100644 --- a/src/plugins/banger/index.ts +++ b/src/plugins/banger/index.ts @@ -36,7 +36,7 @@ export default definePlugin({ settings, patches: [ { - find: "#{intl::BAN_CONFIRM_TITLE}", + find: "#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}", replacement: { match: /src:\i\("?\d+"?\)/g, replace: "src:$self.source"