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

EDA Map Refactor: Introduce MapType plugin and implementations #424

Conversation

dmfalke
Copy link
Member

@dmfalke dmfalke commented Aug 15, 2023

See #106

This PR introduces the MapType plugin concept, and implementations for donut, bar, and bubble map types.

Some follow-up tasks that we might consider:

  • Additional cleanup and DRY up
  • This should be an issue... Change to "fly to" behavior. Currently it is only inspecting zoom level, but not center. That might be good enough. The rough idea for a bigger change is to change how this is triggered (not based on zoom level, but as callback that can be called by click handlers, etc), and to change the behavior such that the "global" markers are loaded in the background, the bounds are determined, and then the map is zoomed to those bounds.

TODO:

  • Extract maker logic from MapVEuMap component
  • Implement MapType plugins
  • Address code duplication <-- This is partially done, but more can easily be done in the future.
  • Add MapTypeHeaderDetails component for rendering counts
  • Reapply flyToMakers logic in each MapType

@dmfalke dmfalke changed the base branch from main to map-collection-variable-map-type August 15, 2023 17:23
Copy link
Member

@bobular bobular left a comment

Choose a reason for hiding this comment

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

This looks great. The diff's a bit confusing but I browsed the code and the relocation of the marker logic makes perfect sense. Is there anything specifically "dodgy" you want feedback on?

The stories all work fine - animations, flyTo etc.

@dmfalke
Copy link
Member Author

dmfalke commented Aug 18, 2023

If the animations look good, I'm happy. I cleaned up some useEffect hooks in SemanticMarkers, and ran into some animation issues with zooming in, at first. They should all be resolved now.

I plan to continue working on this branch. Next, and hopefully last, up is implementing the new MapTypePlugins.

@dmfalke dmfalke mentioned this pull request Aug 24, 2023
@dmfalke dmfalke changed the title WIP: Map collection variable map type map type refactor EDA Map Refactor: Introduce MapType plugin and implementations Oct 19, 2023
@dmfalke dmfalke marked this pull request as ready for review October 19, 2023 14:37
Copy link
Member

@bobular bobular left a comment

Choose a reason for hiding this comment

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

Should constrainLongitudeToMainWorld in SemanticMarkers be called from somewhere?
Ah... I see it has moved to MapVEuMap.tsx https://github.com/VEuPathDB/web-monorepo/pull/424/files#diff-67456b6e516de477c34a0a21ba3c750d25463bbc48e5059a0fe59bb8c44941efR465
So it looks like the SemanticMarkers version can be removed.

That's my review of the components part done. It's code-approved but pending testing. I'm going to submit this as a comment and review the eda side after lunch! I recently lost a big github issue draft so don't want the same to happen to my review.

packages/libs/components/src/map/SemanticMarkers.tsx Outdated Show resolved Hide resolved
@dmfalke
Copy link
Member Author

dmfalke commented Oct 23, 2023

Thanks for the review, @bobular. I will remove those out-of-date things.

Copy link
Member

@bobular bobular left a comment

Choose a reason for hiding this comment

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

Been through all the eda code and approve in principal but would like to test tomorrow ideally. Especiallly figure out the flyTo stuff.

)}
/>
</Switch>
<ReactQueryDevtools initialIsOpen={false} />
Copy link
Member

Choose a reason for hiding this comment

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

Does this stay in for ever? Was it true a week ago when I last tested?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. This has been false since I added it. The docs say that this will not appear in prod builds (>= qa). It can be useful, but the icon could get in the way, I suppose.

Related: it might make sense to move react-query to wdk-client or web-common.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I was wondering about the flower icon. Fingers crossed it goes away in prod - otherwise an easy fix!

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll know pretty quickly, since qa sites use a "prod" build

packages/libs/eda/src/lib/map/analysis/MapAnalysis.tsx Outdated Show resolved Hide resolved
@bobular
Copy link
Member

bobular commented Oct 24, 2023

Hi @dmfalke - I did some testing and thought we had to bring back the old (but flawed) flyto trigger until we fix it in the way you suggest in this PR's description. The problem was that the user might want to zoom out to zoom level 1 without it automatically zooming back in again.

See my suggestion here --> #566

…tion

Bring back old FlyTo behaviour for now
@bobular bobular self-requested a review October 24, 2023 17:43
Copy link
Member

@bobular bobular left a comment

Choose a reason for hiding this comment

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

I tested today and I'm sure there will be some rough edges to smooth (including handling of empty results which I am on the case for) but it's working great and I suggest we go for merge!

@bobular
Copy link
Member

bobular commented Oct 24, 2023

I think the header's Add filters button might be broken.

@dmfalke dmfalke merged commit f6e39d3 into map-collection-variable-map-type Oct 25, 2023
1 check passed
@dmfalke dmfalke deleted the map-collection-variable-map-type--map-type-refactor branch October 25, 2023 14:22
dmfalke added a commit that referenced this pull request Oct 25, 2023
* Restructure side menu to allow for subheadings. (#398)

Changes include:

- Variable renaming
- Modifications to finding active menu item and active map type
- Extracting some components

* Some additional clean-up (#401)

* Move active viz to realm of map type config, and clean up some labels and ids.

* Have the active map type config panel open by default

* Remember whether side panel is expanded on subsequent page loads

* Remove unused app state property

* EDA Map Refactor: Introduce MapType plugin and implementations (#424)

* Remove marker-related props from MapVEuMap

* Move onBoundsChange logic to MapVEuMap; clean up SemanticMarkers hooks

* Extract getDefaultAxisRange function

* Move DraggableLegendPanel to its own module

* Move defaultAnimation to its own module

* Extract bubble overlay config into its own function

* Add MapType plugins

* Wire up MapType plugins

* Use plugin displayName in menu

* Reduce props passed to getData

* Checkpoint commit using @tanstack/query

* Incorporate additional changes from merge

* Checkpoint

- Remove `getData` from `MapTypePlugin` interface
- Utilize react-query to cache network requests
- Move constants from index module, to prevent circular imports

* Add TODO

* Propagate selected values for marker configuration to overlay config

* Remove TODO

* Keep previous query data; use isFetching status to show spinners for maker data

* Introduce `MapTypeHeaderDetails` to `MapTypePlugin`

* Remove unused type

* Crudely reimplment "flyToData"

* Pass valueSpec to standalone map markers

* Remove out of date comments and code

* Remove old comments

* Move shared interface to shared file

* Use destructured variables

* bring back old behaviour for now

---------

Co-authored-by: Bob <uncoolbob@gmail.com>

* Post-merge updates

* Post-merge updates, 2

* Fix filter button in header

* remove file

---------

Co-authored-by: Connor Howington <connor.howington@gmail.com>
Co-authored-by: Bob <uncoolbob@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