Skip to content

Commit 9f46eed

Browse files
authored
chore: migrate to openfreemap and sentinel2 basemaps, fix fonts and dark mode (#1402)
1 parent 5c3ff09 commit 9f46eed

File tree

19 files changed

+1143
-83
lines changed

19 files changed

+1143
-83
lines changed

.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ NEXT_PUBLIC_TYPESENSE_API_KEY=bCGIB4sHsJRy06NFjZLtxKIMgr4aO0tX
3434
# Mapbox Geocoder token
3535
NEXT_PUBLIC_MAPBOX_API_KEY=pk.eyJ1Ijoib3BlbmJldGFwcm9qZWN0IiwiYSI6ImNsdThtb2kzMDAwbmcya3Fubmk4cXI1MXEifQ.b1UScIUV2CFR1oX0MD2goQ
3636

37-
# Maptiler API Key
38-
NEXT_PUBLIC_MAPTILER_API_KEY=hIKQu6hZZpmnp1fhU386
39-
4037
# Discord invite
4138
NEXT_PUBLIC_DISCORD_INVITE=https://discord.gg/a6vuuTQxS8
4239

5.49 KB
Loading
7.12 KB
Loading
11.1 KB
Loading
12.6 KB
Loading

src/app/(maps)/components/ProfileMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const ProfileMenu: React.FC = () => {
99
<SessionProvider>
1010
<div className='absolute right-4 top-4 z-40'>
1111
<nav className='flex items-center gap-2'>
12-
<Link className='btn glass' href='/'><House size={18} />Home</Link>
12+
<Link className='btn bg-base-200 hover:bg-base-300' href='/'><House size={18} />Home</Link>
1313
<AuthenticatedProfileNavButton isMobile={false} />
1414
</nav>
1515
</div>

src/components/maps/AreaMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import dynamic from 'next/dynamic'
44
import { lineString } from '@turf/helpers'
55
import lineToPolygon from '@turf/line-to-polygon'
66

7-
import { AreaMetadataType, AreaType } from '../../js/types'
7+
import { AreaMetadataType, AreaType } from '@/js/types'
88
import { GlobalMap } from './GlobalMap'
99

1010
type ChildArea = Pick<AreaType, 'uuid' | 'areaName'> & { metadata: Pick<AreaMetadataType, 'lat' | 'lng' | 'leaf' | 'bbox' | 'polygon'> }

src/components/maps/CardGallery.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import useEmblaCarousel from 'embla-carousel-react'
22
import Image from 'next/image'
33
import clx from 'classnames'
44

5-
import { usePrevNextButtons, PrevButton, NextButton } from '../carousel/useNextPrevButtons'
6-
import { MediaWithTagsInMapTile } from './TileTypes'
5+
import { usePrevNextButtons, PrevButton, NextButton } from '@/components/carousel/useNextPrevButtons'
6+
import { MediaWithTagsInMapTile } from '@/components/maps/TileTypes'
77

88
export const CardGallery: React.FC<{ media: MediaWithTagsInMapTile[] }> = () => {
99
return (

src/components/maps/CoordinatePickerMap.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22
import React, { useCallback, useState, useRef, useEffect } from 'react'
33
import { Map, ScaleControl, NavigationControl, Marker, GeolocateControl, GeolocateResultEvent, MapLayerMouseEvent, MapEvent } from 'react-map-gl/maplibre'
4+
import type { StyleSpecification } from 'maplibre-gl'
45
import dynamic from 'next/dynamic'
56
import { useDebouncedCallback } from 'use-debounce'
67
import { MAP_STYLES, type MapStyles } from '@/components/maps/MapSelector'
@@ -34,7 +35,7 @@ export const CoordinatePickerMap: React.FC<CoordinatePickerMapProps> = ({ onCoor
3435
})
3536
const { initialCoordinate, newSelectedCoordinate } = coord
3637
const { isMobile } = useResponsive()
37-
const [mapStyle, setMapStyle] = useState<string>(MAP_STYLES.light.style)
38+
const [mapStyle, setMapStyle] = useState<string | StyleSpecification>(MAP_STYLES.light.style)
3839
const triggerButtonRef = useRef<HTMLButtonElement>(null)
3940
const { watch, setValue } = useFormContext()
4041

src/components/maps/GlobalMap.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
import { useCallback, useEffect, useState } from 'react'
33
import { Map, FullscreenControl, ScaleControl, NavigationControl, MapLayerMouseEvent, ViewStateChangeEvent, GeolocateControl } from 'react-map-gl/maplibre'
44
import * as maplibregl from 'maplibre-gl'
5+
import type { StyleSpecification } from 'maplibre-gl'
56
import { MapLibreEvent } from 'maplibre-gl'
67
import dynamic from 'next/dynamic'
7-
import { MAP_STYLES, type MapStyles } from './MapSelector'
8-
import { Drawer } from './TileHandlers/Drawer'
9-
import { HoverCard } from './TileHandlers/HoverCard'
10-
import { OBCustomLayers } from './OBCustomLayers'
11-
import { tileToFeature } from './utils'
12-
import { ActiveFeature, TileProps } from './TileTypes'
13-
import MapLayersSelector from './MapLayersSelector'
14-
import { MapToolbar } from './MapToolbar'
15-
import { SelectedFeature } from './AreaActiveMarker'
8+
import { MAP_STYLES, type MapStyles } from '@/components/maps/MapSelector'
9+
import { Drawer } from '@/components/maps/TileHandlers/Drawer'
10+
import { HoverCard } from '@/components/maps/TileHandlers/HoverCard'
11+
import { OBCustomLayers } from '@/components/maps/OBCustomLayers'
12+
import { tileToFeature } from '@/components/maps/utils'
13+
import { ActiveFeature, TileProps } from '@/components/maps/TileTypes'
14+
import MapLayersSelector from '@/components/maps/MapLayersSelector'
15+
import { MapToolbar } from '@/components/maps/MapToolbar'
16+
import { SelectedFeature } from '@/components/maps/AreaActiveMarker'
1617
import { useRouter } from 'next/navigation'
1718
import { useUrlParams } from '@/js/hooks/useUrlParams'
1819

@@ -60,7 +61,8 @@ export const GlobalMap: React.FC<GlobalMapProps> = ({
6061
const [hoverInfo, setHoverInfo] = useState<ActiveFeature | null>(null)
6162
const [mapInstance, setMapInstance] = useState<maplibregl.Map | null>(null)
6263
const [cursor, setCursor] = useState<string>('default')
63-
const [mapStyle, setMapStyle] = useState<string>(MAP_STYLES.light.style)
64+
const [mapStyle, setMapStyle] = useState<string | StyleSpecification>(MAP_STYLES.light.style)
65+
const [currentMapType, setCurrentMapType] = useState<keyof MapStyles>('light')
6466
const [isSourceLoaded, setIsSourceLoaded] = useState(false)
6567
const [dataLayersDisplayState, setDataLayersDisplayState] = useState<DataLayersDisplayState>({
6668
areaBoundaries: false,
@@ -178,6 +180,7 @@ export const GlobalMap: React.FC<GlobalMapProps> = ({
178180
const updateMapLayer = (key: keyof MapStyles): void => {
179181
const style = MAP_STYLES[key]
180182
setMapStyle(style.style)
183+
setCurrentMapType(key)
181184
}
182185

183186
const findAreaById = useCallback((map: maplibregl.Map, areaId: string) => {
@@ -239,7 +242,7 @@ export const GlobalMap: React.FC<GlobalMapProps> = ({
239242
<MapLayersSelector emit={updateMapLayer} />
240243
<ScaleControl unit='imperial' style={{ marginBottom: 10 }} position='bottom-left' />
241244
<ScaleControl unit='metric' style={{ marginBottom: 0 }} position='bottom-left' />
242-
<OBCustomLayers layersState={dataLayersDisplayState} />
245+
<OBCustomLayers layersState={dataLayersDisplayState} mapType={currentMapType} />
243246
{showFullscreenControl && <FullscreenControl />}
244247
<NavigationControl showCompass={false} position='bottom-right' />
245248
<GeolocateControl

0 commit comments

Comments
 (0)