diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx
index 8642af7..f17239c 100644
--- a/frontend/src/pages/HomePage.tsx
+++ b/frontend/src/pages/HomePage.tsx
@@ -7,36 +7,12 @@ import {map, switchMap} from 'rxjs/operators'
import api from 'api'
import {Stats, Page} from 'components'
-import {useConfig, MapSource} from 'config'
import {TrackListItem} from './TracksPage'
+import {RoadsMap} from './MapPage'
import styles from './HomePage.module.scss'
import 'ol/ol.css'
-import {obsRoads} from '../mapstyles'
-import ReactMapGl from 'react-map-gl'
-
-function WelcomeMap({mapSource}: {mapSource: MapSource}) {
- const mapStyle = React.useMemo(() => obsRoads(mapSource), [mapSource])
- const config = useConfig()
- const [viewport, setViewport] = React.useState({
- longitude: 0,
- latitude: 0,
- zoom: 0,
- })
-
- React.useEffect(() => {
- if (config?.mapHome) {
- setViewport(config.mapHome)
- }
- }, [config])
-
- return (
-
-
-
- )
-}
function MostRecentTrack() {
const track: Track | null = useObservable(
@@ -67,14 +43,14 @@ function MostRecentTrack() {
}
export default function HomePage() {
- const {obsMapSource: mapSource} = useConfig() || {}
-
return (
- {mapSource ? : null}
+
+
+
diff --git a/frontend/src/pages/MapPage.tsx b/frontend/src/pages/MapPage.tsx
index b5bd8c9..2459ed0 100644
--- a/frontend/src/pages/MapPage.tsx
+++ b/frontend/src/pages/MapPage.tsx
@@ -9,9 +9,9 @@ import styles from './MapPage.module.scss'
import 'ol/ol.css'
import {obsRoads} from '../mapstyles'
-import ReactMapGl from 'react-map-gl'
+import ReactMapGl, {AttributionControl } from 'react-map-gl'
-function BigMap({mapSource, config}: {mapSource: string ,config: Config}) {
+function RoadsMapInner({mapSource, config}: {mapSource: string ,config: Config}) {
const mapStyle = React.useMemo(() => mapSource && obsRoads(mapSource), [mapSource])
const [viewport, setViewport] = React.useState({
longitude: 0,
@@ -30,22 +30,34 @@ function BigMap({mapSource, config}: {mapSource: string ,config: Config}) {
}
return (
-
-
-
+
+ © OpenStreetMap contributors',
+ '© OpenMapTiles',
+ '© OpenBikeSensor',
+ ]} />
+
)
}
-export default function MapPage() {
+export function RoadsMap(props) {
const config = useConfig() || {}
if (!config) return null;
const {obsMapSource: mapSource} = config
if (!mapSource) return null;
+ return (
+
+ )
+}
+
+export default function MapPage() {
return (
-
+
+
+
)
}