From 255b742e4f2c77cfac3492055e74321023f8a5e6 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 28 Mar 2024 11:11:32 -0700 Subject: [PATCH] DBC22-1915: open layer menu by default, text updates --- src/frontend/src/Components/Filters.js | 11 +++++++---- src/frontend/src/Components/Map.js | 5 +++-- src/frontend/src/pages/EventsListPage.js | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/Components/Filters.js b/src/frontend/src/Components/Filters.js index 5904467e..9c9677e8 100644 --- a/src/frontend/src/Components/Filters.js +++ b/src/frontend/src/Components/Filters.js @@ -27,14 +27,18 @@ import { MapContext } from '../App.js'; import './Filters.scss'; export default function Filters(props) { + // Misc + const largeScreen = useMediaQuery('only screen and (min-width : 768px)'); + // Context const { mapContext } = useContext(MapContext); // Props - const { toggleHandler, disableFeatures,enableRoadConditions } = props; + const { toggleHandler, disableFeatures, enableRoadConditions, textOverride } = props; // States - const [open, setOpen] = useState(false); + // Show layer menu by default on main page, desktop only + const [open, setOpen] = useState(largeScreen && !textOverride); const tooltipClosures = ( @@ -117,7 +121,6 @@ export default function Filters(props) { const [restStops, setRestStops] = useState(mapContext.visible_layers.restStops); - const largeScreen = useMediaQuery('only screen and (min-width : 768px)'); return (
@@ -128,7 +131,7 @@ export default function Filters(props) { onClick={() => { open ? setOpen(false) : setOpen(true) } }> - Filters + {textOverride ? textOverride : 'Layer Filters'} diff --git a/src/frontend/src/Components/Map.js b/src/frontend/src/Components/Map.js index 45817bac..3ea57a4f 100644 --- a/src/frontend/src/Components/Map.js +++ b/src/frontend/src/Components/Map.js @@ -103,7 +103,7 @@ export default function MapWrapper({ ferriesTimeStamp, // CMS weather, weatherTimeStamp, // Weather - restStops, + restStops, restStopsTimeStamp, // Rest Stops searchLocationFrom, selectedRoute, // Routing @@ -683,7 +683,7 @@ export default function MapWrapper({ mapRef.current.getView().getProjection().getCode(), mapContext ) - + mapRef.current.addLayer(mapLayers.current['restStops']); mapLayers.current['restStops'].setZIndex(68); } @@ -1058,6 +1058,7 @@ export default function MapWrapper({ toggleHandler={toggleLayer} disableFeatures={isPreview} enableRoadConditions={true} + textOverride={'Layer Filters'} /> )}
diff --git a/src/frontend/src/pages/EventsListPage.js b/src/frontend/src/pages/EventsListPage.js index c9774e0d..a01cf62f 100644 --- a/src/frontend/src/pages/EventsListPage.js +++ b/src/frontend/src/pages/EventsListPage.js @@ -246,6 +246,7 @@ export default function EventsListPage() { toggleHandler={eventCategoryFilterHandler} disableFeatures={true} enableRoadConditions={false} + textOverride={'List Filters'} />