From ff3b60462f8527b5de6a671417fd668a9019c1b2 Mon Sep 17 00:00:00 2001 From: Ramin Farhadi Date: Thu, 6 Jun 2024 11:15:10 -0400 Subject: [PATCH] campus bar added. --- public/data/campuses.json | 28 ++++++++++++++++------------ src/App.tsx | 20 +++++++++++++++++--- src/components/Campuses.scss | 7 +++++++ src/components/Campuses.tsx | 16 +++++++++------- 4 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 src/components/Campuses.scss diff --git a/public/data/campuses.json b/public/data/campuses.json index 5d68211..2581aac 100644 --- a/public/data/campuses.json +++ b/public/data/campuses.json @@ -1,24 +1,28 @@ { "campuses": [ { - "name": "University of Central Florida", - "Latitude": "28.6024321", - "Longitude": "-81.2026402" + "name": "Main Campus", + "latitude": "28.602368", + "longitude": "-81.200142", + "zoom": "15" }, { - "name": "UCF College of Medicine", - "Latitude": "28.3680993", - "Longitude": "-81.2811666" + "name": "College of Medicine", + "latitude": "28.3680993", + "longitude": "-81.2811666", + "zoom":"17" }, { - "name": "UCF Downtown", - "Latitude": "28.5462775", - "Longitude": "-81.3872291" + "name": "Downtown", + "latitude": "28.5462775", + "longitude": "-81.3872291", + "zoom": "17" }, { - "name": "Rosen College of Hospitality Management", - "Latitude": "28.42829", - "Longitude": "-81.4419018" + "name": "Rosen College", + "latitude": "28.42829", + "longitude": "-81.4419018", + "zoom": "17" } ] diff --git a/src/App.tsx b/src/App.tsx index 8ab701d..94e9d80 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -77,8 +77,9 @@ function App() { // Campuses interface CampusesDataType { name: string, - Latitude: string, - Longitude: string, + latitude: string, + longitude: string, + zoom: string } const [campusesData, setCampusesData] = useState([]); @@ -137,6 +138,19 @@ function App() { }); }; + const campusHandler = (latitude: string, longitude: string, zoom: string) => { + const lat = Number(latitude) + const lon = Number(longitude) + const mapZoom = Number(zoom); + mapRef.current!.flyTo({ + center: [ + lon!, + lat! + ], + zoom: mapZoom + }) + } + useMemo(() => { fetch('/data/geojson/new/buildingPoints.geojson') .then((responseText) => responseText.json()) @@ -406,7 +420,7 @@ function App() {
- +