{"action":"created","comment":{"url":"https://api.github.com/repos/streetlives/streetlives-web/pulls/comments/183224857","pull_request_review_id":114188772,"id":183224857,"diff_hunk":"@@ -1,25 +1,113 @@\n-import React from 'react';\n+import React, { Component } from 'react';\n import { connect } from 'react-redux';\n import { selectLocationData } from '../../../reducers';\n import { updateLocation } from '../../../actions';\n import { getLocation } from '../../../actions';\n import Form from '../common/Form';\n-import FormEdit from '../common/FormEdit';\n import FormView from '../common/FormView';\n import { compose, withProps } from 'recompose';\n+import PropTypes from 'prop-types';\n+import Header from '../../../components/header';\n+import Button from '../../../components/button';\n+import Input from '../../../components/input';\n \n-const LocationNumberEdit = compose(\n-  withProps({\n-    headerText : 'What\\'s this location\\'s phone number?',\n-    placeholderText : 'e.g. 646-909-4591',\n-  })\n-)(props => <FormEdit {...props} />)\n+class LocationNumberEdit extends Component {\n+  constructor(props) {\n+    super(props);\n+\n+    const [areaCode, firstThree, lastFour] = props.value.number ? props.value.number.split('.') : ['','',''];\n+    this.state = {\n+      areaCode, \n+      firstThree, \n+      lastFour,\n+      extension : props.value.extension || ''\n+    };\n+\n+    this.onSubmit = this.onSubmit.bind(this);\n+    Object.keys(this.state).forEach(k => {\n+      this[`onChange_${k}`] = this.onChange.bind(this, k);\n+    });\n+  }\n+\n+  componentWillReceiveProps(props){\n+    let o = {};\n+    if(props.value.number !== this.props.value.number){\n+      const [areaCode, firstThree, lastFour] = props.value.number ? props.value.number.split('.') : [];\n+      o = {\n+        areaCode, \n+        firstThree, \n+        lastFour\n+      }\n+    }\n+\n+    if(props.value.extension !== this.props.value.extension){\n+      o.extension = props.value.extension;\n+    }\n+\n+    if(Object.keys(o).length) this.setState(o);\n+  }\n+\n+  onChange(key, event) {\n+    this.setState({ [key]: event.target.value });\n+  }\n+\n+  onSubmit() {\n+    this.props.updateValue({\n+      number : [this.state.areaCode, this.state.firstThree, this.state.lastFour].join('.'),\n+      extension : this.state.extension\n+    });\n+    this.props.onSubmit();\n+  }\n+\n+  render() {\n+    return (\n+      <div>\n+        <Header>What's this location's phone number?</Header>\n+          <div>\n+            <Input\n+              style={{width:'2em'}}\n+              type=\"number\"\n+              value={this.state.areaCode}\n+              onChange={this.onChange_areaCode}\n+            />&nbsp;-&nbsp;\n+            <Input\n+              style={{width:'2em'}}\n+              type=\"number\"\n+              value={this.state.firstThree}\n+              onChange={this.onChange_firstThree}\n+            />&nbsp;-&nbsp;\n+            <Input\n+              style={{width:'3em'}}\n+              type=\"number\"\n+              value={this.state.lastFour}\n+              onChange={this.onChange_lastFour}\n+            />\n+          </div>\n+          <div>\n+            ext.\n+            <Input\n+              type=\"number\"\n+              value={this.state.extension}\n+              onChange={this.onChange_extension}\n+            />\n+          </div>\n+        <Button onClick={this.onSubmit} primary className=\"mt-3\">\n+          OK\n+        </Button>\n+      </div>\n+    );\n+  }\n+}\n \n const LocationNumberView = compose(\n   withProps({\n     topText : 'LOCATION PHONE NUMBER',\n   })\n-)(props => <FormView {...props} />)\n+)(props => {\n+  const value = props.value && props.value.number && `${props.value.number.replace(/\\./g,'-')}${props.value.extension ? ` ext.${props.value.extension}` : ''}`;","path":"src/app/locationForm/number/LocationNumber.jsx","position":null,"original_position":116,"commit_id":"cc48d17173e605265db44970fec6d07e3c8bc5c0","original_commit_id":"8723b4ce0c82ccd767c5542d324e568d3635d336","user":{"login":"Rovack","id":6605826,"avatar_url":"https://avatars3.githubusercontent.com/u/6605826?v=4","gravatar_id":"","url":"https://api.github.com/users/Rovack","html_url":"https://github.com/Rovack","followers_url":"https://api.github.com/users/Rovack/followers","following_url":"https://api.github.com/users/Rovack/following{/other_user}","gists_url":"https://api.github.com/users/Rovack/gists{/gist_id}","starred_url":"https://api.github.com/users/Rovack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rovack/subscriptions","organizations_url":"https://api.github.com/users/Rovack/orgs","repos_url":"https://api.github.com/users/Rovack/repos","events_url":"https://api.github.com/users/Rovack/events{/privacy}","received_events_url":"https://api.github.com/users/Rovack/received_events","type":"User","site_admin":false},"body":"At that point I suppose we'll also need the LocationNumberView to be a custom component.\r\nThat makes me think it probably makes sense to break this file down to split the container and presentational components, as even with just LocationNumberEdit inside it it's already doing quite a lot, and probably moreso once we have a proper LocationNumberView.","created_at":"2018-04-22T04:10:25Z","updated_at":"2018-04-22T04:40:05Z","html_url":"https://github.com/streetlives/streetlives-web/pull/8#discussion_r183224857","pull_request_url":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/streetlives/streetlives-web/pulls/comments/183224857"},"html":{"href":"https://github.com/streetlives/streetlives-web/pull/8#discussion_r183224857"},"pull_request":{"href":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8"}},"in_reply_to_id":183224835},"pull_request":{"url":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8","id":181706834,"html_url":"https://github.com/streetlives/streetlives-web/pull/8","diff_url":"https://github.com/streetlives/streetlives-web/pull/8.diff","patch_url":"https://github.com/streetlives/streetlives-web/pull/8.patch","issue_url":"https://api.github.com/repos/streetlives/streetlives-web/issues/8","number":8,"state":"open","locked":false,"title":"`feature/workflows` -> `master`","user":{"login":"nlaz","id":2153230,"avatar_url":"https://avatars3.githubusercontent.com/u/2153230?v=4","gravatar_id":"","url":"https://api.github.com/users/nlaz","html_url":"https://github.com/nlaz","followers_url":"https://api.github.com/users/nlaz/followers","following_url":"https://api.github.com/users/nlaz/following{/other_user}","gists_url":"https://api.github.com/users/nlaz/gists{/gist_id}","starred_url":"https://api.github.com/users/nlaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlaz/subscriptions","organizations_url":"https://api.github.com/users/nlaz/orgs","repos_url":"https://api.github.com/users/nlaz/repos","events_url":"https://api.github.com/users/nlaz/events{/privacy}","received_events_url":"https://api.github.com/users/nlaz/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-15T16:11:33Z","updated_at":"2018-04-22T04:40:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b396d40d44d4b4190ef051aa0df8d9b6a615c119","assignee":null,"assignees":[],"requested_reviewers":[{"login":"jbeard4","id":586962,"avatar_url":"https://avatars2.githubusercontent.com/u/586962?v=4","gravatar_id":"","url":"https://api.github.com/users/jbeard4","html_url":"https://github.com/jbeard4","followers_url":"https://api.github.com/users/jbeard4/followers","following_url":"https://api.github.com/users/jbeard4/following{/other_user}","gists_url":"https://api.github.com/users/jbeard4/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeard4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeard4/subscriptions","organizations_url":"https://api.github.com/users/jbeard4/orgs","repos_url":"https://api.github.com/users/jbeard4/repos","events_url":"https://api.github.com/users/jbeard4/events{/privacy}","received_events_url":"https://api.github.com/users/jbeard4/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8/commits","review_comments_url":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8/comments","review_comment_url":"https://api.github.com/repos/streetlives/streetlives-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/streetlives/streetlives-web/issues/8/comments","statuses_url":"https://api.github.com/repos/streetlives/streetlives-web/statuses/cc48d17173e605265db44970fec6d07e3c8bc5c0","head":{"label":"streetlives:feature/workflows","ref":"feature/workflows","sha":"cc48d17173e605265db44970fec6d07e3c8bc5c0","user":{"login":"streetlives","id":16725430,"avatar_url":"https://avatars2.githubusercontent.com/u/16725430?v=4","gravatar_id":"","url":"https://api.github.com/users/streetlives","html_url":"https://github.com/streetlives","followers_url":"https://api.github.com/users/streetlives/followers","following_url":"https://api.github.com/users/streetlives/following{/other_user}","gists_url":"https://api.github.com/users/streetlives/gists{/gist_id}","starred_url":"https://api.github.com/users/streetlives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetlives/subscriptions","organizations_url":"https://api.github.com/users/streetlives/orgs","repos_url":"https://api.github.com/users/streetlives/repos","events_url":"https://api.github.com/users/streetlives/events{/privacy}","received_events_url":"https://api.github.com/users/streetlives/received_events","type":"Organization","site_admin":false},"repo":{"id":126416396,"name":"streetlives-web","full_name":"streetlives/streetlives-web","owner":{"login":"streetlives","id":16725430,"avatar_url":"https://avatars2.githubusercontent.com/u/16725430?v=4","gravatar_id":"","url":"https://api.github.com/users/streetlives","html_url":"https://github.com/streetlives","followers_url":"https://api.github.com/users/streetlives/followers","following_url":"https://api.github.com/users/streetlives/following{/other_user}","gists_url":"https://api.github.com/users/streetlives/gists{/gist_id}","starred_url":"https://api.github.com/users/streetlives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetlives/subscriptions","organizations_url":"https://api.github.com/users/streetlives/orgs","repos_url":"https://api.github.com/users/streetlives/repos","events_url":"https://api.github.com/users/streetlives/events{/privacy}","received_events_url":"https://api.github.com/users/streetlives/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/streetlives/streetlives-web","description":"The Streetlives web app","fork":false,"url":"https://api.github.com/repos/streetlives/streetlives-web","forks_url":"https://api.github.com/repos/streetlives/streetlives-web/forks","keys_url":"https://api.github.com/repos/streetlives/streetlives-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/streetlives/streetlives-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/streetlives/streetlives-web/teams","hooks_url":"https://api.github.com/repos/streetlives/streetlives-web/hooks","issue_events_url":"https://api.github.com/repos/streetlives/streetlives-web/issues/events{/number}","events_url":"https://api.github.com/repos/streetlives/streetlives-web/events","assignees_url":"https://api.github.com/repos/streetlives/streetlives-web/assignees{/user}","branches_url":"https://api.github.com/repos/streetlives/streetlives-web/branches{/branch}","tags_url":"https://api.github.com/repos/streetlives/streetlives-web/tags","blobs_url":"https://api.github.com/repos/streetlives/streetlives-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/streetlives/streetlives-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/streetlives/streetlives-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/streetlives/streetlives-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/streetlives/streetlives-web/statuses/{sha}","languages_url":"https://api.github.com/repos/streetlives/streetlives-web/languages","stargazers_url":"https://api.github.com/repos/streetlives/streetlives-web/stargazers","contributors_url":"https://api.github.com/repos/streetlives/streetlives-web/contributors","subscribers_url":"https://api.github.com/repos/streetlives/streetlives-web/subscribers","subscription_url":"https://api.github.com/repos/streetlives/streetlives-web/subscription","commits_url":"https://api.github.com/repos/streetlives/streetlives-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/streetlives/streetlives-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/streetlives/streetlives-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/streetlives/streetlives-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/streetlives/streetlives-web/contents/{+path}","compare_url":"https://api.github.com/repos/streetlives/streetlives-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/streetlives/streetlives-web/merges","archive_url":"https://api.github.com/repos/streetlives/streetlives-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/streetlives/streetlives-web/downloads","issues_url":"https://api.github.com/repos/streetlives/streetlives-web/issues{/number}","pulls_url":"https://api.github.com/repos/streetlives/streetlives-web/pulls{/number}","milestones_url":"https://api.github.com/repos/streetlives/streetlives-web/milestones{/number}","notifications_url":"https://api.github.com/repos/streetlives/streetlives-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/streetlives/streetlives-web/labels{/name}","releases_url":"https://api.github.com/repos/streetlives/streetlives-web/releases{/id}","deployments_url":"https://api.github.com/repos/streetlives/streetlives-web/deployments","created_at":"2018-03-23T01:36:02Z","updated_at":"2018-04-14T19:48:25Z","pushed_at":"2018-04-22T04:37:21Z","git_url":"git://github.com/streetlives/streetlives-web.git","ssh_url":"git@github.com:streetlives/streetlives-web.git","clone_url":"https://github.com/streetlives/streetlives-web.git","svn_url":"https://github.com/streetlives/streetlives-web","homepage":null,"size":662,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"streetlives:master","ref":"master","sha":"2208e90c5b3167e59dedba24a4de485b913cfbeb","user":{"login":"streetlives","id":16725430,"avatar_url":"https://avatars2.githubusercontent.com/u/16725430?v=4","gravatar_id":"","url":"https://api.github.com/users/streetlives","html_url":"https://github.com/streetlives","followers_url":"https://api.github.com/users/streetlives/followers","following_url":"https://api.github.com/users/streetlives/following{/other_user}","gists_url":"https://api.github.com/users/streetlives/gists{/gist_id}","starred_url":"https://api.github.com/users/streetlives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetlives/subscriptions","organizations_url":"https://api.github.com/users/streetlives/orgs","repos_url":"https://api.github.com/users/streetlives/repos","events_url":"https://api.github.com/users/streetlives/events{/privacy}","received_events_url":"https://api.github.com/users/streetlives/received_events","type":"Organization","site_admin":false},"repo":{"id":126416396,"name":"streetlives-web","full_name":"streetlives/streetlives-web","owner":{"login":"streetlives","id":16725430,"avatar_url":"https://avatars2.githubusercontent.com/u/16725430?v=4","gravatar_id":"","url":"https://api.github.com/users/streetlives","html_url":"https://github.com/streetlives","followers_url":"https://api.github.com/users/streetlives/followers","following_url":"https://api.github.com/users/streetlives/following{/other_user}","gists_url":"https://api.github.com/users/streetlives/gists{/gist_id}","starred_url":"https://api.github.com/users/streetlives/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/streetlives/subscriptions","organizations_url":"https://api.github.com/users/streetlives/orgs","repos_url":"https://api.github.com/users/streetlives/repos","events_url":"https://api.github.com/users/streetlives/events{/privacy}","received_events_url":"https://api.github.com/users/streetlives/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/streetlives/streetlives-web","description":"The Streetlives web app","fork":false,"url":"https://api.github.com/repos/streetlives/streetlives-web","forks_url":"https://api.github.com/repos/streetlives/streetlives-web/forks","keys_url":"https://api.github.com/repos/streetlives/streetlives-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/streetlives/streetlives-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/streetlives/streetlives-web/teams","hooks_url":"https://api.github.com/repos/streetlives/streetlives-web/hooks","issue_events_url":"https://api.github.com/repos/streetlives/streetlives-web/issues/events{/number}","events_url":"https://api.github.com/repos/streetlives/streetlives-web/events","assignees_url":"https://api.github.com/repos/streetlives/streetlives-web/assignees{/user}","branches_url":"https://api.github.com/repos/streetlives/streetlives-web/branches{/branch}","tags_url":"https://api.github.com/repos/streetlives/streetlives-web/tags","blobs_url":"https://api.github.com/repos/streetlives/streetlives-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/streetlives/streetlives-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/streetlives/streetlives-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/streetlives/streetlives-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/streetlives/streetlives-web/statuses/{sha}","languages_url":"https://api.github.com/repos/streetlives/streetlives-web/languages","stargazers_url":"https://api.github.com/repos/streetlives/streetlives-web/stargazers","contributors_url":"https://api.github.com/repos/streetlives/streetlives-web/contributors","subscribers_url":"https://api.github.com/repos/streetlives/streetlives-web/subscribers","subscription_url":"https://api.github.com/repos/streetlives/streetlives-web/subscription","commits_url":"https://api.github.com/repos/streetlives/streetlives-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/streetlives/streetlives-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/streetlives/streetlives-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/streetlives/streetlives-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/streetlives/streetlives-web/contents/{+path}","compare_url":"https://api.github.com/repos/streetlives/streetlives-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/streetlives/streetlives-web/merges","archive_url":"https://api.github.com/repos/streetlives/streetlives-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/streetlives/streetlives-web/downloads","issues_url":"https://api.github.com/repos/streetlives/streetlives-web/issues{/number}","pulls_url":"https://api.github.com/repos/streetlives/streetlives-web/pulls{/number}","milestones_url":"https://api.github.com/repos/streetlives/streetlives-web/milestones{/number}","notifications_url":"https://api.github.com/repos/streetlives/streetlives-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/streetlives/streetlives-web/labels{/name}","releases_url":"https://api.github.com/repos/streetlives/streetlives-web/releases{/id}","deployments_url":"https://api.github.com/repos/streetlives/streetlives-web/deployments","created_at":"2018-03-23T01:36:02Z","updated_at":"2018-04-14T19:48:25Z","pushed_at":"2018-04-22T04:37:21Z","git_url":"git://github.com/streetlives/streetlives-web.git","ssh_url":"git@github.com:streetlives/streetlives-web.git","clone_url":"https://github.com/streetlives/streetlives-web.git","svn_url":"https://github.com/streetlives/streetlives-web","homepage":null,"size":662,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8"},"html":{"href":"https://github.com/streetlives/streetlives-web/pull/8"},"issue":{"href":"https://api.github.com/repos/streetlives/streetlives-web/issues/8"},"comments":{"href":"https://api.github.com/repos/streetlives/streetlives-web/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/streetlives/streetlives-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/streetlives/streetlives-web/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/streetlives/streetlives-web/statuses/cc48d17173e605265db44970fec6d07e3c8bc5c0"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Rovack"}}