-
Notifications
You must be signed in to change notification settings - Fork 6
Jpng.merge seassons to single page #538
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
base: master
Are you sure you want to change the base?
Jpng.merge seassons to single page #538
Conversation
id="season", | ||
clearable=False, | ||
dbc.DropdownMenu( | ||
id="season_links", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, you switched from dcc.Dropdown
to dbc.DropdownMenu
because in the version of dash we're using, you can't put a link in dcc.Dropdown
item text; but in dash 2.5+ you can. Let's go with your solution for now, so we can deliver the new functionality to Madagascar ASAP, but after this is merged I will try to update dash so we can go back to using dcc.Dropdown
. If that doesn't work out, maybe we should switch all the menus to dbc.DropdownMenu
to avoid the risk of styling getting out of sync.
@@ -374,6 +374,10 @@ countries: | |||
vuln: | |||
colormap: vulnerability | |||
range: [0.0, 5.0] | |||
subpages: | |||
default: "madagascar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use all caps for the visible text of the menu items, and use DJF
instead of default
.
@@ -845,6 +846,12 @@ def initial_setup(pathname, qstring): | |||
) | |||
for k in sorted(c["seasons"].keys()) | |||
] | |||
|
|||
subpages = c.get("subpages", {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the subpages
attribute isn't configured, then the menu should have one item, not zero.
season_link_options = [ | ||
dbc.DropdownMenuItem(subpage, href=f"/fbfmaproom/{subpage_link}") | ||
for subpage, subpage_link in subpages.items() | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set the active
attribute on the item that's currently selected?
|
||
subpages = c.get("subpages", {}) | ||
season_link_options = [ | ||
dbc.DropdownMenuItem(subpage, href=f"/fbfmaproom/{subpage_link}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't hard-code fbfmaproom
here, because it's configurable, and in fact the production instance is currently mounted at /fbfmaproom2
(for a time it coexisted with an earlier version that was mounted at /fbfmaproom
). We need to get the app's mount path from dash (or maybe flask?).
Summary
I updated the season page so it is a dropdown of pages for related season pages of the same country. This replaces the current season dropdown which currently does not change the values.
I didn't remove the current season code because the config values are still used as static values, when it is refactored to be in a single page I can cleanup this code. For now, I've stored the season values in a hidden dropdown
Test Plan
Open up the page for madagascar

Select a season for a different page and confirm it navigates correctly