diff --git a/CHANGELOG b/CHANGELOG index d908b061e98da3dbf6027f35eabc695b7922c944..8c7d0f1236f8b23bc663c87c1a39f6916bc8ca95 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ minerva-front (18.0.8) stable; urgency=medium * Small improvement: support for links that should be opened immediately (#342) + * Bug fix: reaction annotations were showing invalid id (#345) * Bug fix: data overlay removal did not work (#333) * Bug fix: submap download did not download selected map (#337) * Bug fix: styling of notes contains original styling for links (#344) diff --git a/src/components/Map/Drawer/BioEntityDrawer/AnnotationItem/AnnotationItem.component.tsx b/src/components/Map/Drawer/BioEntityDrawer/AnnotationItem/AnnotationItem.component.tsx index 0ea1a10660e5e0e6bca9acf8069f5934fe438276..c4f59340444d5d4e33cab5058c3ceb4a746eb006 100644 --- a/src/components/Map/Drawer/BioEntityDrawer/AnnotationItem/AnnotationItem.component.tsx +++ b/src/components/Map/Drawer/BioEntityDrawer/AnnotationItem/AnnotationItem.component.tsx @@ -7,7 +7,6 @@ export const AnnotationItem = ({ link, type, resource }: AnnotationItemProps): J <a className="pl-3 text-sm font-normal" href={link?.toString()} target="_blank"> <div className="flex justify-between"> <span> - Source:{' '} <b className="font-semibold"> {type} ({resource}) </b> diff --git a/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx b/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx index dc452198c2398ef8fddadd6b15743c62c1e3d4d6..4f714969525b4dc62488ce62876de93ae377d543 100644 --- a/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx +++ b/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx @@ -49,6 +49,9 @@ export const BioEntityDrawer = (): React.ReactNode => { ).filter(modificationResidue => modificationResidue.state && modificationResidue.state !== ''); const isModificationAvailable = modificationResidues.length > ZERO; + // eslint-disable-next-line no-console + console.log(bioEntityData.references); + return ( <div className="h-calc-drawer" data-testid="bioentity-drawer"> <DrawerHeading diff --git a/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.test.tsx b/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.test.tsx index 1a635a0b5ac357f43962460455aa1c9683780c41..969a5d503c59d24d9f76e6db460a3f057748e970 100644 --- a/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.test.tsx +++ b/src/components/Map/Drawer/ReactionDrawer/ReactionDrawer.component.test.tsx @@ -59,7 +59,7 @@ describe('ReactionDrawer - component', () => { ); const referencesTextHref: [string, string][] = filteredReferences.map(ref => [ - `${ref.type} (${ref.id})`, + `${ref.type} (${ref.resource})`, ref.link as string, ]); diff --git a/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.test.tsx b/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.test.tsx index 838f1d50e65f88462e99d31713bcd202b4661dcf..273cc5c8695ce91b0f30a1a7c1b6ebcb7f885557 100644 --- a/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.test.tsx +++ b/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.test.tsx @@ -65,11 +65,13 @@ describe('ReactionDrawer - component', () => { { ...singleReference, annotatorClassName: 'source1', + resource: '24448649-1', id: 1, }, { ...singleReference, annotatorClassName: 'source1', + resource: '24448649-2', id: 2, }, ], @@ -80,6 +82,7 @@ describe('ReactionDrawer - component', () => { { ...singleReference, annotatorClassName: 'source2', + resource: '24448649-3', id: 3, }, ], @@ -88,7 +91,7 @@ describe('ReactionDrawer - component', () => { it.each(cases)('should show reference group with source=%s', (source, references) => { const referencesTextHref: [string, string][] = references.map(ref => [ - `${ref.type} (${ref.id})`, + `${ref.type} (${ref.resource})`, ref.link as string, ]); @@ -100,6 +103,8 @@ describe('ReactionDrawer - component', () => { }); referencesTextHref.forEach(([refText, href]) => { + // eslint-disable-next-line + console.log(refText, href); const linkReferenceSpan = screen.getByText(refText, { exact: false }); const linkReferenceAnchor = linkReferenceSpan.closest('a'); diff --git a/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.tsx b/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.tsx index aab45512ff1b06cdea9eebca337c83f27082939e..2a234f516acd6bdf6fb2e95cdb14fabbbee9f03e 100644 --- a/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.tsx +++ b/src/components/Map/Drawer/ReactionDrawer/ReferenceGroup/ReferenceGroup.component.tsx @@ -1,5 +1,6 @@ -import { Icon } from '@/shared/Icon'; import { ReferenceGroup as ReferenceGroupType } from '@/types/reference'; +import { AnnotationItem } from '@/components/Map/Drawer/BioEntityDrawer/AnnotationItem'; +import React from 'react'; import { DEFAULT_REFERENCE_SOURCE } from '../ReactionDrawer.constants'; export interface Props { @@ -9,13 +10,13 @@ export interface Props { export const ReferenceGroup = ({ group: { source, references } }: Props): JSX.Element => ( <> <h3 className="font-semibold">Source: {source || DEFAULT_REFERENCE_SOURCE}</h3> - {references.map(({ id, link, type }) => ( - <a key={id} href={link} target="_blank"> - <div className="flex justify-between"> - <span>{`${type} (${id})`}</span> - <Icon name="arrow" className="h-6 w-6 fill-font-500" /> - </div> - </a> + {references.map(reference => ( + <AnnotationItem + key={reference.id} + type={reference.type} + link={reference.link} + resource={reference.resource} + /> ))} </> ); diff --git a/src/models/bioEntitySchema.ts b/src/models/bioEntitySchema.ts index bd96f4c69fd80fce9992a7a28aea62a0fe23e541..81651507c1a32ffd32176de63ec7a8f7177d7355 100644 --- a/src/models/bioEntitySchema.ts +++ b/src/models/bioEntitySchema.ts @@ -13,7 +13,7 @@ import { submodelSchema } from './submodelSchema'; export const bioEntitySchema = z.object({ id: z.union([z.number().int().positive(), z.string()]), stringType: z.string(), - immediateLink: z.string().nullable(), + immediateLink: z.string().nullable().optional(), name: z.string(), elementId: z.string(), model: z.number(),