import { MapContainer, GeoJSON, TileLayer } from "react-leaflet"; import Parser from "./parser/parser"; import { createRef, useEffect, useState } from "react"; import hash from "object-hash"; import Leaflet from "leaflet"; import L from "leaflet"; const parser = await Parser.instance(); const terminals = [10394, 10395, 10475, 10480, 10482, 10485, 10653]; function App() { const [selectedTerminal, setSelectedTerminal] = useState(terminals[0]); const [procedure, setProcedure] = useState(); const mapRef = createRef(); const layerRef = createRef(); useEffect(() => { (async () => { setProcedure(await parser.parse(selectedTerminal)); })(); }, [selectedTerminal]); useEffect(() => { if (layerRef.current && mapRef.current) { mapRef.current.flyToBounds(layerRef.current.getBounds(), { animate: false, padding: [50, 50], }); } }); return (
feature.geometry.type !== "Point"} ref={layerRef} /> ({ color: feature.properties["marker-color"], stroke: false, fill: true, fillOpacity: 1, })} pointToLayer={(_, latlng) => { return L.circleMarker(latlng, { radius: 5 }); }} onEachFeature={({ geometry, properties }, layer) => { if (geometry.type === "Point") { layer.bindPopup( `${properties.name}
${properties.altitude} ft
${properties.speed} kts
CNSTR: ${properties.altitudeConstraint ?? ""} ${properties.speedConstraint ?? ""}
` ); } }} filter={(feature) => feature.geometry.type === "Point"} />
{terminals.map((terminal) => (
ID {terminal}
))}
); } export default App;