Skip to content
Snippets Groups Projects

Overlay query params

Merged Tadeusz Miesiąc requested to merge overlay-query-params into development
5 unresolved threads

Description

Added overlayId to query params. From now it's possible to reload the app, send url to other users and open last active overlays

PR includes changes introduced in !92 (merged)

Edited by Tadeusz Miesiąc

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
23 24 }
24 25 return acc;
25 26 }, []);
27
28 export type OverlayIdAndOrder = {
29 idObject: number;
30 order: number;
31 };
32
33 export type OverlayOrder = {
34 id: number;
35 order: number;
36 calculatedOrder: number;
  • 25 26 }, []);
    27
    28 export type OverlayIdAndOrder = {
    29 idObject: number;
    30 order: number;
    31 };
    32
    33 export type OverlayOrder = {
    34 id: number;
    35 order: number;
    36 calculatedOrder: number;
    37 index: number;
    38 };
    39
    40 /** function calculates order of the function based on "order" property in ovarlay data. */
    41 export const calculateOvarlaysOrder = (
  • 1 import { roundToTwoDiggits } from '@/utils/number/roundToTwoDiggits';
    2
    3 type GetLatitudeCoordinatesProps = {
    4 width: number;
    5 nOverlays: number;
    • What is nOverlays? I couldn't find any description of this value. Is it number of overlays? If yes, IMO it's a good idea to add comment here or simply change variable name to numberOfOverlays

    • Please register or sign in to reply
  • 18 21 );
    19 22
    20 const FIRST_ENTITY_INDEX = 0;
    21 // TODO, improve selector when multioverlay algorithm comes in place
    22 23 export const overlayBioEntitiesForCurrentModelSelector = createSelector(
    23 24 overlayBioEntityDataSelector,
    25 activeOverlaysIdSelector,
    24 26 currentModelIdSelector,
    25 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    26 // @ts-ignore
    27 (data, currentModelId) => data[Object.keys(data)[FIRST_ENTITY_INDEX]]?.[currentModelId] ?? [], // temporary solution untill multioverlay algorithm comes in place
    27 (data, activeOverlaysIds, currentModelId) => {
    28 const result: OverlayBioEntityRender[] = [];
    29
    30 activeOverlaysIds.forEach(overlayId => {
    31 if (data[overlayId]?.[currentModelId]) {
  • 17 20 state => state.overlaysId,
    18 21 );
    19 22
    20 const FIRST_ENTITY_INDEX = 0;
    21 // TODO, improve selector when multioverlay algorithm comes in place
    22 23 export const overlayBioEntitiesForCurrentModelSelector = createSelector(
    23 24 overlayBioEntityDataSelector,
    25 activeOverlaysIdSelector,
    24 26 currentModelIdSelector,
    25 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    26 // @ts-ignore
    27 (data, currentModelId) => data[Object.keys(data)[FIRST_ENTITY_INDEX]]?.[currentModelId] ?? [], // temporary solution untill multioverlay algorithm comes in place
    27 (data, activeOverlaysIds, currentModelId) => {
    28 const result: OverlayBioEntityRender[] = [];
    29
    30 activeOverlaysIds.forEach(overlayId => {
    • Alternatively you may use pipe:

      1. Filter elements by isOverlayActiveForCurrentModel conditional
      2. Map to data[overlayId][currentModelId]
      3. Flat the array

      It would make this part of code more understandable at first sight

    • I will leave current solution. Can not filter element's because we store all the data as a key:value pairs

       data: {
          [overlayId: number]: {
            [modelId: number]: OverlayBioEntityRender[];
          };
        };
    • Please register or sign in to reply
  • Adrian Orłów
  • LGTM

    No RFCs

  • Adrian Orłów approved this merge request

    approved this merge request

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

    mentioned in merge request !92 (merged)

  • added 1 commit

    • 952151b0 - feat(overlays): added overlays to query params

    Compare with previous version

  • Tadeusz Miesiąc added 13 commits

    added 13 commits

    Compare with previous version

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

    enabled an automatic merge when the pipeline for 27ff5a17 succeeds

  • Tadeusz Miesiąc mentioned in commit 0fde397d

    mentioned in commit 0fde397d

  • Please register or sign in to reply
    Loading