Skip to content
Snippets Groups Projects

Feat/pin available submaps

Merged Mateusz Bolewski requested to merge feat/pin-available-submaps into development
1 unresolved thread

Display Available in Submaps buttons and open submap on click.

Zrzut_ekranu_2023-12-11_o_01.34.45

There is a problem with test for displaying Available in Submaps, because I had to use two seperate datas for displaying these buttons (one is from chemical/drug, where we get list of submaps, and second is from models, where we get name of submaps). The problem is that if we use fixtures for both - data for chemicals and for models, then ids won't be equal.

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
13 19 export const PinsListItem = ({ name, type, pin }: PinsListItemProps): JSX.Element => {
20 const dispatch = useAppDispatch();
21 const openedMaps = useAppSelector(mapOpenedMapsSelector);
22 const models = useAppSelector(modelsDataSelector);
23 const availableSubmaps = getListOfAvailableSubmaps(pin, models);
24
25 const isMapAlreadyOpened = (modelId: number): boolean =>
26 openedMaps.some(map => map.modelId === modelId);
27
28 const onSubmapClick = (map: AvailableSubmaps): void => {
29 if (isMapAlreadyOpened(map.modelId)) {
30 dispatch(setActiveMap({ modelId: map.modelId }));
31 } else {
32 dispatch(openMapAndSetActive({ modelId: map.modelId, modelName: map.name }));
33 }
34 };
  • LGTM

    RFC - please add tests

  • Adrian Orłów approved this merge request

    approved this merge request

  • Mateusz Bolewski mentioned in commit f51cab97

    mentioned in commit f51cab97

  • Please register or sign in to reply
    Loading