From 79759ffa7e59a7d797626b0abd3bb2b288a727de Mon Sep 17 00:00:00 2001 From: theo Date: Mon, 17 Aug 2026 17:23:54 +0100 Subject: [PATCH] fix Vencord context menu entries having no icon (#4518) --- packages/discord-types/src/menu.d.ts | 17 +++++++++++++++++ src/plugins/betterRoleContext/index.tsx | 4 ++++ src/plugins/biggerStreamPreview/index.tsx | 1 + src/plugins/copyUserURLs/index.tsx | 1 + .../ui/components/DecorationContextMenu.tsx | 2 ++ src/plugins/newGuildSettings/index.tsx | 1 + .../components/RolesAndUsersPermissions.tsx | 2 ++ src/plugins/reviewDB/index.tsx | 2 ++ src/plugins/spotifyControls/PlayerComponent.tsx | 5 +++++ src/plugins/translate/index.tsx | 1 + src/plugins/unsuppressEmbeds/index.tsx | 1 + src/plugins/viewIcons/index.tsx | 6 ++++++ src/plugins/viewRaw/index.tsx | 2 ++ 13 files changed, 45 insertions(+) diff --git a/packages/discord-types/src/menu.d.ts b/packages/discord-types/src/menu.d.ts index 78810296a..d083dc906 100644 --- a/packages/discord-types/src/menu.d.ts +++ b/packages/discord-types/src/menu.d.ts @@ -2,6 +2,22 @@ import type { ComponentType, CSSProperties, ForwardRefRenderFunction, MouseEvent type RC = ComponentType>>; +type LeadingAccessory = + | { + type: "icon"; + icon: ComponentType; + } + | { + type: "emoji"; + emojiId?: string; + src?: string; + animated?: boolean; + } + | { + type: "image"; + src: string; + }; + export interface Menu { Menu: RC<{ navId: string; @@ -20,6 +36,7 @@ export interface Menu { label: ReactNode; action?(e: MouseEvent): void; icon?: ComponentType; + leadingAccessory?: LeadingAccessory; color?: string; render?: ComponentType; diff --git a/src/plugins/betterRoleContext/index.tsx b/src/plugins/betterRoleContext/index.tsx index 53f603dc3..e45183ff7 100644 --- a/src/plugins/betterRoleContext/index.tsx +++ b/src/plugins/betterRoleContext/index.tsx @@ -90,6 +90,7 @@ export function buildExtraRoleContextMenuItems(role: Role, guild: Guild, popoutR GuildSettingsActions.selectRole(role.id); }} icon={PencilIcon} + leadingAccessory={{ type: "icon", icon: PencilIcon }} /> ), role.colorString && ( @@ -99,6 +100,7 @@ export function buildExtraRoleContextMenuItems(role: Role, guild: Guild, popoutR label="Copy Role Color" action={() => copyToClipboard(role.colorString!)} icon={AppearanceIcon} + leadingAccessory={{ type: "icon", icon: AppearanceIcon }} /> ) ].filter(isTruthy); @@ -117,6 +119,7 @@ export function buildExtraRoleContextMenuItems(role: Role, guild: Guild, popoutR }); }} icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> ), popoutRef && ( @@ -185,6 +188,7 @@ export function openRoleContextMenu(event: React.MouseEvent, { guil id="vc-better-role-context-copy-role-id" label={getIntlMessage("COPY_ID_ROLE")} icon={CopyIdIcon} + leadingAccessory={{ type: "icon", icon: CopyIdIcon }} action={() => copyToClipboard(role.id)} /> diff --git a/src/plugins/biggerStreamPreview/index.tsx b/src/plugins/biggerStreamPreview/index.tsx index a1e8959c9..71b5a9f0e 100644 --- a/src/plugins/biggerStreamPreview/index.tsx +++ b/src/plugins/biggerStreamPreview/index.tsx @@ -70,6 +70,7 @@ export const addViewStreamContext: NavContextMenuPatchCallback = (children, { us label="View Stream Preview" id="view-stream-preview" icon={ScreenshareIcon} + leadingAccessory={{ type: "icon", icon: ScreenshareIcon }} action={() => stream && handleViewPreview(stream)} disabled={!stream} /> diff --git a/src/plugins/copyUserURLs/index.tsx b/src/plugins/copyUserURLs/index.tsx index 07ac0721d..5ca6f990c 100644 --- a/src/plugins/copyUserURLs/index.tsx +++ b/src/plugins/copyUserURLs/index.tsx @@ -39,6 +39,7 @@ const UserContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: U label="Copy User URL" action={() => copyToClipboard(``)} icon={LinkIcon} + leadingAccessory={{ type: "icon", icon: LinkIcon }} /> ); }; diff --git a/src/plugins/decor/ui/components/DecorationContextMenu.tsx b/src/plugins/decor/ui/components/DecorationContextMenu.tsx index a1609bfdf..5addafe49 100644 --- a/src/plugins/decor/ui/components/DecorationContextMenu.tsx +++ b/src/plugins/decor/ui/components/DecorationContextMenu.tsx @@ -23,6 +23,7 @@ export default function DecorationContextMenu({ decoration }: { decoration: Deco id={cl("decoration-context-menu-copy-hash")} label="Copy Decoration Hash" icon={CopyIcon} + leadingAccessory={{ type: "icon", icon: CopyIcon }} action={() => copyToClipboard(decoration.hash)} /> {decoration.authorId === UserStore.getCurrentUser().id && @@ -31,6 +32,7 @@ export default function DecorationContextMenu({ decoration }: { decoration: Deco label="Delete Decoration" color="danger" icon={DeleteIcon} + leadingAccessory={{ type: "icon", icon: DeleteIcon }} action={() => openModal(props => ( NavContextMenuPatchCallb label="Apply NewGuildSettings" id="vc-newguildsettings-apply" icon={shouldAddIcon ? CogWheel : void 0} + leadingAccessory={shouldAddIcon ? { type: "icon", icon: CogWheel } : void 0} action={() => applyDefaultSettings(guild.id)} /> ); diff --git a/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx b/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx index 7e573c54d..9279b0dd7 100644 --- a/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx +++ b/src/plugins/permissionsViewer/components/RolesAndUsersPermissions.tsx @@ -230,6 +230,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str id={cl("copy-role-id")} label={getIntlMessage("COPY_ID_ROLE")} icon={CopyIdIcon} + leadingAccessory={{ type: "icon", icon: CopyIdIcon }} action={() => copyToClipboard(roleId)} /> @@ -240,6 +241,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str id={cl("view-as-role")} label={getIntlMessage("VIEW_AS_ROLE")} icon={ViewAsRoleIcon} + leadingAccessory={{ type: "icon", icon: ViewAsRoleIcon }} action={() => { onClose(); FluxDispatcher.dispatch({ diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx index da3e17e69..59dc13c46 100644 --- a/src/plugins/reviewDB/index.tsx +++ b/src/plugins/reviewDB/index.tsx @@ -50,6 +50,7 @@ const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { gu label="View Reviews" id="vc-rdb-server-reviews" icon={OpenExternalIcon} + leadingAccessory={{ type: "icon", icon: OpenExternalIcon }} action={() => openReviewsModal(guild.id, guild.name, ReviewType.Server)} /> ); @@ -62,6 +63,7 @@ const userContextPatch: NavContextMenuPatchCallback = (children, { user }: { use label="View Reviews" id="vc-rdb-user-reviews" icon={OpenExternalIcon} + leadingAccessory={{ type: "icon", icon: OpenExternalIcon }} action={() => openReviewsModal(user.id, user.username, ReviewType.User)} /> ); diff --git a/src/plugins/spotifyControls/PlayerComponent.tsx b/src/plugins/spotifyControls/PlayerComponent.tsx index f52ff43ea..ee95eefed 100644 --- a/src/plugins/spotifyControls/PlayerComponent.tsx +++ b/src/plugins/spotifyControls/PlayerComponent.tsx @@ -84,18 +84,21 @@ function CopyContextMenu({ name, type, path }: { type: string; name: string; pat label={`Copy ${type} Name`} action={() => copyWithToast(name)} icon={CopyIcon} + leadingAccessory={{ type: "icon", icon: CopyIcon }} /> copyWithToast("https://open.spotify.com" + path)} icon={LinkIcon} + leadingAccessory={{ type: "icon", icon: LinkIcon }} /> SpotifyStore.openExternal(path)} icon={OpenExternalIcon} + leadingAccessory={{ type: "icon", icon: OpenExternalIcon }} /> ); @@ -225,6 +228,7 @@ function AlbumContextMenu({ track }: { track: Track; }) { label="Open Album" action={() => SpotifyStore.openExternal(`/album/${track.album.id}`)} icon={OpenExternalIcon} + leadingAccessory={{ type: "icon", icon: OpenExternalIcon }} /> openImageModal(track.album.image)} icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> { const trans = await translate("received", content); handleTranslate(message.id, trans); diff --git a/src/plugins/unsuppressEmbeds/index.tsx b/src/plugins/unsuppressEmbeds/index.tsx index 79ddaac70..f0cfb8db6 100644 --- a/src/plugins/unsuppressEmbeds/index.tsx +++ b/src/plugins/unsuppressEmbeds/index.tsx @@ -49,6 +49,7 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = ( label={isEmbedSuppressed ? "Unsuppress Embeds" : "Suppress Embeds"} color={isEmbedSuppressed ? undefined : "danger"} icon={isEmbedSuppressed ? ImageVisible : ImageInvisible} + leadingAccessory={{ type: "icon", icon: isEmbedSuppressed ? ImageVisible : ImageInvisible }} action={() => RestAPI.patch({ url: Constants.Endpoints.MESSAGE(channel.id, messageId), diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx index c3c830360..409eb5a5b 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -117,6 +117,7 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U label="View Avatar" action={() => openAvatar(IconUtils.getUserAvatarURL(user, true))} icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> {memberAvatar && ( )} {avatarDecoration && ( @@ -141,6 +143,7 @@ const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: U canAnimate: true })!)} icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> )} @@ -167,6 +170,7 @@ const GuildContext: NavContextMenuPatchCallback = (children, { guild }: GuildCon })!) } icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> ) : null} {banner ? ( @@ -177,6 +181,7 @@ const GuildContext: NavContextMenuPatchCallback = (children, { guild }: GuildCon openBanner(IconUtils.getGuildBannerURL(guild, true)!) } icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> ) : null} @@ -195,6 +200,7 @@ const GroupDMContext: NavContextMenuPatchCallback = (children, { channel }: Grou openAvatar(IconUtils.getChannelIconURL(channel)!) } icon={ImageIcon} + leadingAccessory={{ type: "icon", icon: ImageIcon }} /> )); diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx index 9d3617812..b7c21d0d4 100644 --- a/src/plugins/viewRaw/index.tsx +++ b/src/plugins/viewRaw/index.tsx @@ -151,6 +151,7 @@ function MakeContextCallback(name: "Guild" | "Role" | "User" | "Channel" | "Mess label="View Raw" action={action} icon={CopyRawIcon} + leadingAccessory={{ type: "icon", icon: CopyRawIcon }} /> ); }; @@ -169,6 +170,7 @@ const devContextCallback: NavContextMenuPatchCallback = (children, { id }: { id: label="View Raw" action={() => openViewRawModal(JSON.stringify(role, null, 4), "Role")} icon={CopyRawIcon} + leadingAccessory={{ type: "icon", icon: CopyRawIcon }} /> ); };