From c141b8e88493a1cdb4f470ce221d88060aa9d45e Mon Sep 17 00:00:00 2001 From: Elvy <88881326+EepyElvyra@users.noreply.github.com> Date: Sat, 11 Jan 2025 20:17:11 +0100 Subject: [PATCH] fixes --- .../components/SettingArrayComponent.tsx | 38 +++++++++---------- src/plugins/_api/settingArrays.tsx | 2 + 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/PluginSettings/components/SettingArrayComponent.tsx b/src/components/PluginSettings/components/SettingArrayComponent.tsx index 44b35a005b..5ccd2902c1 100644 --- a/src/components/PluginSettings/components/SettingArrayComponent.tsx +++ b/src/components/PluginSettings/components/SettingArrayComponent.tsx @@ -40,20 +40,20 @@ const GroupDMAvatars = findComponentByCodeLazy(".AvatarSizeSpecs[", "getAvatarUR const CloseIcon = () => { return ; }; const CheckMarkIcon = () => { return + d="M21.7 5.3a1 1 0 0 1 0 1.4l-12 12a1 1 0 0 1-1.4 0l-6-6a1 1 0 1 1 1.4-1.4L9 16.58l11.3-11.3a1 1 0 0 1 1.4 0Z" /> ; }; const SearchIcon = () => { return + strokeLinecap="round" strokeLinejoin="round"> ; @@ -72,15 +72,13 @@ export function SettingArrayComponent({ const [text, setText] = useState(""); useEffect(() => { - if (text === "") { - setError(null); - } else if (!isNaN(Number(text))) { + if (!isNaN(Number(text)) && text !== "") { if (text.length >= 18 && text.length <= 19) { setError(null); } else { setError("Invalid ID"); } - } else { + } else if (text !== "") { setError(null); } }, [text]); @@ -175,32 +173,32 @@ export function SettingArrayComponent({ switch (type) { case 2: return ; case 5: return ; case 13: return ; case 15: return ; default: // Text channel icon return ; } }; @@ -349,18 +347,18 @@ export function SettingArrayComponent({ > setText(v)} value={text} /> - {!isNaN(Number(text)) && text !== "" ? + {option.type === OptionType.ARRAY || (!isNaN(Number(text)) && text !== "") ? : diff --git a/src/plugins/_api/settingArrays.tsx b/src/plugins/_api/settingArrays.tsx index 8083a71a71..956385afad 100644 --- a/src/plugins/_api/settingArrays.tsx +++ b/src/plugins/_api/settingArrays.tsx @@ -72,6 +72,8 @@ function renderRegisteredPlugins(name: string, value: any) { function MakeContextCallback(name: "Guild" | "User" | "Channel"): NavContextMenuPatchCallback { return (children, props) => { + if (!registeredPlugins[OptionType.CHANNELS] && !registeredPlugins[OptionType.USERS] && !registeredPlugins[OptionType.GUILDS]) + return; const value = props[name.toLowerCase()]; if (!value) return; if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) return; // random shit like notification settings