Closed anth-volk closed 4 months ago
How about we instead display it as a tabbed radio button between the drop downs and teal buttons? And show it for all geographies, just disabled for all but US.
Two radios can be "Base CPS" and "Enhanced CPS (experimental)" with a hover over enhanced when disabled "We currently only offer the Enhanced CPS for nationwide analysis."
We could also disable the enhanced option for 2021 (see https://github.com/PolicyEngine/policyengine-app/issues/1153)
By "tabbed" above, are you referring to something like the below @MaxGhenis?
yep
Do you want this to display for the UK, as well, or to only be present on the US site?
Also, at the moment, this is the best I'm getting in terms of spacing with the two options because "Enhanced CPS (experimental)" is such a large piece of text. I could stack them, but would probably have to rewrite this not to use Ant Design, or could somehow change the text to fit better. What are your thoughts?
What if we move experimental below the button?
More broadly I wonder if using a bit more space to describe the options would provide more clarity. Like "Geography" above that drop down, "Year", "Baseline policy" and then "Data" could be "Basic" and "Enhanced" with "Current Population Survey" on hover
I can work up something that would change this a bit more so as to make it more aesthetically pleasing. That said, I'd advocate for either adding this as another drop-down or as essentially two buttons, but stacked, as I think this horizontal structure is going to always crowd text out. If you look at the width of this panel prior to the mobile breakpoint (at which this becomes a hidden panel accessible from the bottom), it gets very narrow.
Maybe we don't need the basic. Just a switch to flip on enhanced data. I think I've seen other examples of "experimental" in small font below stuff
Before continuing, here are three potential mockups for this component. Feel free to let me know what you think, and if one is preferred over the others (even with edits), I can proceed on that one.
Long form, tabbed radio
Long form, slider
Short form, slider
Both would support disabling the text and slider/radio, and both would enable a tooltip on hover with the explanation you provided earlier.
Let's go with 2 while it's experimental (more subtle) and then we can consider changing to the tabbed view after full launch
Hopefully I'll have this done today; if not, I have a few hours to make up over the weekend, so ideally will be ready for review before Monday.
This is nearly done, just struggling with the beast that is Jest. Should have this, with tests, finished this weekend.
This is now complete, including stylistic changes and tests. A Loom video demonstrating the component in action is available at https://www.loom.com/share/fadc33d55a1940059ce01ab5984effad?sid=e9baec3e-12eb-41b2-a092-ceab5bb91166. Now also fixes #1153.
Thanks, could you show how it looks on mobile? Also let's use use
rather than utilize
please
Description
Fixes #1088; fixes #1153. At present, the back end is only able to utilize enhanced CPS data with the US country package. It currently categorizes the US with this enhanced data as a separate region, not as a subset of the US region, creating complications for the UX. This PR creates a temporary component, meant to last until the back end is improved, that visually displays enhanced CPS data as part of a new "data" selector on the right-hand panel that only displays if the US is selected as the target "region."
Changes
This creates a new component,
DatasetSelector
, that conditionally renders if the user selects "US" as their "region." this also removesUS (enhanced CPS)
from theRegionSelector
component. It does all of this manually and imperatively, meaning that improving the back end and removing the enhanced CPS as a region should still be prioritized, as these components are now inherently fragile. The component also manages state setting for theregion
URL param, but so doesRegionSelector
, creating potential side effects. One such effect is that clicking "US" inRegionSelector
reinstates the default data; this component handles that by defining an unnecessarykey
prop that ensures re-render upon this change. Other side effects may exist due to the fact that two inputs are simultaneously defining theregion
URL param.Screenshots
Loom video available here.
Tests
This PR does not include any tests. I'd be happy to push this to production without them, as it's relatively small and ideally temporary, or would be happy to await the merging of #1123, which repairs Jest such that tests can actually be written without import problems.