e-mission / op-admin-dashboard

An admin/deployer dashboard for the NREL OpenPATH platform
0 stars 8 forks source link

Map - show map only when there is trip data #114

Closed jiji14 closed 4 months ago

jiji14 commented 4 months ago

Overview

The current map page shows the map feature even though there is no trip data, which can appear as a bug to users. To prevent confusion, I added the 'no data' text when there is no trip data instead of displaying an empty map.


screenshots

[ No trip data ] Screenshot 2024-03-26 at 11 45 35 AM

Screenshot 2024-03-26 at 11 45 18 AM

jiji14 commented 4 months ago

@JGreenlee Please review this when you have time :)

jiji14 commented 4 months ago

This works well and helps UX!

There are many different ways you could conditionally render things in Dash. Although setting display='none' works, I think it might be more elegant to conditionally return the "No trip data available..." H4 from one of the existing functions. I'm providing you with a patch file showing how I would I have done it. But it is up to you which method seems cleaner or more elegant

conditional-map-alternative.patch

Thanks! It seems much clearer. Applying patch kept failing so I directly added the code. I also changed the <h4> tag to a <div> tag since the heading tag is not suitable for error messages and can negatively affect accessibility.