From 12e3c9234de78af0ad05ef0272469911101f3c3a Mon Sep 17 00:00:00 2001 From: Commandtechno <68407783+Commandtechno@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:41:52 -0500 Subject: [PATCH] ViewIcons: Fix animated server pfps & profile edit button (#1350) fixes #1236 --- src/plugins/viewIcons.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx index 616d178ba..3bfe902f9 100644 --- a/src/plugins/viewIcons.tsx +++ b/src/plugins/viewIcons.tsx @@ -35,7 +35,7 @@ interface UserContextProps { } interface GuildContextProps { - guild: Guild; + guild?: Guild; } const settings = definePluginSettings({ @@ -100,7 +100,8 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U action={() => openImage(BannerStore.getGuildMemberAvatarURLSimple({ userId: user.id, avatar: memberAvatar, - guildId + guildId, + canAnimate: true }, true))} icon={ImageIcon} /> @@ -109,7 +110,10 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U )); }; -const GuildContext: NavContextMenuPatchCallback = (children, { guild: { id, icon, banner } }: GuildContextProps) => () => { +const GuildContext: NavContextMenuPatchCallback = (children, { guild }: GuildContextProps) => () => { + if(!guild) return; + + const { id, icon, banner } = guild; if (!banner && !icon) return; children.splice(-1, 0, ( @@ -181,8 +185,8 @@ export default definePlugin({ // style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl, match: /style:\{(?=backgroundImage:(\i&&\i)\?"url\("\.concat\((\i),)/, replace: - // onClick: () => shouldShowBanner && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0, - 'onClick:()=>$1&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,' + // onClick: () => shouldShowBanner && ev.target.style.backgroundImage && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0, + 'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,' } }, {