Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jpngfile
Copy link

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
image

id="season",
clearable=False,
dbc.DropdownMenu(
id="season_links",
Copy link
Collaborator

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"
Copy link
Collaborator

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", {})
Copy link
Collaborator

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()
]
Copy link
Collaborator

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}")
Copy link
Collaborator

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?).

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