aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/viewIcons.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx
index 616d178..3bfe902 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,'
}
},
{