Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Show the Roads on the map
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb-sti1 authored and a-thansen committed Oct 10, 2023
1 parent 425838a commit b5ebb03
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/Components/Map/MapWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import {

import '../../css/map.css';
import { MAP_OPTIONS } from './constants';
import React, { FC } from 'react';
import React, { FC, useEffect, useState } from 'react';
import Selector from './Inputs/Selector';
import { IRoad } from '../../models/path';
import { getRoads } from '../../queries/road';
import Roads from './Roads';

/**
* properties
Expand All @@ -24,6 +27,13 @@ interface IMapWrapper {
const MapWrapper: FC<IMapWrapper> = ({ children }) => {
const { center, zoom, minZoom, maxZoom, scaleWidth } = MAP_OPTIONS;

const [roads, setRoads] = useState<IRoad[]>();

// get the actual roads
useEffect(() => {
getRoads(setRoads);
}, []);

return (
<>
<Selector
Expand All @@ -45,6 +55,7 @@ const MapWrapper: FC<IMapWrapper> = ({ children }) => {
attribution='&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<Roads roads={roads} />
<ZoomControl position="topright" />
<ScaleControl
imperial={false}
Expand Down

0 comments on commit b5ebb03

Please sign in to comment.