Skip to content

Commit

Permalink
Add marker clusterer and update icons
Browse files Browse the repository at this point in the history
  • Loading branch information
sawasawasawa committed Aug 26, 2017
1 parent 663242f commit 0ff01a8
Show file tree
Hide file tree
Showing 42 changed files with 66 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.meteor
settings.json
dump/
4 changes: 2 additions & 2 deletions client/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ header {
}

.infowindow-title, .infowindow-subtitle {
text-decoration: underline;
/*text-decoration: underline;*/
font-family: 'Rubik Mono One';
text-align: center;
/*text-align: center;*/
text-transform: uppercase;
font-weight: 900;
}
Expand Down
Binary file modified dump/meteor/places.bson
Binary file not shown.
35 changes: 35 additions & 0 deletions imports/ui/MusicMap/Markers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {
default as React,
Component,
} from "react";
import MarkerClusterer from "react-google-maps/lib/addons/MarkerClusterer";
import PlaceMarker from '../components/common/PlaceMarker';

export const Markers = (props) =>
<div>
<MarkerClusterer
averageCenter
enableRetinaIcons
gridSize={10}
zoomOnClick={false}
imagePath="img/resize/cluster"
styles={[{
textColor: '#313131',
url: 'img/resize/cluster1.png',
height: 50,
width: 50
}]}
onClick={()=>{console.log("_______ 123123123", 123123123);}}
>
{props.markers ? props.markers.map((marker, index) => {
return <PlaceMarker key={index}
marker={marker}
onMarkerClick={() => props.onMarkerClick(marker)}
onCloseClick={() => props.onCloseClick(marker)}
mediaAtPlace={ props.media ? props.media.filter((e)=>{return e.placeId == marker._id}) : [] }
eventsAtPlace={ props.events ? props.events.filter((e)=>{return e.placeId == marker._id}) : [] }
/>
})
: null}
</MarkerClusterer>
</div>
31 changes: 16 additions & 15 deletions imports/ui/MusicMap.js → imports/ui/MusicMap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {
Component,
} from "react";
import {withGoogleMap, GoogleMap} from "react-google-maps";
import mapStylesMagenta from "../../client/map/mapStyles-magenta.json"
import mapStylesMagenta from "../../../client/map/mapStyles-magenta.json"
import SearchBox from "react-google-maps/lib/places/SearchBox"; //TODO needed?
import {Events} from '../api/events.js';
import RaisedButton from 'material-ui/RaisedButton';
import PlaceMarker from './components/common/PlaceMarker';
import { Markers } from './Markers'
import { MarkerList } from './MarkerList'

const INPUT_STYLE = {
boxSizing: `border-box`,
Expand Down Expand Up @@ -64,17 +64,11 @@ const MusicMapGoogleMap = withGoogleMap(props => {
inputStyle={INPUT_STYLE}
inputClassName={'searchBox'}
/>

{props.markers ? props.markers.map((marker, index) => {
return <PlaceMarker key={index}
marker={marker}
onMarkerClick={() => props.onMarkerClick(marker)}
onCloseClick={() => props.onCloseClick(marker)}
mediaAtPlace={ props.media ? props.media.filter((e)=>{return e.placeId == marker._id}) : [] }
eventsAtPlace={ props.events ? props.events.filter((e)=>{return e.placeId == marker._id}) : [] }
/>
})
: null}
<Markers markers={props.markers}
onCloseClick={props.onCloseClick}
onMarkerClick={props.onMarkerClick}
/>
<MarkerList {...props}/>
</GoogleMap>
)
}
Expand Down Expand Up @@ -127,7 +121,7 @@ export default class MusicMap extends Component {

handleMarkerClick(targetMarker) {
this.setState({
center: targetMarker.position,
center: this.getNewCenter(targetMarker.position),
markers: this.state.markers.map(marker => {
return {
...marker,
Expand All @@ -136,6 +130,13 @@ export default class MusicMap extends Component {
}),
});
}

getNewCenter(position) {
return {
lat: position.lat - 0.9,
lng: position.lng
};
}

handleCloseClick(targetMarker) {
this.setState({
Expand Down
6 changes: 3 additions & 3 deletions imports/ui/components/common/PlaceInfoWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default class PlaceMarker extends Component {
})
return iconsToDisplay.map((icon, index)=>{
return(
<a href={this.props.marker[icon]} target='_blank'>
<img key={index} src={`/img/resize/${icon}.png`} />
<a href={this.props.marker[icon]} target='_blank' style={{marginLeft: 10}}>
<img key={index} src={`/img/resize/${icon}.png`} width="32px" height="32px"/>
</a>
)
})
Expand All @@ -32,7 +32,7 @@ export default class PlaceMarker extends Component {
<div style={{maxWidth: '450px', maxHeight: '550px', marginLeft: '10px'}}>
<h4 className="infowindow-title">{marker.name}</h4>
<img src={marker.photo} style={{maxHeight: '300px', maxWidth: '500px', margin: '20px auto', display: 'block'}}/>
<div style={{width: '100%', textAlign: 'center'}}>
<div style={{width: '100%', textAlign: 'right'}}>
{this.socialIcons()}
</div>
<p>{marker.description}</p>
Expand Down
12 changes: 9 additions & 3 deletions imports/ui/components/common/PlaceMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ import PlaceInfoWindow from '../common/PlaceInfoWindow';

export default class PlaceMarker extends Component {
getIcon(marker) {
let url;
if (marker.mediaType) {
return this.getIconForMedia(marker)
url = this.getIconForMedia(marker)
} else {
url = this.getIconForPlace(marker)
}
return {
url,
scaledSize: new google.maps.Size(32, 32)
}
return this.getIconForPlace(marker)
}

getIconForMedia(record){
Expand Down Expand Up @@ -43,7 +49,7 @@ export default class PlaceMarker extends Component {
return (
<Marker
position={{ lat: marker.position.lat, lng: marker.position.lng }}
key={index}
key={marker.name}
icon = {this.getIcon(marker)}
title={marker.name}
onClick={onClick}
Expand Down
Binary file modified public/img/cafe.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/culture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Beer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Cafe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Instagram_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Music Record.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Park Concert Shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Park Concert Shell_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Party.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Radio Filled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Retro TV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Theatre Mask_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-Theatre Mask_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/icons8-YouTube 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/instagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/outdoorHall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/piano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/radio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/resize/cluster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/resize/cluster1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/resize/culture.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/resize/fb.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/resize/insta.png
100644 → 100755
Binary file modified public/img/resize/piano.png
100644 → 100755
Binary file modified public/img/resize/radio.png
100644 → 100755
Binary file modified public/img/resize/record.png
100644 → 100755
Binary file modified public/img/resize/tv.png
100644 → 100755
Binary file modified public/img/resize/www.png
100644 → 100755
Binary file modified public/img/resize/youtube.png
100644 → 100755
Binary file added public/img/theatre.png
Binary file added public/img/tv.png
Binary file added public/img/www.png

0 comments on commit 0ff01a8

Please sign in to comment.