Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WAITP-1222: Marker layer #4686

Merged
merged 54 commits into from
Jul 10, 2023
Merged

Conversation

tcaiger
Copy link
Contributor

@tcaiger tcaiger commented Jun 28, 2023

Issue #: WAITP-1222: Marker layer

Changes:

  • Restructure the map controls to stop interferring with the map
  • Fix the useOnChangeMapOverlay util
  • Add MarkerLayer

Screenshots:

image

image


export const MarkerLayer = () => {
// set the map default overlay if there isn't one selected
useDefaultMapOverlay();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This effect could go anywhere and I'm not really sure where it should go. I put it here so that it's close to where the report data is used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it could go anywhere. I almost feel like it should be built into the links, but then it's possible a link could be navigated to in some way without a default overlay code being in it (e.g directly entering the url). Is useDefaultMapOverlay used anywhere else? Could it possibly be contained in the map component?

Copy link
Contributor

@alexd-bes alexd-bes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a massive amount of effort, nice work! I have a few questions but in general it's looking good, and awesome to be hitting this point in the project!

packages/tupaia-web/src/api/queries/useEntities.ts Outdated Show resolved Hide resolved
measureData: measureDataResponse,
};
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything wrong with this, but I guess it opens up the question, should we be doing this on the frontend, or should the endpoint be returning data the correct way? Or is this because dashboard reports and map overlay reports are both using the report endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good question. I just had a chat to Ethan about this and he said that this could be done on the backend but it would be messy because we use the report route is used fro both the map overlays and the dashboard items.

