From 11ad3bceb6cfc18d5eede9010db389fe403b65ae Mon Sep 17 00:00:00 2001 From: panbread <93918332+Panniku@users.noreply.github.com> Date: Thu, 3 Oct 2024 18:55:53 +0400 Subject: [PATCH] feat(WhoReacted): add toggle to disable click (#46) * squash (#8) squash * lil fix --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> --- src/plugins/whoReacted/index.tsx | 52 ++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx index 86b7ca71..b52929af 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -16,12 +16,13 @@ * along with this program. If not, see . */ +import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { sleep } from "@utils/misc"; import { Queue } from "@utils/Queue"; import { useForceUpdater } from "@utils/react"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import { ChannelStore, Constants, FluxDispatcher, React, RestAPI, Tooltip } from "@webpack/common"; import { CustomEmoji } from "@webpack/types"; @@ -97,11 +98,20 @@ function handleClickAvatar(event: React.MouseEvent) { event.stopPropagation(); } +const settings = definePluginSettings({ + avatarClick: { + description: "Toggle clicking avatars in reactions", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true + } +}); + export default definePlugin({ name: "WhoReacted", description: "Renders the avatars of users who reacted to a message", authors: [Devs.Ven, Devs.KannaDev, Devs.newwares], - + settings, patches: [ { find: ",reactionRef:", @@ -159,21 +169,37 @@ export default definePlugin({ const reactions = getReactionsWithQueue(message, emoji, type); const users = Object.values(reactions).filter(Boolean) as User[]; + console.log(settings.store.avatarClick); + return ( - - - + {settings.store.avatarClick ? ( + + + + ) : ( + + + + )} ); },