-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
139 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
display:flex; | ||
width: 100%; | ||
margin:0; | ||
|
||
flex-direction: column; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.map{ | ||
|
||
width:100%; | ||
height:600px; | ||
visibility: visible; | ||
} | ||
|
||
.route_show_container{ | ||
display:flex; | ||
flex-direction: row; | ||
width:100%; | ||
justify-content: baseline; | ||
} | ||
|
||
.sidebar{ | ||
width:15%; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
} | ||
.nav-bar{ | ||
width:90%; | ||
height:40px; | ||
} | ||
.innerbar{ | ||
margin:0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import MarkerManager from '../../util/marker_manager'; | ||
|
||
|
||
const myLatlng = { lat: 40.6602, lng: -73.9690 }; | ||
|
||
const getCoordsObj = latLng =>({ | ||
lat: latLng.lat(), | ||
lng: latLng.lng() | ||
}); | ||
|
||
class RouteShow extends React.Component{ | ||
|
||
componentDidMount(){ | ||
|
||
this.map = new google.maps.Map( | ||
this.mapdiv, | ||
{zoom:14, center: myLatlng} | ||
); | ||
const map = this.map; | ||
new google.maps.Marker({ | ||
position: myLatlng, | ||
map, | ||
title: 'Thanks Gaylynn' | ||
}); | ||
this.MarkerManager = new MarkerManager(this.map); | ||
this.setState({}); | ||
// add event listener here | ||
} | ||
handleClick(){ | ||
|
||
} | ||
|
||
// registerListeners() { | ||
// google.maps.event.addListener(this.map, 'idle', () => { | ||
// const { north, south, east, west } = this.map.getBounds().toJSON(); | ||
// const bounds = { | ||
// northEast: { lat:north, lng: east }, | ||
// southWest: { lat: south, lng: west } }; | ||
// this.props.updateFilter('bounds', bounds); | ||
// }); | ||
// google.maps.event.addListener(this.map, 'click', (event) => { | ||
// const coords = getCoordsObj(event.latLng); | ||
// this.handleClick(coords); | ||
// }); | ||
// } | ||
|
||
render(){ | ||
|
||
return( | ||
<div className='route_show_container'> | ||
<div className='sidebar'> | ||
<h1>this will be the sidebar</h1> | ||
</div> | ||
<div className='map' ref={(el)=> this.mapdiv = el }> | ||
|
||
</div> | ||
</div> | ||
|
||
) | ||
} | ||
} | ||
|
||
export default RouteShow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class MarkerManager { | ||
constructor(map, handleClick){ | ||
this.map = map; | ||
this.handleClick = handleClick; | ||
this.markers = {}; | ||
} | ||
|
||
updateMarkers(benches){ | ||
const benchesObj = {}; | ||
benches.forEach(bench => benchesObj[bench.id] = bench); | ||
|
||
benches | ||
.filter(bench => !this.markers[bench.id]) | ||
.forEach(newBench => this.createMarkerFromBench(newBench, this.handleClick)) | ||
|
||
Object.keys(this.markers) | ||
.filter(benchId => !benchesObj[benchId]) | ||
.forEach((benchId) => this.removeMarker(this.markers[benchId])) | ||
} | ||
|
||
createMarkerFromBench(bench) { | ||
const position = new google.maps.LatLng(bench.lat, bench.lng); | ||
const marker = new google.maps.Marker({ | ||
position, | ||
map: this.map, | ||
benchId: bench.id | ||
}); | ||
|
||
marker.addListener('click', () => this.handleClick(bench)); | ||
this.markers[marker.benchId] = marker; | ||
} | ||
|
||
removeMarker(marker) { | ||
this.markers[marker.benchId].setMap(null); | ||
delete this.markers[marker.benchId]; | ||
} | ||
} | ||
|
||
export default MarkerManager; |