Skip to content

Commit

Permalink
DBC22-1915: open layer menu by default, text updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-oxd authored and minORC committed Mar 28, 2024
1 parent 5b7eef2 commit 255b742
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/frontend/src/Components/Filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<Tooltip id="tooltip" className="tooltip-content">
Expand Down Expand Up @@ -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 (
<div className="filters-component">
Expand All @@ -128,7 +131,7 @@ export default function Filters(props) {
onClick={() => {
open ? setOpen(false) : setOpen(true) }
}>
Filters
{textOverride ? textOverride : 'Layer Filters'}

<FontAwesomeIcon icon={faFilter} />
</Button>
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/src/Components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function MapWrapper({
ferriesTimeStamp, // CMS
weather,
weatherTimeStamp, // Weather
restStops,
restStops,
restStopsTimeStamp, // Rest Stops
searchLocationFrom,
selectedRoute, // Routing
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -1058,6 +1058,7 @@ export default function MapWrapper({
toggleHandler={toggleLayer}
disableFeatures={isPreview}
enableRoadConditions={true}
textOverride={'Layer Filters'}
/>
)}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/pages/EventsListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export default function EventsListPage() {
toggleHandler={eventCategoryFilterHandler}
disableFeatures={true}
enableRoadConditions={false}
textOverride={'List Filters'}
/>
</div>

Expand Down

0 comments on commit 255b742

Please sign in to comment.