{"action":"created","comment":{"url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/comments/172793167","pull_request_review_id":101869144,"id":172793167,"diff_hunk":"@@ -0,0 +1,64 @@\n+import React, { Component } from 'react';\n+\n+import TextArea from '../TextArea';\n+import Button from '../Button';\n+\n+import './style.css';\n+\n+class AddComment extends Component {\n+  constructor(props) {\n+    super(props);\n+\n+    this.state = {\n+      value: '',\n+      displaySuccess: false,\n+      displayError: false\n+    };\n+  }\n+\n+  onChange = value => {\n+    this.setState({ value });\n+  };\n+\n+  onSubmit = event => {\n+    event.preventDefault();\n+    const { value } = this.state;\n+    const { onCommentAdd } = this.props;\n+\n+    onCommentAdd({\n+      variables: { body: value }\n+    })\n+      .then(({ data }) => {\n+        this.setState({ displaySuccess: true });\n+      })\n+      .catch(error => {\n+        this.setState({ displayError: true, errorMessage: error.toString() });\n+      });\n+  };\n+\n+  renderMessage = () => {\n+    const { displaySuccess, displayError, errorMessage } = this.state;\n+    if (displaySuccess) {\n+      return <div className=\"AddComment-message AddComment-message--success\">Your comment has been posted</div>;\n+    } else if (displayError) {\n+      return <div className=\"AddComment-message AddComment-message--error\">{errorMessage}</div>;\n+    } else {\n+      return null;\n+    }\n+  };\n+\n+  render() {\n+    const { value } = this.state;\n+    return (\n+      <div>\n+        {this.renderMessage()}","path":"src/AddComment/index.js","position":54,"original_position":54,"commit_id":"c19e8ff5e146379f467add02630f7d62da2f22b6","original_commit_id":"c19e8ff5e146379f467add02630f7d62da2f22b6","user":{"login":"rwieruch","id":2479967,"avatar_url":"https://avatars0.githubusercontent.com/u/2479967?v=4","gravatar_id":"","url":"https://api.github.com/users/rwieruch","html_url":"https://github.com/rwieruch","followers_url":"https://api.github.com/users/rwieruch/followers","following_url":"https://api.github.com/users/rwieruch/following{/other_user}","gists_url":"https://api.github.com/users/rwieruch/gists{/gist_id}","starred_url":"https://api.github.com/users/rwieruch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwieruch/subscriptions","organizations_url":"https://api.github.com/users/rwieruch/orgs","repos_url":"https://api.github.com/users/rwieruch/repos","events_url":"https://api.github.com/users/rwieruch/events{/privacy}","received_events_url":"https://api.github.com/users/rwieruch/received_events","type":"User","site_admin":false},"body":"Usually I extract these things as own components like <RequestMessage /> but keep them still in the same file. However, good to see different approaches! Your way you have direct access to the state object! 👍 ","created_at":"2018-03-07T10:07:26Z","updated_at":"2018-03-07T10:07:26Z","html_url":"https://github.com/rwieruch/react-graphql-github-apollo/pull/6#discussion_r172793167","pull_request_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/comments/172793167"},"html":{"href":"https://github.com/rwieruch/react-graphql-github-apollo/pull/6#discussion_r172793167"},"pull_request":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6","id":172591074,"html_url":"https://github.com/rwieruch/react-graphql-github-apollo/pull/6","diff_url":"https://github.com/rwieruch/react-graphql-github-apollo/pull/6.diff","patch_url":"https://github.com/rwieruch/react-graphql-github-apollo/pull/6.patch","issue_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues/6","number":6,"state":"open","locked":false,"title":"[WIP] Add Comment to an Issue","user":{"login":"AustinGreen","id":5200555,"avatar_url":"https://avatars0.githubusercontent.com/u/5200555?v=4","gravatar_id":"","url":"https://api.github.com/users/AustinGreen","html_url":"https://github.com/AustinGreen","followers_url":"https://api.github.com/users/AustinGreen/followers","following_url":"https://api.github.com/users/AustinGreen/following{/other_user}","gists_url":"https://api.github.com/users/AustinGreen/gists{/gist_id}","starred_url":"https://api.github.com/users/AustinGreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustinGreen/subscriptions","organizations_url":"https://api.github.com/users/AustinGreen/orgs","repos_url":"https://api.github.com/users/AustinGreen/repos","events_url":"https://api.github.com/users/AustinGreen/events{/privacy}","received_events_url":"https://api.github.com/users/AustinGreen/received_events","type":"User","site_admin":false},"body":"This PR is nearly ready. It's a bit noisy due to conflicting prettier formatting. I'll add items to the check list as I think of them. Please offer feedback if I'm missing anything.\r\n\r\nCloses #2 ","created_at":"2018-03-02T19:59:03Z","updated_at":"2018-03-07T10:07:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db9176ddfadb7c628be3f61bfe4d8f4d7e6a21ae","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6/commits","review_comments_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6/comments","review_comment_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues/6/comments","statuses_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/statuses/c19e8ff5e146379f467add02630f7d62da2f22b6","head":{"label":"AustinGreen:master","ref":"master","sha":"c19e8ff5e146379f467add02630f7d62da2f22b6","user":{"login":"AustinGreen","id":5200555,"avatar_url":"https://avatars0.githubusercontent.com/u/5200555?v=4","gravatar_id":"","url":"https://api.github.com/users/AustinGreen","html_url":"https://github.com/AustinGreen","followers_url":"https://api.github.com/users/AustinGreen/followers","following_url":"https://api.github.com/users/AustinGreen/following{/other_user}","gists_url":"https://api.github.com/users/AustinGreen/gists{/gist_id}","starred_url":"https://api.github.com/users/AustinGreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustinGreen/subscriptions","organizations_url":"https://api.github.com/users/AustinGreen/orgs","repos_url":"https://api.github.com/users/AustinGreen/repos","events_url":"https://api.github.com/users/AustinGreen/events{/privacy}","received_events_url":"https://api.github.com/users/AustinGreen/received_events","type":"User","site_admin":false},"repo":{"id":122687961,"name":"react-graphql-github-apollo","full_name":"AustinGreen/react-graphql-github-apollo","owner":{"login":"AustinGreen","id":5200555,"avatar_url":"https://avatars0.githubusercontent.com/u/5200555?v=4","gravatar_id":"","url":"https://api.github.com/users/AustinGreen","html_url":"https://github.com/AustinGreen","followers_url":"https://api.github.com/users/AustinGreen/followers","following_url":"https://api.github.com/users/AustinGreen/following{/other_user}","gists_url":"https://api.github.com/users/AustinGreen/gists{/gist_id}","starred_url":"https://api.github.com/users/AustinGreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AustinGreen/subscriptions","organizations_url":"https://api.github.com/users/AustinGreen/orgs","repos_url":"https://api.github.com/users/AustinGreen/repos","events_url":"https://api.github.com/users/AustinGreen/events{/privacy}","received_events_url":"https://api.github.com/users/AustinGreen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AustinGreen/react-graphql-github-apollo","description":"🚀A React + Apollo + GraphQL GitHub Client. Your opportunity to learn about these technologies in a real world application.","fork":true,"url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo","forks_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/forks","keys_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/teams","hooks_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/hooks","issue_events_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/issues/events{/number}","events_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/events","assignees_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/assignees{/user}","branches_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/branches{/branch}","tags_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/tags","blobs_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/git/refs{/sha}","trees_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/statuses/{sha}","languages_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/languages","stargazers_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/stargazers","contributors_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/contributors","subscribers_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/subscribers","subscription_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/subscription","commits_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/commits{/sha}","git_commits_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/git/commits{/sha}","comments_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/comments{/number}","issue_comment_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/issues/comments{/number}","contents_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/contents/{+path}","compare_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/merges","archive_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/downloads","issues_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/issues{/number}","pulls_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/pulls{/number}","milestones_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/milestones{/number}","notifications_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/labels{/name}","releases_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/releases{/id}","deployments_url":"https://api.github.com/repos/AustinGreen/react-graphql-github-apollo/deployments","created_at":"2018-02-24T00:44:55Z","updated_at":"2018-02-24T00:44:57Z","pushed_at":"2018-03-06T00:01:09Z","git_url":"git://github.com/AustinGreen/react-graphql-github-apollo.git","ssh_url":"git@github.com:AustinGreen/react-graphql-github-apollo.git","clone_url":"https://github.com/AustinGreen/react-graphql-github-apollo.git","svn_url":"https://github.com/AustinGreen/react-graphql-github-apollo","homepage":"https://www.robinwieruch.de","size":197,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rwieruch:master","ref":"master","sha":"a10701534ec97ed9be9c96a90770f63f04e13ace","user":{"login":"rwieruch","id":2479967,"avatar_url":"https://avatars0.githubusercontent.com/u/2479967?v=4","gravatar_id":"","url":"https://api.github.com/users/rwieruch","html_url":"https://github.com/rwieruch","followers_url":"https://api.github.com/users/rwieruch/followers","following_url":"https://api.github.com/users/rwieruch/following{/other_user}","gists_url":"https://api.github.com/users/rwieruch/gists{/gist_id}","starred_url":"https://api.github.com/users/rwieruch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwieruch/subscriptions","organizations_url":"https://api.github.com/users/rwieruch/orgs","repos_url":"https://api.github.com/users/rwieruch/repos","events_url":"https://api.github.com/users/rwieruch/events{/privacy}","received_events_url":"https://api.github.com/users/rwieruch/received_events","type":"User","site_admin":false},"repo":{"id":119005072,"name":"react-graphql-github-apollo","full_name":"rwieruch/react-graphql-github-apollo","owner":{"login":"rwieruch","id":2479967,"avatar_url":"https://avatars0.githubusercontent.com/u/2479967?v=4","gravatar_id":"","url":"https://api.github.com/users/rwieruch","html_url":"https://github.com/rwieruch","followers_url":"https://api.github.com/users/rwieruch/followers","following_url":"https://api.github.com/users/rwieruch/following{/other_user}","gists_url":"https://api.github.com/users/rwieruch/gists{/gist_id}","starred_url":"https://api.github.com/users/rwieruch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwieruch/subscriptions","organizations_url":"https://api.github.com/users/rwieruch/orgs","repos_url":"https://api.github.com/users/rwieruch/repos","events_url":"https://api.github.com/users/rwieruch/events{/privacy}","received_events_url":"https://api.github.com/users/rwieruch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rwieruch/react-graphql-github-apollo","description":"🚀A React + Apollo + GraphQL GitHub Client. Your opportunity to learn about these technologies in a real world application.","fork":false,"url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo","forks_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/forks","keys_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/teams","hooks_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/hooks","issue_events_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues/events{/number}","events_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/events","assignees_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/assignees{/user}","branches_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/branches{/branch}","tags_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/tags","blobs_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/git/refs{/sha}","trees_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/statuses/{sha}","languages_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/languages","stargazers_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/stargazers","contributors_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/contributors","subscribers_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/subscribers","subscription_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/subscription","commits_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/commits{/sha}","git_commits_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/git/commits{/sha}","comments_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/comments{/number}","issue_comment_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues/comments{/number}","contents_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/contents/{+path}","compare_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/merges","archive_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/downloads","issues_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues{/number}","pulls_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls{/number}","milestones_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/milestones{/number}","notifications_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/labels{/name}","releases_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/releases{/id}","deployments_url":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/deployments","created_at":"2018-01-26T04:20:18Z","updated_at":"2018-03-07T09:59:36Z","pushed_at":"2018-03-06T00:01:10Z","git_url":"git://github.com/rwieruch/react-graphql-github-apollo.git","ssh_url":"git@github.com:rwieruch/react-graphql-github-apollo.git","clone_url":"https://github.com/rwieruch/react-graphql-github-apollo.git","svn_url":"https://github.com/rwieruch/react-graphql-github-apollo","homepage":"https://www.robinwieruch.de","size":193,"stargazers_count":501,"watchers_count":501,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":30,"open_issues":4,"watchers":501,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6"},"html":{"href":"https://github.com/rwieruch/react-graphql-github-apollo/pull/6"},"issue":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues/6"},"comments":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/rwieruch/react-graphql-github-apollo/statuses/c19e8ff5e146379f467add02630f7d62da2f22b6"}},"author_association":"NONE"}}
{"actor":{"display_login":"rwieruch"}}