@@ -49,6 +49,7 @@ const Heading = styled(Typography).attrs({

const Container = styled(MaxHeightContainer)`
border-radius: 0 0 5px 5px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should save this border radius value somewhere (just the 5px) since it gets used a lot. I know not strictly part of this PR, but just something I thought of

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm we could do but I wonder if it would actually be helpful. I don't think that is something that would change in a theme for example.


export const MarkerLayer = () => {
// set the map default overlay if there isn't one selected
useDefaultMapOverlay();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it could go anywhere. I almost feel like it should be built into the links, but then it's possible a link could be navigated to in some way without a default overlay code being in it (e.g directly entering the url). Is useDefaultMapOverlay used anywhere else? Could it possibly be contained in the map component?

@tcaiger tcaiger requested a review from alexd-bes July 10, 2023 22:44
import { MapOverlayGroup, ProjectCode, EntityCode } from '../../types';

// When the map overlay groups change, update the default map overlay
export const useDefaultMapOverlay = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up refactoring this a little to try and make it clearer and moved it to the map component so it's easier to find.

entitiesData: any;
serieses: any;
hiddenValues: any;
interface processMeasureDataProps {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/

Suggested change
interface processMeasureDataProps {
interface ProcessMeasureDataProps {

}
export const processMeasureData = ({
measureData,
entitiesData,
serieses,
hiddenValues,
}: processMeasureData) => {
}: processMeasureDataProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}: processMeasureDataProps) => {
}: ProcessMeasureDataProps) => {

@alexd-bes
Copy link
Contributor

Nice work, thanks for doing all the types in this too!

@tcaiger tcaiger merged commit da68bb5 into epic-frontend-rewrite Jul 10, 2023
@tcaiger tcaiger deleted the waitp-1222-marker-layer branch July 10, 2023 23:48
alexd-bes added a commit that referenced this pull request Jul 11, 2023
* Working legend, grouped columns

* Apply location values

* Tidy up

* Styled column groups

* Tiy up files

* Add in hidden column titles

* Update hidden column title and config types

* Generate types

* Move the buttons

* WAITP-1222: Marker layer (#4686)

* setup map entites

* wip

* wip

* re organise project view

* mobile search layout

* polygon layer

* map animation

* fix mini map

* Update Dashboard.tsx

* merging

* map overlay data

* add Map overlays feature folder

* useEntitiesWithLocation

* typescript

* remove test code

* Update InteractivePolygon.tsx

* set up

* fix api

* marker layer

* Update types.d.ts

* update map layout

* wip map overlays

* revert map control layout

* Update useEntities.ts

* copy lesmis

* wip

* Update MapOverlayList.tsx

* default map overlay

* radius overlays

* navigate to dashboard

* fix scroll

* measure level

* refactor marker layer

* refactor useDefaultMapOverlay

* types

* useEntitiesByMeasureLevel

* Update MapOverlaysRoute.ts

* fix active entity

* Update MarkerLayer.tsx

* add comments

* Update processMeasureData.ts

* refactor useDefaultMapOverlay

* Fix merge conflicts

* Fix conflict errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>
alexd-bes added a commit that referenced this pull request Jul 11, 2023
* WAITP-1231 Working table

* WIP

* Update Matrix.tsx

* Fix linting errors

* convert to use context

* Update hooks

* Fix issues

* Reorganise files

* reorganise context

* Working table

* Remove enlarged cell modal file

* Working modal

* Tidy up

* Update MatrixCell.tsx

* Tidy up hover

* Add cell handling for markdown

* fix types

* WAITP-1231 fixes

* Delete types.d.ts

* Update index.ts

* Fix type error

* Waitp 1231 base matrix part 2 (#4714)

* Working legend, grouped columns

* Apply location values

* Tidy up

* Styled column groups

* Tiy up files

* Add in hidden column titles

* Update hidden column title and config types

* Generate types

* Move the buttons

* WAITP-1222: Marker layer (#4686)

* setup map entites

* wip

* wip

* re organise project view

* mobile search layout

* polygon layer

* map animation

* fix mini map

* Update Dashboard.tsx

* merging

* map overlay data

* add Map overlays feature folder

* useEntitiesWithLocation

* typescript

* remove test code

* Update InteractivePolygon.tsx

* set up

* fix api

* marker layer

* Update types.d.ts

* update map layout

* wip map overlays

* revert map control layout

* Update useEntities.ts

* copy lesmis

* wip

* Update MapOverlayList.tsx

* default map overlay

* radius overlays

* navigate to dashboard

* fix scroll

* measure level

* refactor marker layer

* refactor useDefaultMapOverlay

* types

* useEntitiesByMeasureLevel

* Update MapOverlaysRoute.ts

* fix active entity

* Update MarkerLayer.tsx

* add comments

* Update processMeasureData.ts

* refactor useDefaultMapOverlay

* Fix merge conflicts

* Fix conflict errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>
tcaiger added a commit that referenced this pull request Jul 12, 2023
* setup map entites

* wip

* wip

* re organise project view

* mobile search layout

* polygon layer

* map animation

* fix mini map

* Update Dashboard.tsx

* merging

* map overlay data

* add Map overlays feature folder

* useEntitiesWithLocation

* typescript

* remove test code

* Update InteractivePolygon.tsx

* set up

* fix api

* marker layer

* Update types.d.ts

* update map layout

* wip map overlays

* revert map control layout

* Update useEntities.ts

* copy lesmis

* wip

* Update MapOverlayList.tsx

* default map overlay

* radius overlays

* navigate to dashboard

* fix scroll

* measure level

* refactor marker layer

* refactor useDefaultMapOverlay

* types

* useEntitiesByMeasureLevel

* Update MapOverlaysRoute.ts

* fix active entity

* Update MarkerLayer.tsx

* add comments

* Update processMeasureData.ts

* refactor useDefaultMapOverlay
tcaiger added a commit that referenced this pull request Jul 12, 2023
* WAITP-1231 Working table

* WIP

* Update Matrix.tsx

* Fix linting errors

* convert to use context

* Update hooks

* Fix issues

* Reorganise files

* reorganise context

* Working table

* Remove enlarged cell modal file

* Working modal

* Tidy up

* Update MatrixCell.tsx

* Tidy up hover

* Add cell handling for markdown

* fix types

* WAITP-1231 fixes

* Delete types.d.ts

* Update index.ts

* Fix type error

* Waitp 1231 base matrix part 2 (#4714)

* Working legend, grouped columns

* Apply location values

* Tidy up

* Styled column groups

* Tiy up files

* Add in hidden column titles

* Update hidden column title and config types

* Generate types

* Move the buttons

* WAITP-1222: Marker layer (#4686)

* setup map entites

* wip

* wip

* re organise project view

* mobile search layout

* polygon layer

* map animation

* fix mini map

* Update Dashboard.tsx

* merging

* map overlay data

* add Map overlays feature folder

* useEntitiesWithLocation

* typescript

* remove test code

* Update InteractivePolygon.tsx

* set up

* fix api

* marker layer

* Update types.d.ts

* update map layout

* wip map overlays

* revert map control layout

* Update useEntities.ts

* copy lesmis

* wip

* Update MapOverlayList.tsx

* default map overlay

* radius overlays

* navigate to dashboard

* fix scroll

* measure level

* refactor marker layer

* refactor useDefaultMapOverlay

* types

* useEntitiesByMeasureLevel

* Update MapOverlaysRoute.ts

* fix active entity

* Update MarkerLayer.tsx

* add comments

* Update processMeasureData.ts

* refactor useDefaultMapOverlay

* Fix merge conflicts

* Fix conflict errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>
tcaiger added a commit that referenced this pull request Jul 12, 2023
* setup map entites

* wip

* wip

* re organise project view

* mobile search layout

* polygon layer

* map animation

* fix mini map

* Update Dashboard.tsx

* merging

* map overlay data

* add Map overlays feature folder

* useEntitiesWithLocation

* typescript

* remove test code

* Update InteractivePolygon.tsx

* set up

* fix api

* marker layer

* Update types.d.ts

* update map layout

* wip map overlays

* revert map control layout

* Update useEntities.ts

* copy lesmis

* wip

* Update MapOverlayList.tsx

* default map overlay

* radius overlays

* navigate to dashboard

* fix scroll

* measure level

* refactor marker layer

* refactor useDefaultMapOverlay

* types

* useEntitiesByMeasureLevel

* Update MapOverlaysRoute.ts

* fix active entity

* Update MarkerLayer.tsx

* add comments

* Update processMeasureData.ts

* refactor useDefaultMapOverlay
tcaiger added a commit that referenced this pull request Jul 12, 2023
* WAITP-1231 Working table

* WIP

* Update Matrix.tsx

* Fix linting errors

* convert to use context

* Update hooks

* Fix issues

* Reorganise files

* reorganise context

* Working table

* Remove enlarged cell modal file

* Working modal

* Tidy up

* Update MatrixCell.tsx

* Tidy up hover

* Add cell handling for markdown

* fix types

* WAITP-1231 fixes

* Delete types.d.ts

* Update index.ts

* Fix type error

* Waitp 1231 base matrix part 2 (#4714)

* Working legend, grouped columns

* Apply location values

* Tidy up

* Styled column groups

* Tiy up files

* Add in hidden column titles

* Update hidden column title and config types

* Generate types

* Move the buttons

* WAITP-1222: Marker layer (#4686)

* setup map entites

* wip

* wip

* re organise project view

* mobile search layout

* polygon layer

* map animation

* fix mini map

* Update Dashboard.tsx

* merging

* map overlay data

* add Map overlays feature folder

* useEntitiesWithLocation

* typescript

* remove test code

* Update InteractivePolygon.tsx

* set up

* fix api

* marker layer

* Update types.d.ts

* update map layout

* wip map overlays

* revert map control layout

* Update useEntities.ts

* copy lesmis

* wip

* Update MapOverlayList.tsx

* default map overlay

* radius overlays

* navigate to dashboard

* fix scroll

* measure level

* refactor marker layer

* refactor useDefaultMapOverlay

* types

* useEntitiesByMeasureLevel

* Update MapOverlaysRoute.ts

* fix active entity

* Update MarkerLayer.tsx

* add comments

* Update processMeasureData.ts

* refactor useDefaultMapOverlay

* Fix merge conflicts

* Fix conflict errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants