diff --git a/src/App.js b/src/App.js index f2fb760..6a29bc7 100644 --- a/src/App.js +++ b/src/App.js @@ -15,17 +15,16 @@ function App() { //Makes API call when zipcode entered useEffect(() => { - if(currZip != null){ - fetch("https://api.mobilize.us/v1/organizations/1316/events?timeslot_start=gte_now&zipcode=" + currZip) + + fetch("https://warren-events.s3.amazonaws.com/data/events.json") .then((res)=>res.json()) - .then((data)=>setEvents(data['data'])); + .then((data)=>setEvents(data)); //Reset states on new zipcode setHoverEvent(null); setLocFilt(null); - } - }, [currZip]); + }, []); return (
diff --git a/src/Map.js b/src/Map.js index 7d4e20a..80427d0 100644 --- a/src/Map.js +++ b/src/Map.js @@ -14,7 +14,6 @@ export function Map(props){ //Called to set/unset location filter function locationFilter(event, set){ - console.log(event) if(set){ props.selectLoc({ @@ -109,27 +108,27 @@ export function Map(props){ if(props.events != null){ //Initiates map's focus at the first event (typically the closest to the provided zipcode) with a valid lat & long position - let first = 0; - if (!('location' in props.events[first]) || !('location' in props.events[first]['location']) || !('latitude' in props.events[first]['location']['location'])) { - first++; - } + // let first = 0; + // if (!('location' in props.events[first]) || !('location' in props.events[first]['location']) || !('latitude' in props.events[first]['location']['location'])) { + // first++; + // } - var lat = props.events[first]['location']['location']['latitude']; - var long = props.events[first]['location']['location']['longitude']; + // var lat = props.events[first]['location']['location']['latitude']; + // var long = props.events[first]['location']['location']['longitude']; - if(center[0] !== lat || center[0] !== long){ - setCenter([lat, long]); - setNewCenter(true); - } + // if(center[0] !== lat || center[0] !== long){ + // setCenter([lat, long]); + // setNewCenter(true); + // } var places = {}; props.events.forEach(function(event, index) { - + if (index > 500) return; //If has longitude and latitute if ('location' in event && 'location' in event['location'] && 'latitude' in event['location']['location']) { - //Creates string key for {places} dictionary + //Creates string key for {places} dictionary let str = event['location']['location']['latitude'] + "&" + event['location']['location']['longitude']; //Creates or adds to a location - adds HTML code for event list for that location if (str in places) { @@ -139,7 +138,7 @@ export function Map(props){ } } - }); + }); setLocations(places); }