From c45a9971bd44b2f1d46c28a895c4322c2b97b6b5 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <p.gawron@atcomp.pl> Date: Thu, 12 Dec 2024 13:36:24 +0100 Subject: [PATCH 1/4] "Reaction elements" header added --- .../ConnectedBioEntitiesList.component.tsx | 2 ++ .../Map/Drawer/ReactionDrawer/ReactionDrawer.component.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/src/components/Map/Drawer/ReactionDrawer/ConnectedBioEntitiesList/ConnectedBioEntitiesList.component.tsx b/src/components/Map/Drawer/ReactionDrawer/ConnectedBioEntitiesList/ConnectedBioEntitiesList.component.tsx index 04c02e45..ea016f66 100644 --- a/src/components/Map/Drawer/ReactionDrawer/ConnectedBioEntitiesList/ConnectedBioEntitiesList.component.tsx +++ b/src/components/Map/Drawer/ReactionDrawer/ConnectedBioEntitiesList/ConnectedBioEntitiesList.component.tsx @@ -4,6 +4,7 @@ import { } from '@/redux/bioEntity/bioEntity.selectors'; import { useAppSelector } from '@/redux/hooks/useAppSelector'; import { LoadingIndicator } from '@/shared/LoadingIndicator'; +import React from 'react'; import { BioEntitiesPinsListItem } from '../../SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem'; export const ConnectedBioEntitiesList = (): React.ReactNode => { @@ -17,6 +18,7 @@ export const ConnectedBioEntitiesList = (): React.ReactNode => { return ( <div> + <h3 className="mb-1 font-semibold">Reaction elements:</h3> {bioEntityData && bioEntityData.map(item => ( <BioEntitiesPinsListItem diff --git a/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.tsx b/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.tsx index 1965fc9d..7f7e8f00 100644 --- a/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.tsx +++ b/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.tsx @@ -52,6 +52,7 @@ export const ReactionDrawer = (): React.ReactNode => { {referencesGrouped.map(group => ( <ReferenceGroup key={group.source} group={group} /> ))} + <hr className="border-b border-b-divide" /> <ConnectedBioEntitiesList /> {isCommentAvailable && <div className="font-bold"> Comments</div>} {isCommentAvailable && -- GitLab From 573c76ba480e04cf5f8e6fbe29f801d5002300ed Mon Sep 17 00:00:00 2001 From: Piotr Gawron <p.gawron@atcomp.pl> Date: Thu, 12 Dec 2024 13:41:12 +0100 Subject: [PATCH 2/4] hide synonyms and references header if no data available --- .../BioEntitiesPinsListItem.component.tsx | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx index 852b85e7..901eb2e6 100644 --- a/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx +++ b/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx @@ -17,6 +17,7 @@ import { resetReactionsData } from '@/redux/reactions/reactions.slice'; import { getSearchData } from '@/redux/search/search.thunks'; import { twMerge } from 'tailwind-merge'; import { getTypeBySBOTerm } from '@/utils/bioEntity/getTypeBySBOTerm'; +import { ZERO } from '@/constants/common'; import { PinListBioEntity } from './BioEntitiesPinsListItem.types'; import { isPinWithCoordinates } from './BioEntitiesPinsListItem.utils'; @@ -99,25 +100,29 @@ export const BioEntitiesPinsListItem = ({ </span> </p> )} - <p className="font-bold leading-6"> - Synonyms: <span className="w-full font-normal">{pin.synonyms.join(', ')}</span> - </p> - <ul className="leading-6"> - <div className="font-bold">References:</div> - {pin.references.map(reference => { - return ( - <li key={reference.id} className="my-2 px-2"> - <a - href={reference.link ? reference.link : undefined} - target="_blank" - className="cursor-pointer text-primary-500 underline" - > - {reference.type} ({reference.resource}) - </a> - </li> - ); - })} - </ul> + {pin.synonyms.length > ZERO && ( + <p className="font-bold leading-6"> + Synonyms: <span className="w-full font-normal">{pin.synonyms.join(', ')}</span> + </p> + )} + {pin.references.length > ZERO && ( + <ul className="leading-6"> + <div className="font-bold">References:</div> + {pin.references.map(reference => { + return ( + <li key={reference.id} className="my-2 px-2"> + <a + href={reference.link ? reference.link : undefined} + target="_blank" + className="cursor-pointer text-primary-500 underline" + > + {reference.type} ({reference.resource}) + </a> + </li> + ); + })} + </ul> + )} </div> ); }; -- GitLab From 085c4836a721314e7dffeb66dea611e0c8ad4534 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <p.gawron@atcomp.pl> Date: Thu, 12 Dec 2024 14:19:56 +0100 Subject: [PATCH 3/4] use the same componetn for rendering reference in reaction elements --- .../BioEntitiesPinsListItem.component.tsx | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx index 901eb2e6..3f6e8439 100644 --- a/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx +++ b/src/components/Map/Drawer/SearchDrawerWrapper/BioEntitiesResultsList/BioEntitiesPinsList/BioEntitiesPinsListItem/BioEntitiesPinsListItem.component.tsx @@ -18,6 +18,8 @@ import { getSearchData } from '@/redux/search/search.thunks'; import { twMerge } from 'tailwind-merge'; import { getTypeBySBOTerm } from '@/utils/bioEntity/getTypeBySBOTerm'; import { ZERO } from '@/constants/common'; +import { AnnotationItem } from '@/components/Map/Drawer/BioEntityDrawer/AnnotationItem'; +import React from 'react'; import { PinListBioEntity } from './BioEntitiesPinsListItem.types'; import { isPinWithCoordinates } from './BioEntitiesPinsListItem.utils'; @@ -108,19 +110,16 @@ export const BioEntitiesPinsListItem = ({ {pin.references.length > ZERO && ( <ul className="leading-6"> <div className="font-bold">References:</div> - {pin.references.map(reference => { - return ( - <li key={reference.id} className="my-2 px-2"> - <a - href={reference.link ? reference.link : undefined} - target="_blank" - className="cursor-pointer text-primary-500 underline" - > - {reference.type} ({reference.resource}) - </a> - </li> - ); - })} + {pin.references.map(reference => ( + <li key={reference.id} className="ml-3"> + <AnnotationItem + key={reference.id} + type={reference.type} + link={reference.link} + resource={reference.resource} + /> + </li> + ))} </ul> )} </div> -- GitLab From e6ef7e64e07d6d81d81a9c8df7e963f39d8d4b16 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <p.gawron@atcomp.pl> Date: Thu, 12 Dec 2024 14:21:54 +0100 Subject: [PATCH 4/4] changelog updated --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ead072d8..7bae9c4c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,8 @@ minerva-front (19.0.0~alpha.0) stable; urgency=medium * Feature: allow plugin to hide opened panel (#309) * Feature: allow plugin to open left panel (#309) * Feature: allow to export current view for graphics export (#327) + * Small improvement: reaction element annotations use the same styling as + elements (#187) -- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Oct 2024 13:00:00 +0200 -- GitLab