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

Station groups #89

Merged
merged 11 commits into from
Oct 4, 2023
Merged

Station groups #89

merged 11 commits into from
Oct 4, 2023

Conversation

GalMunGral
Copy link
Contributor

Changes:

  • This depends on the API changes in Station groups challenger-api#68
  • Added the left sidebar, which includes station grouping and summary cards for ocean regions and stations.
  • Changed the map zooming/flying logic to work with left sidebar menus. Based on the design, the current interaction logic consists of three states (not sure if this is Fangyu's original intent):
    • State 1: top-level summary view for FAO areas. The map is zoomed out to include all filtered stations.
    • State 2: Focused view on a single FAO area. The map is zoomed in to include only stations in that area. Click on a different icon in the horizontal scroll menu on the top switches the focus to the corresponding FAO area. Clicking on the currently selected/highlighted icon sends the user back to State 1.
    • State 3: Station detail view. The state can be entered by clicking on the "view more" button on any station card from State 2, or by clicking on station pins on the map from any state. Once you are in State 3, clicking on the station pin or the "back" button in the detail panel takes you to State 2. The horizontal scroll menu for FAO areas behaves in the same way as in State 2.
  • Reenabled clustering as it seems to be involved in the interaction as well -- You should be able to expand clusters until you can click on a single station, which will then take you straight to State 3.
  • Updated feature styles on the map, and changed the basemap to World Imagery so there is enough contrast between the station/cluster labels and the background.

Issues:

  • I added automatic scrolling to make sure the highlighted FAO area and station in the menu are actually visible, otherwise there is no feedback when you click on the station pin or the "prev"/"next" buttons in the detail view because all the changes in UI are hidden. But there is a bug in Chrome that doesn't let you scroll two things at once, so I made a hacky solution around it. I'm not sure if it always works.
  • I believe Fangyu didn't make all the icons for FAO areas, so for now I'm actually generating those contours on the fly by rendering the GeoJSON feature of each FAO area onto a tiny map and caching the image data extracted from the canvas for subsequent renders. I think this is completely unnecessary and we should just use static PNG or SVG images. We should remove this hack once Fangyu has time to make those icons.

@@ -10,17 +11,24 @@ import {
MapActionDispatcherContext
} from '../../store/contexts';
import { layerStyles, mapStyle } from '../Map/styles';
import { directionArrow, pulsingDot, runWhenReady } from '../Map/utils';
import { getFeatureBounds, loadStaionIcons, runWhenReady } from '../Map/utils';
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a typo in loadStaionIcons, it should be loadStationIcons.

station: newSelectedStation
});
selectedStationRef.current = newSelectedStation;
const evenListener = (e: MapLayerEventType['click']) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in evenListener, I think it should be eventListener

Copy link
Contributor

@Rashmil-1999 Rashmil-1999 left a comment

Choose a reason for hiding this comment

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

Everything looks good and works fine. I found a bug not related to this PR but in general which I will create a separate issue. Please address the typo and I will merge it.

@Rashmil-1999
Copy link
Contributor

Great Work!!

@Rashmil-1999
Copy link
Contributor

Regarding the SVG or PNG icons, I will talk to Chris about it in the meeting. but by any chance, is it possible for us to output the SVG files?

@Rashmil-1999 Rashmil-1999 merged commit 7d15660 into develop Oct 4, 2023
1 check passed
@GalMunGral
Copy link
Contributor Author

GalMunGral commented Oct 4, 2023

Regarding the SVG or PNG icons, I will talk to Chris about it in the meeting. but by any chance, is it possible for us to output the SVG files?

Right now the exported data from canvas is PNG I believe. I don't know if I could turn them into SVGs, but I believe there are libraries that can render GeoJSONs directly as SVGs and I could try them out. Since they are now rendered on canvas and there are only a handful of them, I think I could download them manually from the rendered web page into image files, but then it would be difficult to make changes to those icons later.

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.

Restrict zoom level on map Create Left Sidebar Group stations based on FAO regions.
2 participants