ViewIcons: Add context menu icons

This commit is contained in:
V 2023-05-13 23:49:47 +02:00
parent c062f9bdeb
commit f13f9e80a9
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
2 changed files with 7 additions and 1 deletions

View file

@ -18,6 +18,7 @@
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu"; import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { ImageIcon } from "@components/Icons";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { ModalRoot, ModalSize, openModal } from "@utils/modal"; import { ModalRoot, ModalSize, openModal } from "@utils/modal";
import { LazyComponent } from "@utils/react"; import { LazyComponent } from "@utils/react";
@ -90,6 +91,7 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U
id="view-avatar" id="view-avatar"
label="View Avatar" label="View Avatar"
action={() => openImage(BannerStore.getUserAvatarURL(user, true, 512))} action={() => openImage(BannerStore.getUserAvatarURL(user, true, 512))}
icon={ImageIcon}
/> />
{memberAvatar && ( {memberAvatar && (
<Menu.MenuItem <Menu.MenuItem
@ -100,6 +102,7 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U
avatar: memberAvatar, avatar: memberAvatar,
guildId guildId
}, true))} }, true))}
icon={ImageIcon}
/> />
)} )}
</Menu.MenuGroup> </Menu.MenuGroup>
@ -123,6 +126,7 @@ const GuildContext: NavContextMenuPatchCallback = (children, { guild: { id, icon
canAnimate: true canAnimate: true
})) }))
} }
icon={ImageIcon}
/> />
) : null} ) : null}
{banner ? ( {banner ? (
@ -135,6 +139,7 @@ const GuildContext: NavContextMenuPatchCallback = (children, { guild: { id, icon
banner, banner,
}, true)) }, true))
} }
icon={ImageIcon}
/> />
) : null} ) : null}
</Menu.MenuGroup> </Menu.MenuGroup>

View file

@ -37,9 +37,10 @@ export interface Menu {
id: string; id: string;
label: string; label: string;
action?(e: MouseEvent): void; action?(e: MouseEvent): void;
icon?: ComponentType<any>;
color?: string; color?: string;
render?: ComponentType; render?: ComponentType<any>;
onChildrenScroll?: Function; onChildrenScroll?: Function;
childRowHeight?: number; childRowHeight?: number;
listClassName?: string; listClassName?: string;