From de95b048d3ee228c05f6471068a3c88153f1bbc5 Mon Sep 17 00:00:00 2001 From: x3rt Date: Sun, 25 Jan 2026 16:25:18 -0700 Subject: [PATCH] chore: KeywordNotify cleanup (#692) * remove commas from highlights in inbox * use Button Component for Clear All button * fix other buttons * cleanup try catches --- src/equicordplugins/keywordNotify/index.tsx | 33 ++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/equicordplugins/keywordNotify/index.tsx b/src/equicordplugins/keywordNotify/index.tsx index 479bf8943..6efddc43b 100644 --- a/src/equicordplugins/keywordNotify/index.tsx +++ b/src/equicordplugins/keywordNotify/index.tsx @@ -8,6 +8,7 @@ import "./style.css"; import { DataStore } from "@api/index"; import { definePluginSettings } from "@api/Settings"; +import { Button, TextButton } from "@components/Button"; import { Flex } from "@components/Flex"; import { FormSwitch } from "@components/FormSwitch"; import { Heading, HeadingTertiary } from "@components/Heading"; @@ -20,7 +21,7 @@ import { useForceUpdater } from "@utils/react"; import definePlugin, { OptionType } from "@utils/types"; import { Message } from "@vencord/discord-types"; import { findByCodeLazy, findCssClassesLazy } from "@webpack"; -import { Button, ChannelStore, FluxDispatcher, Select, SelectedChannelStore, TabBar, TextInput, Tooltip, UserStore, useState } from "@webpack/common"; +import { ChannelStore, FluxDispatcher, Select, SelectedChannelStore, TabBar, TextInput, Tooltip, UserStore, useState } from "@webpack/common"; import type { JSX, PropsWithChildren } from "react"; type IconProps = JSX.IntrinsicElements["svg"]; @@ -32,7 +33,6 @@ let interceptor: (e: any) => void; const recentMentionsPopoutClass = findCssClassesLazy("recentMentionsPopout"); const tabClass = findCssClassesLazy("inboxTitle", "tab", "expand", "expanded", "controlButton"); -const buttonClass = findCssClassesLazy("size36", "size32", "tertiary", "button"); const Popout = findByCodeLazy("getProTip", "canCloseAllMessages:"); const createMessageRecord = findByCodeLazy(".createFromServer(", ".isBlockedForMessage", "messageReference:"); const KEYWORD_ENTRIES_KEY = "KeywordNotify_keywordEntries"; @@ -73,7 +73,7 @@ function highlightKeywords(str: string, entries: Array) { let regexes: Array; try { regexes = entries.map(e => new RegExp(e.regex, "g" + (e.ignoreCase ? "i" : ""))); - } catch (err) { + } catch { return [str]; } @@ -86,8 +86,8 @@ function highlightKeywords(str: string, entries: Array) { return [ <> - {str.substring(0, idx)}, - {matches[0]}, + {str.substring(0, idx)} + {matches[0]} {str.substring(idx + matches[0].length)} ]; @@ -98,10 +98,8 @@ function Collapsible({ title, children }) { return (
- + {isOpen && children}
); @@ -145,8 +143,8 @@ function ListedIds({ listIds, setListIds }) { setListIds(values); update(); }} - look={Button.Looks.FILLED} - size={Button.Sizes.SMALL} + variant="none" + size="iconOnly" className={cl("delete")}> @@ -221,8 +219,8 @@ function KeywordEntries() { @@ -468,7 +466,7 @@ export default definePlugin({ let messageRecord: any; try { messageRecord = createMessageRecord(m); - } catch (err) { + } catch { return; } @@ -499,8 +497,9 @@ export default definePlugin({ return ( {({ onMouseLeave, onMouseEnter }) => ( -
{ @@ -509,7 +508,7 @@ export default definePlugin({ this.onUpdate(); }}> -
+ )}
);