From fb473dafb8bea078b684f256f06e90ea125d4c94 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <p.gawron@atcomp.pl> Date: Thu, 7 Nov 2024 11:27:36 +0100 Subject: [PATCH] styling of the context menu --- CHANGELOG | 1 + .../ContextMenu/ContextMenu.component.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 38c549d2..53f55a86 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ minerva-front (19.0.0~alpha.0) stable; urgency=medium * Feature: support for matomo (#289) * Feature: allow plugin to not have a panel (#306) + * Feature: allow plugin to add menu option to context menu (#307) -- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Oct 2024 13:00:00 +0200 diff --git a/src/components/FunctionalArea/ContextMenu/ContextMenu.component.tsx b/src/components/FunctionalArea/ContextMenu/ContextMenu.component.tsx index 10f8f677..873cdf57 100644 --- a/src/components/FunctionalArea/ContextMenu/ContextMenu.component.tsx +++ b/src/components/FunctionalArea/ContextMenu/ContextMenu.component.tsx @@ -47,6 +47,7 @@ export const ContextMenu = (): React.ReactNode => { callback: (coordinates: ClickCoordinates, element: BioEntity | Reaction | undefined) => void, ) => { return () => { + dispatch(closeContextMenu()); return callback( { modelId, @@ -59,9 +60,6 @@ export const ContextMenu = (): React.ReactNode => { }; }; - // eslint-disable-next-line no-console - console.log(pluginContextMenu); - return ( <div className={twMerge( @@ -76,7 +74,7 @@ export const ContextMenu = (): React.ReactNode => { > <button className={twMerge( - 'cursor-pointer text-xs font-normal', + 'w-full cursor-pointer text-left text-xs font-normal', !isUnitProtIdAvailable() ? 'cursor-not-allowed text-greyscale-700' : '', )} onClick={handleOpenMolArtClick} @@ -87,13 +85,15 @@ export const ContextMenu = (): React.ReactNode => { </button> <hr /> <button - className={twMerge('cursor-pointer text-xs font-normal')} + className={twMerge('w-full cursor-pointer text-left text-xs font-normal')} onClick={handleAddCommentClick} type="button" data-testid="add-comment" > Add comment </button> + {pluginContextMenu.length && <hr />} + {pluginContextMenu.map(contextMenuEntry => ( <button key={contextMenuEntry.id} -- GitLab