From 315f4f4e587f1d15f69b94c0d1b89b42f43c5eaf Mon Sep 17 00:00:00 2001 From: Sqaaakoi Date: Sat, 4 May 2024 01:17:12 +1200 Subject: [PATCH] ReviewDB: add more context menu shortcuts to view reviews (#2382) Co-authored-by: V --- src/plugins/reviewDB/index.tsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx index 0c3578b07..bcd0f163f 100644 --- a/src/plugins/reviewDB/index.tsx +++ b/src/plugins/reviewDB/index.tsx @@ -35,13 +35,25 @@ import { getCurrentUserInfo, readNotification } from "./reviewDbApi"; import { settings } from "./settings"; import { showToast } from "./utils"; -const guildPopoutPatch: NavContextMenuPatchCallback = (children, props: { guild: Guild, onClose(): void; }) => { +const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild, onClose(): void; }) => { children.push( openReviewsModal(props.guild.id, props.guild.name)} + action={() => openReviewsModal(guild.id, guild.name)} + /> + ); +}; + +const userContextPatch: NavContextMenuPatchCallback = (children, { user }: { user?: User, onClose(): void; }) => { + if (!user) return; + children.push( + openReviewsModal(user.id, user.username)} /> ); }; @@ -53,7 +65,10 @@ export default definePlugin({ settings, contextMenus: { - "guild-header-popout": guildPopoutPatch + "guild-header-popout": guildPopoutPatch, + "guild-context": guildPopoutPatch, + "user-context": userContextPatch, + "user-profile-actions": userContextPatch }, patches: [