{"action":"created","comment":{"url":"https://api.github.com/repos/streetmix/streetmix/pulls/comments/131306225","pull_request_review_id":54273852,"id":131306225,"diff_hunk":"@@ -0,0 +1,156 @@\n+/* global fetch */\n+import React from 'react'\n+import { connect } from 'react-redux'\n+import { setSettings } from '../users/settings'\n+import PropTypes from 'prop-types'\n+import { Map, TileLayer, Marker, Popup } from 'react-leaflet'\n+import SearchAddress from './SearchAddress'\n+import {apiurlReverse, apikey} from './config'\n+\n+const OpenStreetMapTiles = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'\n+const OpenStreetMapAttr = '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>'\n+\n+const zoomLevel = 12\n+\n+class Geolocation extends React.Component {\n+  constructor (props) {\n+    super(props)\n+    this.state = {\n+      mapCenter: [40.645, -73.975]\n+    }\n+\n+    this.searchResults = this.searchResults.bind(this)\n+    this.markerDrag = this.markerDrag.bind(this)\n+    this.gotClick = this.gotClick.bind(this)\n+    this.hidePopup = this.hidePopup.bind(this)\n+  }\n+\n+/* start click event function */\n+  gotClick (e) {\n+    const displayAddressData = (res) => {\n+      setSettings({ addressInformationLabel: res.features[0].properties.label })\n+      setSettings({ markerLocation: res.features[0].geometry.coordinates.reverse() })\n+\n+      this.map.leafletElement.panTo(this.props.markerLocation)\n+      console.log('Click Point Results : ', this.props.markerLocation, this.props.addressInformationLabel)\n+    }\n+\n+    function gotAddressData (res, err) {\n+      res.json().then(displayAddressData)\n+    }\n+\n+    const options = {\n+      lat: e.latlng.lat,\n+      lng: e.latlng.lng\n+    }\n+\n+    const clickUrl = `${apiurlReverse}?api_key=${apikey}&point.lat=${options.lat}&point.lon=${options.lng}`\n+    fetch(clickUrl).then(gotAddressData)\n+  }\n+\n+/* end click event function */\n+\n+/* start on marker drag function */\n+  markerDrag (e) {\n+    const gotJson = (res) => {\n+      this.setState({\n+        renderPopup: true\n+      })\n+\n+      setSettings({ addressInformationLabel: res.features[0].properties.label })\n+      setSettings({ markerLocation: e.target.getLatLng() })\n+      console.log('Drag End Results : ', e.target.getLatLng(), this.props.addressInformationLabel)\n+    }\n+\n+    function gotAddress (res, err) {\n+      res.json().then(gotJson)\n+    }\n+\n+    const targetCoords = e.target.getLatLng()\n+\n+    const dragEndUrl = `${apiurlReverse}?api_key=${apikey}&point.lat=${targetCoords.lat}&point.lon=${targetCoords.lng}`\n+    fetch(dragEndUrl).then(gotAddress)\n+  }\n+\n+/* end on marker drag function */\n+\n+// p = point , l = label\n+  searchResults (p, l) {\n+    this.setState({\n+      addressName: l,\n+      mapCenter: p,\n+      markerLocation: p\n+    })\n+\n+    this.map.leafletElement.panTo(this.props.markerLocation)\n+  }\n+\n+  hidePopup (e) {\n+    this.setState({\n+      renderPopup: false\n+    })\n+  }\n+\n+  render () {\n+    const markers = this.props.markerLocation ? (\n+      <Marker\n+        position={this.props.markerLocation}\n+        onDragEnd={this.markerDrag}\n+        onDragStart={this.hidePopup}\n+        draggable\n+      />\n+    ) : null\n+\n+    let popup = this.props.markerLocation ? (\n+      <Popup\n+        position={this.props.markerLocation}\n+        maxWidth={300}\n+        closeOnClick={false}\n+        closeButton={false}\n+        offset={[0, -25]}\n+      >\n+        <span>{this.props.addressInformationLabel}</span>\n+      </Popup>\n+    ) : null\n+\n+    if (this.state.renderPopup === false) {\n+      popup = null\n+    }\n+\n+    return (\n+      <div id='rootDiv'>","path":"assets/scripts/streets/Geolocation.jsx","position":121,"original_position":121,"commit_id":"39554c3e42480a2f1700c79e2c155d8648411cd5","original_commit_id":"39554c3e42480a2f1700c79e2c155d8648411cd5","user":{"login":"louh","id":2553268,"avatar_url":"https://avatars3.githubusercontent.com/u/2553268?v=4","gravatar_id":"","url":"https://api.github.com/users/louh","html_url":"https://github.com/louh","followers_url":"https://api.github.com/users/louh/followers","following_url":"https://api.github.com/users/louh/following{/other_user}","gists_url":"https://api.github.com/users/louh/gists{/gist_id}","starred_url":"https://api.github.com/users/louh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louh/subscriptions","organizations_url":"https://api.github.com/users/louh/orgs","repos_url":"https://api.github.com/users/louh/repos","events_url":"https://api.github.com/users/louh/events{/privacy}","received_events_url":"https://api.github.com/users/louh/received_events","type":"User","site_admin":false},"body":"Let's not use `id='rootDiv'` since `rootDiv` is not descriptive for styling. In addition, with React, we can more safely rely on class names and not use `id`s. Instead let's use `className='geolocation'`.","created_at":"2017-08-04T03:38:16Z","updated_at":"2017-08-04T03:40:42Z","html_url":"https://github.com/streetmix/streetmix/pull/695#discussion_r131306225","pull_request_url":"https://api.github.com/repos/streetmix/streetmix/pulls/695","_links":{"self":{"href":"https://api.github.com/repos/streetmix/streetmix/pulls/comments/131306225"},"html":{"href":"https://github.com/streetmix/streetmix/pull/695#discussion_r131306225"},"pull_request":{"href":"https://api.github.com/repos/streetmix/streetmix/pulls/695"}}},"pull_request":{"url":"https://api.github.com/repos/streetmix/streetmix/pulls/695","id":133839795,"html_url":"https://github.com/streetmix/streetmix/pull/695","diff_url":"https://github.com/streetmix/streetmix/pull/695.diff","patch_url":"https://github.com/streetmix/streetmix/pull/695.patch","issue_url":"https://api.github.com/repos/streetmix/streetmix/issues/695","number":695,"state":"open","locked":false,"title":"Geolocation","user":{"login":"bluntedmice","id":10892382,"avatar_url":"https://avatars1.githubusercontent.com/u/10892382?v=4","gravatar_id":"","url":"https://api.github.com/users/bluntedmice","html_url":"https://github.com/bluntedmice","followers_url":"https://api.github.com/users/bluntedmice/followers","following_url":"https://api.github.com/users/bluntedmice/following{/other_user}","gists_url":"https://api.github.com/users/bluntedmice/gists{/gist_id}","starred_url":"https://api.github.com/users/bluntedmice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluntedmice/subscriptions","organizations_url":"https://api.github.com/users/bluntedmice/orgs","repos_url":"https://api.github.com/users/bluntedmice/repos","events_url":"https://api.github.com/users/bluntedmice/events{/privacy}","received_events_url":"https://api.github.com/users/bluntedmice/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-08-03T01:03:25Z","updated_at":"2017-08-04T03:40:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/streetmix/streetmix/pulls/695/commits","review_comments_url":"https://api.github.com/repos/streetmix/streetmix/pulls/695/comments","review_comment_url":"https://api.github.com/repos/streetmix/streetmix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/streetmix/streetmix/issues/695/comments","statuses_url":"https://api.github.com/repos/streetmix/streetmix/statuses/39554c3e42480a2f1700c79e2c155d8648411cd5","head":{"label":"streetmix:Geolocation","ref":"Geolocation","sha":"39554c3e42480a2f1700c79e2c155d8648411cd5","user":{"login":"streetmix","id":6877271,"avatar_url":"https://avatars1.githubusercontent.com/u/6877271?v=4","gravatar_id":"","url":"https://api.github.com/users/streetmix","html_url":"https://github.com/streetmix","followers_url":"https://api.github.com/users/streetmix/followers","following_url":"https://api.github.com/users/streetmix/following{/other_user}","gists_url":"https://api.github.com/users/streetmix/gists{/gist_id}","starred_url":"https://api.github.com/users/streetmix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetmix/subscriptions","organizations_url":"https://api.github.com/users/streetmix/orgs","repos_url":"https://api.github.com/users/streetmix/repos","events_url":"https://api.github.com/users/streetmix/events{/privacy}","received_events_url":"https://api.github.com/users/streetmix/received_events","type":"Organization","site_admin":false},"repo":{"id":7708819,"name":"streetmix","full_name":"streetmix/streetmix","owner":{"login":"streetmix","id":6877271,"avatar_url":"https://avatars1.githubusercontent.com/u/6877271?v=4","gravatar_id":"","url":"https://api.github.com/users/streetmix","html_url":"https://github.com/streetmix","followers_url":"https://api.github.com/users/streetmix/followers","following_url":"https://api.github.com/users/streetmix/following{/other_user}","gists_url":"https://api.github.com/users/streetmix/gists{/gist_id}","starred_url":"https://api.github.com/users/streetmix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetmix/subscriptions","organizations_url":"https://api.github.com/users/streetmix/orgs","repos_url":"https://api.github.com/users/streetmix/repos","events_url":"https://api.github.com/users/streetmix/events{/privacy}","received_events_url":"https://api.github.com/users/streetmix/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/streetmix/streetmix","description":"Design, remix, and share your neighborhood street.","fork":false,"url":"https://api.github.com/repos/streetmix/streetmix","forks_url":"https://api.github.com/repos/streetmix/streetmix/forks","keys_url":"https://api.github.com/repos/streetmix/streetmix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/streetmix/streetmix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/streetmix/streetmix/teams","hooks_url":"https://api.github.com/repos/streetmix/streetmix/hooks","issue_events_url":"https://api.github.com/repos/streetmix/streetmix/issues/events{/number}","events_url":"https://api.github.com/repos/streetmix/streetmix/events","assignees_url":"https://api.github.com/repos/streetmix/streetmix/assignees{/user}","branches_url":"https://api.github.com/repos/streetmix/streetmix/branches{/branch}","tags_url":"https://api.github.com/repos/streetmix/streetmix/tags","blobs_url":"https://api.github.com/repos/streetmix/streetmix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/streetmix/streetmix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/streetmix/streetmix/git/refs{/sha}","trees_url":"https://api.github.com/repos/streetmix/streetmix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/streetmix/streetmix/statuses/{sha}","languages_url":"https://api.github.com/repos/streetmix/streetmix/languages","stargazers_url":"https://api.github.com/repos/streetmix/streetmix/stargazers","contributors_url":"https://api.github.com/repos/streetmix/streetmix/contributors","subscribers_url":"https://api.github.com/repos/streetmix/streetmix/subscribers","subscription_url":"https://api.github.com/repos/streetmix/streetmix/subscription","commits_url":"https://api.github.com/repos/streetmix/streetmix/commits{/sha}","git_commits_url":"https://api.github.com/repos/streetmix/streetmix/git/commits{/sha}","comments_url":"https://api.github.com/repos/streetmix/streetmix/comments{/number}","issue_comment_url":"https://api.github.com/repos/streetmix/streetmix/issues/comments{/number}","contents_url":"https://api.github.com/repos/streetmix/streetmix/contents/{+path}","compare_url":"https://api.github.com/repos/streetmix/streetmix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/streetmix/streetmix/merges","archive_url":"https://api.github.com/repos/streetmix/streetmix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/streetmix/streetmix/downloads","issues_url":"https://api.github.com/repos/streetmix/streetmix/issues{/number}","pulls_url":"https://api.github.com/repos/streetmix/streetmix/pulls{/number}","milestones_url":"https://api.github.com/repos/streetmix/streetmix/milestones{/number}","notifications_url":"https://api.github.com/repos/streetmix/streetmix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/streetmix/streetmix/labels{/name}","releases_url":"https://api.github.com/repos/streetmix/streetmix/releases{/id}","deployments_url":"https://api.github.com/repos/streetmix/streetmix/deployments","created_at":"2013-01-19T21:03:45Z","updated_at":"2017-07-17T01:55:26Z","pushed_at":"2017-08-04T02:39:51Z","git_url":"git://github.com/streetmix/streetmix.git","ssh_url":"git@github.com:streetmix/streetmix.git","clone_url":"https://github.com/streetmix/streetmix.git","svn_url":"https://github.com/streetmix/streetmix","homepage":"https://streetmix.net","size":33464,"stargazers_count":250,"watchers_count":250,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":125,"forks":73,"open_issues":125,"watchers":250,"default_branch":"master"}},"base":{"label":"streetmix:master","ref":"master","sha":"60e92acb3b6242ba3f374223c17756b6f4e9a786","user":{"login":"streetmix","id":6877271,"avatar_url":"https://avatars1.githubusercontent.com/u/6877271?v=4","gravatar_id":"","url":"https://api.github.com/users/streetmix","html_url":"https://github.com/streetmix","followers_url":"https://api.github.com/users/streetmix/followers","following_url":"https://api.github.com/users/streetmix/following{/other_user}","gists_url":"https://api.github.com/users/streetmix/gists{/gist_id}","starred_url":"https://api.github.com/users/streetmix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetmix/subscriptions","organizations_url":"https://api.github.com/users/streetmix/orgs","repos_url":"https://api.github.com/users/streetmix/repos","events_url":"https://api.github.com/users/streetmix/events{/privacy}","received_events_url":"https://api.github.com/users/streetmix/received_events","type":"Organization","site_admin":false},"repo":{"id":7708819,"name":"streetmix","full_name":"streetmix/streetmix","owner":{"login":"streetmix","id":6877271,"avatar_url":"https://avatars1.githubusercontent.com/u/6877271?v=4","gravatar_id":"","url":"https://api.github.com/users/streetmix","html_url":"https://github.com/streetmix","followers_url":"https://api.github.com/users/streetmix/followers","following_url":"https://api.github.com/users/streetmix/following{/other_user}","gists_url":"https://api.github.com/users/streetmix/gists{/gist_id}","starred_url":"https://api.github.com/users/streetmix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetmix/subscriptions","organizations_url":"https://api.github.com/users/streetmix/orgs","repos_url":"https://api.github.com/users/streetmix/repos","events_url":"https://api.github.com/users/streetmix/events{/privacy}","received_events_url":"https://api.github.com/users/streetmix/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/streetmix/streetmix","description":"Design, remix, and share your neighborhood street.","fork":false,"url":"https://api.github.com/repos/streetmix/streetmix","forks_url":"https://api.github.com/repos/streetmix/streetmix/forks","keys_url":"https://api.github.com/repos/streetmix/streetmix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/streetmix/streetmix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/streetmix/streetmix/teams","hooks_url":"https://api.github.com/repos/streetmix/streetmix/hooks","issue_events_url":"https://api.github.com/repos/streetmix/streetmix/issues/events{/number}","events_url":"https://api.github.com/repos/streetmix/streetmix/events","assignees_url":"https://api.github.com/repos/streetmix/streetmix/assignees{/user}","branches_url":"https://api.github.com/repos/streetmix/streetmix/branches{/branch}","tags_url":"https://api.github.com/repos/streetmix/streetmix/tags","blobs_url":"https://api.github.com/repos/streetmix/streetmix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/streetmix/streetmix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/streetmix/streetmix/git/refs{/sha}","trees_url":"https://api.github.com/repos/streetmix/streetmix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/streetmix/streetmix/statuses/{sha}","languages_url":"https://api.github.com/repos/streetmix/streetmix/languages","stargazers_url":"https://api.github.com/repos/streetmix/streetmix/stargazers","contributors_url":"https://api.github.com/repos/streetmix/streetmix/contributors","subscribers_url":"https://api.github.com/repos/streetmix/streetmix/subscribers","subscription_url":"https://api.github.com/repos/streetmix/streetmix/subscription","commits_url":"https://api.github.com/repos/streetmix/streetmix/commits{/sha}","git_commits_url":"https://api.github.com/repos/streetmix/streetmix/git/commits{/sha}","comments_url":"https://api.github.com/repos/streetmix/streetmix/comments{/number}","issue_comment_url":"https://api.github.com/repos/streetmix/streetmix/issues/comments{/number}","contents_url":"https://api.github.com/repos/streetmix/streetmix/contents/{+path}","compare_url":"https://api.github.com/repos/streetmix/streetmix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/streetmix/streetmix/merges","archive_url":"https://api.github.com/repos/streetmix/streetmix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/streetmix/streetmix/downloads","issues_url":"https://api.github.com/repos/streetmix/streetmix/issues{/number}","pulls_url":"https://api.github.com/repos/streetmix/streetmix/pulls{/number}","milestones_url":"https://api.github.com/repos/streetmix/streetmix/milestones{/number}","notifications_url":"https://api.github.com/repos/streetmix/streetmix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/streetmix/streetmix/labels{/name}","releases_url":"https://api.github.com/repos/streetmix/streetmix/releases{/id}","deployments_url":"https://api.github.com/repos/streetmix/streetmix/deployments","created_at":"2013-01-19T21:03:45Z","updated_at":"2017-07-17T01:55:26Z","pushed_at":"2017-08-04T02:39:51Z","git_url":"git://github.com/streetmix/streetmix.git","ssh_url":"git@github.com:streetmix/streetmix.git","clone_url":"https://github.com/streetmix/streetmix.git","svn_url":"https://github.com/streetmix/streetmix","homepage":"https://streetmix.net","size":33464,"stargazers_count":250,"watchers_count":250,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":125,"forks":73,"open_issues":125,"watchers":250,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/streetmix/streetmix/pulls/695"},"html":{"href":"https://github.com/streetmix/streetmix/pull/695"},"issue":{"href":"https://api.github.com/repos/streetmix/streetmix/issues/695"},"comments":{"href":"https://api.github.com/repos/streetmix/streetmix/issues/695/comments"},"review_comments":{"href":"https://api.github.com/repos/streetmix/streetmix/pulls/695/comments"},"review_comment":{"href":"https://api.github.com/repos/streetmix/streetmix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/streetmix/streetmix/pulls/695/commits"},"statuses":{"href":"https://api.github.com/repos/streetmix/streetmix/statuses/39554c3e42480a2f1700c79e2c155d8648411cd5"}}}}
{"actor":{"display_login":"louh"}}