mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 22:54:42 +02:00
feat: initial scaffold — Vite + React + Tailwind + MapLibre
Minimal Idaho basemap via local PMTiles extract from Protomaps daily build (20260419). Deployed to /mnt/nav/frontend/ via rsync, served by nginx on :8440 as navi.echo6.co. Phase 3 Step 1 of Navi frontend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c2866a885d
commit
3f2d33ffbe
11 changed files with 3475 additions and 0 deletions
41
src/App.jsx
Normal file
41
src/App.jsx
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { useEffect, useRef } from 'react'
|
||||
import maplibregl from 'maplibre-gl'
|
||||
import 'maplibre-gl/dist/maplibre-gl.css'
|
||||
import { Protocol } from 'pmtiles'
|
||||
import { layersWithCustomTheme } from 'protomaps-themes-base'
|
||||
|
||||
export default function App() {
|
||||
const mapContainer = useRef(null)
|
||||
|
||||
useEffect(() => {
|
||||
const protocol = new Protocol()
|
||||
maplibregl.addProtocol('pmtiles', protocol.tile)
|
||||
|
||||
const map = new maplibregl.Map({
|
||||
container: mapContainer.current,
|
||||
style: {
|
||||
version: 8,
|
||||
glyphs: 'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf',
|
||||
sources: {
|
||||
protomaps: {
|
||||
type: 'vector',
|
||||
url: 'pmtiles:///tiles/idaho.pmtiles',
|
||||
attribution: '<a href="https://protomaps.com">Protomaps</a> | <a href="https://openstreetmap.org">OSM</a>',
|
||||
},
|
||||
},
|
||||
layers: layersWithCustomTheme('protomaps', 'dark'),
|
||||
},
|
||||
center: [-114.5, 44.0],
|
||||
zoom: 6,
|
||||
})
|
||||
|
||||
map.addControl(new maplibregl.NavigationControl(), 'top-right')
|
||||
|
||||
return () => {
|
||||
maplibregl.removeProtocol('pmtiles')
|
||||
map.remove()
|
||||
}
|
||||
}, [])
|
||||
|
||||
return <div ref={mapContainer} className="w-screen h-screen" />
|
||||
}
|
||||
7
src/index.css
Normal file
7
src/index.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@import "tailwindcss";
|
||||
|
||||
html, body, #root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
10
src/main.jsx
Normal file
10
src/main.jsx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.jsx'
|
||||
|
||||
createRoot(document.getElementById('root')).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue