ViewIcons: Fix animated server pfps & profile edit button (#1350)

fixes #1236
This commit is contained in:
Commandtechno 2023-06-27 15:41:52 -05:00 committed by GitHub
parent 1d8dcef394
commit 12e3c9234d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,'
}
},
{