Skip to content
Snippets Groups Projects

feat(bioentity:submaplink): allow user to open submap by clicking on submaplink on map

Merged Tadeusz Miesiąc requested to merge MIN-117/open-submaps-from-map-links into development
3 unresolved threads

Description

When clicking on submap link on map -> should display bioEntityDrawer with open submap button which allow user to open submap

image

Things done

  • implemented functionality
  • created hook openSubmap -> it should be used for gradual refactor for openSubmap functionality. We repeat code in few places in the app. Skipped replacing it cuz it would require to spend some more time
  • extracted part of BioEntity drawer to separate component - Annotation Item

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 60 });
    61 it('should render component when associated map model is found', () => {
    62 renderComponent({
    63 bioEntity: {
    64 ...BIOENTITY_INITIAL_STATE_MOCK,
    65 data: BIO_ENTITY_LINKING_TO_SUBMAP_DATA_MOCK,
    66 },
    67 drawer: {
    68 ...DRAWER_INITIAL_STATE,
    69 bioEntityDrawerState: {
    70 bioentityId: bioEntityContentFixture.bioEntity.id,
    71 },
    72 },
    73 models: {
    74 ...MODELS_INITIAL_STATE_MOCK,
    75 data: MODELS_MOCK_SHORT,
  • 3 import { mapOpenedMapsSelector } from '@/redux/map/map.selectors';
    4 import { openMapAndSetActive, setActiveMap } from '@/redux/map/map.slice';
    5 import { modelsDataSelector } from '@/redux/models/models.selectors';
    6 import { useCallback } from 'react';
    7
    8 type UseOpenSubmapProps = {
    9 modelId: number | undefined;
    10 modelName: string | undefined;
    11 };
    12
    13 type UseOpenSubmapReturnType = {
    14 openSubmap: () => void;
    15 isItPossibleToOpenMap: boolean;
    16 };
    17
    18 export const useOpenSubmap = ({
  • 12
    13 type UseOpenSubmapReturnType = {
    14 openSubmap: () => void;
    15 isItPossibleToOpenMap: boolean;
    16 };
    17
    18 export const useOpenSubmap = ({
    19 modelId,
    20 modelName,
    21 }: UseOpenSubmapProps): UseOpenSubmapReturnType => {
    22 const openedMaps = useAppSelector(mapOpenedMapsSelector);
    23 const models = useAppSelector(modelsDataSelector);
    24 const dispatch = useAppDispatch();
    25
    26 const isMapAlreadyOpened = openedMaps.some(map => map.modelId === modelId);
    27 const doesMapExist = models.some(model => model.idObject === modelId);
  • LGTM

    RFC: Please add tests to useOpenSubmaps if there's none

  • Adrian Orłów approved this merge request

    approved this merge request

  • Adrian Orłów mentioned in merge request !75 (merged)

    mentioned in merge request !75 (merged)

  • added 1 commit

    • fbb8ffcd - feat(bioentity:submaplink): allow user to open submap by clicking on submaplink on map

    Compare with previous version

  • Tadeusz Miesiąc enabled an automatic merge when the pipeline for fbb8ffcd succeeds

    enabled an automatic merge when the pipeline for fbb8ffcd succeeds

  • Tadeusz Miesiąc mentioned in commit 342e71d0

    mentioned in commit 342e71d0

  • Please register or sign in to reply
    Loading