From 7b0e6d68f61d0e37a87e7a409b5f385abec408e5 Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Thu, 2 Jul 2026 12:39:47 +0200 Subject: [PATCH] feat: add option to put Avatar somewhere else --- plugins/ChatboxAvatar/src/index.tsx | 25 +++++++++++++++++-------- plugins/ChatboxAvatar/src/settings.tsx | 10 ++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/plugins/ChatboxAvatar/src/index.tsx b/plugins/ChatboxAvatar/src/index.tsx index 9bd654c..651bd1d 100644 --- a/plugins/ChatboxAvatar/src/index.tsx +++ b/plugins/ChatboxAvatar/src/index.tsx @@ -10,6 +10,7 @@ const Flux = findByProps("useStateFromStores"); const { Pressable, View } = ReactNative; const ChatInputActions = find(m => m?.type?.displayName === "ChatInputActions") || findByName("ChatInputActions"); +const ChatInputSendButton = find(m => m?.type?.displayName === "ChatInputSendButton") || findByName("ChatInputSendButton"); const Avatar = findByProps("default", "AvatarSizes", "getStatusSize")?.default || findByProps("getStatusSize")?.default || findByName("Avatar"); @@ -99,31 +100,39 @@ export default { showStatusCutout: true, profileType: "server", showInDms: true, + position: "after_actions", }; for (const key in defaults) { plugin.storage[key] = plugin.storage[key] ?? defaults[key]; } - if (!ChatInputActions) return; - - if (ChatInputActions.type) { + if (ChatInputActions) { + const target = ChatInputActions.type || ChatInputActions; patches.push( - after("render", ChatInputActions.type, (args, ret) => { + after("render", target, (args, ret) => { + const position = getSetting("position", "after_actions"); + if (position === "near_send") return ret; return ( + {position === "before_actions" && } {ret} - + {position === "after_actions" && } ); }) ); - } else { + } + + if (ChatInputSendButton) { + const target = ChatInputSendButton.type || ChatInputSendButton; patches.push( - after("render", ChatInputActions, (args, ret) => { + after("render", target, (args, ret) => { + const position = getSetting("position", "after_actions"); + if (position !== "near_send") return ret; return ( - {ret} + {ret} ); }) diff --git a/plugins/ChatboxAvatar/src/settings.tsx b/plugins/ChatboxAvatar/src/settings.tsx index c53d716..1c0f364 100644 --- a/plugins/ChatboxAvatar/src/settings.tsx +++ b/plugins/ChatboxAvatar/src/settings.tsx @@ -47,6 +47,16 @@ export default function ChatboxAvatarSettings() { + + { set("position", v); forceUpdate(); }} + > + + + + +