{"action":"created","comment":{"url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/comments/242349449","pull_request_review_id":185839042,"id":242349449,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjM0OTQ0OQ==","diff_hunk":"@@ -1,15 +1,147 @@\n import React from 'react';\n+import { isAdmin } from '../../../backend/lib/auth';\n+import { createPost } from '../../api/api';\n \n require('./AdminContainer.css');\n \n+// TODO:\n+// \n class AdminContainer extends React.Component {\n-    render() {\n+\n+    state = {\n+        title: '',\n+        description: '',\n+        contactName: '',\n+        contactEmail: '',\n+        contactPhone: '',\n+        update: '',\n+        createEmergency: false,\n+        updateEmergency: false,\n+    }\n+\n+    createNewEmergency = () => {\n+        this.setState({\n+            createEmergency: true,\n+            updateEmergency: false,\n+        });\n+    }\n+\n+    updateEmergency = () => {\n+        this.setState({\n+            createEmergency: false,\n+            updateEmergency: true,\n+        });\n+    }\n+\n+    handleInputChange = (event) => {\n+        const target = event.target;\n+        const name = target.name;\n+        this.setState({\n+            [name]: value,\n+        })\n+    }\n+\n+    handleNewSubmit = (event) => {\n+        const emergency = {\n+            title: this.state[title],\n+            description: this.state[description],\n+            contactName: this.state[contactName],\n+            contactEmail: this.state[contactEmail],\n+            contactPhone: this.state[contactPhone],\n+        }\n+        createPost(emergency).catch( (error) => {\n+            console.log('Error creating post', error);\n+        });\n+\n+        event.preventDefault();\n+    }\n+\n+    handleUpdateSubmit = (event) => {\n+        createPost(emergency).catch( (error) => {\n+            console.log('Error creating post', error);\n+        });\n+        event.preventDefault();\n+    }\n+\n+    showNewEmergency = () => {\n+        return (\n+            <div>\n+                <p>Report a new emergency. Make sure all details are correct before publishing.</p>\n+                <form onSubmit={this.handleNewSubmit}>\n+                    <div class=\"inputGroup\">\n+                        <label for=\"title\">Title</label>\n+                        <input type=\"text\" name=\"title\" id=\"title\"/>\n+                    </div>\n+                    <div class=\"inputGroup\">\n+                        <label for=\"description\">Description</label>\n+                        <input type=\"text\" name=\"description\" id=\"description\"/>\n+                    </div>\n+                    <div class=\"inputGroup\">\n+                        <label for=\"contactName\">Contact Name</label>\n+                        <input type=\"text\" name=\"contactName\" id=\"contactName\"/>\n+                    </div>\n+                    <div class=\"inputGroup\">\n+                        <label for=\"contactEmail\">Contact Email</label>\n+                        <input type=\"email\" name=\"contactEmail\" id=\"contactEmail\"/>\n+                    </div>\n+                    <div class=\"inputGroup\">\n+                        <label for=\"contactPhone\">Contact Phone</label>\n+                        <input type=\"tel\" name=\"contactPhone\" id=\"contactPhone\"/>\n+                    </div>\n+                </form>\n+            </div>\n+        );\n+    }\n+\n+    showEmergencies = () => {\n+        // TODO : determine how to display all current emergencies, and allow admin\n+        // to choose one to update\n+        return (\n+            <div></div>\n+        );\n+    }\n+\n+    showUpdateEmergency = () => {\n         return (\n             <div>\n-                admin stuff\n+                <p>Update an existing emergency.</p>\n+                <form onSubmit={this.handleUpdateSubmit}>\n+                    <div class=\"input-group\">\n+                        <label for=\"update\">Update</label>\n+                        <input type=\"text\" name=\"update\" id=\"update\"/>\n+                    </div>\n+                </form>\n             </div>\n         );\n     }\n+\n+    render() {\n+        const newEmergency = this.showNewEmergency();\n+        const updateEmergency = this.updateEmergency();\n+        if (this.state.userData && isAdmin(this.state.userData)) {\n+            // Render page if user is logged in, and is an admin\n+            return (\n+                <div>\n+                    <p>Either create a new emergency, or update an existing emergency</p>\n+                    <div>\n+                        <a onClick={this.createNewEmergency}><div>Create New Emergency</div></a>","path":"src/containers/AdminContainer/AdminContainer.js","position":129,"original_position":129,"commit_id":"96733b99af1c2b7fc8705d508bd60a8d490ea98b","original_commit_id":"96733b99af1c2b7fc8705d508bd60a8d490ea98b","user":{"login":"jeffreyxiong","id":9297278,"node_id":"MDQ6VXNlcjkyOTcyNzg=","avatar_url":"https://avatars1.githubusercontent.com/u/9297278?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffreyxiong","html_url":"https://github.com/jeffreyxiong","followers_url":"https://api.github.com/users/jeffreyxiong/followers","following_url":"https://api.github.com/users/jeffreyxiong/following{/other_user}","gists_url":"https://api.github.com/users/jeffreyxiong/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffreyxiong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffreyxiong/subscriptions","organizations_url":"https://api.github.com/users/jeffreyxiong/orgs","repos_url":"https://api.github.com/users/jeffreyxiong/repos","events_url":"https://api.github.com/users/jeffreyxiong/events{/privacy}","received_events_url":"https://api.github.com/users/jeffreyxiong/received_events","type":"User","site_admin":false},"body":"Wanted to leave more flexibility for styling. will change to just button","created_at":"2018-12-17T22:58:06Z","updated_at":"2018-12-17T22:58:06Z","html_url":"https://github.com/codeforsanjose/disaster-response-sj/pull/24#discussion_r242349449","pull_request_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/comments/242349449"},"html":{"href":"https://github.com/codeforsanjose/disaster-response-sj/pull/24#discussion_r242349449"},"pull_request":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24"}},"in_reply_to_id":241995098},"pull_request":{"url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24","id":238882088,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4ODgyMDg4","html_url":"https://github.com/codeforsanjose/disaster-response-sj/pull/24","diff_url":"https://github.com/codeforsanjose/disaster-response-sj/pull/24.diff","patch_url":"https://github.com/codeforsanjose/disaster-response-sj/pull/24.patch","issue_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/24","number":24,"state":"open","locked":false,"title":"admin work","user":{"login":"jeffreyxiong","id":9297278,"node_id":"MDQ6VXNlcjkyOTcyNzg=","avatar_url":"https://avatars1.githubusercontent.com/u/9297278?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffreyxiong","html_url":"https://github.com/jeffreyxiong","followers_url":"https://api.github.com/users/jeffreyxiong/followers","following_url":"https://api.github.com/users/jeffreyxiong/following{/other_user}","gists_url":"https://api.github.com/users/jeffreyxiong/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffreyxiong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffreyxiong/subscriptions","organizations_url":"https://api.github.com/users/jeffreyxiong/orgs","repos_url":"https://api.github.com/users/jeffreyxiong/repos","events_url":"https://api.github.com/users/jeffreyxiong/events{/privacy}","received_events_url":"https://api.github.com/users/jeffreyxiong/received_events","type":"User","site_admin":false},"body":"Initial work, still have some pieces missing.","created_at":"2018-12-15T01:35:02Z","updated_at":"2018-12-17T22:58:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79f25389cf9c79b17654406684f7b5c1dd47bdda","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24/commits","review_comments_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24/comments","review_comment_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/24/comments","statuses_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/statuses/96733b99af1c2b7fc8705d508bd60a8d490ea98b","head":{"label":"codeforsanjose:feature/admin-page","ref":"feature/admin-page","sha":"96733b99af1c2b7fc8705d508bd60a8d490ea98b","user":{"login":"codeforsanjose","id":6627417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2Mjc0MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/6627417?v=4","gravatar_id":"","url":"https://api.github.com/users/codeforsanjose","html_url":"https://github.com/codeforsanjose","followers_url":"https://api.github.com/users/codeforsanjose/followers","following_url":"https://api.github.com/users/codeforsanjose/following{/other_user}","gists_url":"https://api.github.com/users/codeforsanjose/gists{/gist_id}","starred_url":"https://api.github.com/users/codeforsanjose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeforsanjose/subscriptions","organizations_url":"https://api.github.com/users/codeforsanjose/orgs","repos_url":"https://api.github.com/users/codeforsanjose/repos","events_url":"https://api.github.com/users/codeforsanjose/events{/privacy}","received_events_url":"https://api.github.com/users/codeforsanjose/received_events","type":"Organization","site_admin":false},"repo":{"id":104426019,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ0MjYwMTk=","name":"disaster-response-sj","full_name":"codeforsanjose/disaster-response-sj","private":false,"owner":{"login":"codeforsanjose","id":6627417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2Mjc0MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/6627417?v=4","gravatar_id":"","url":"https://api.github.com/users/codeforsanjose","html_url":"https://github.com/codeforsanjose","followers_url":"https://api.github.com/users/codeforsanjose/followers","following_url":"https://api.github.com/users/codeforsanjose/following{/other_user}","gists_url":"https://api.github.com/users/codeforsanjose/gists{/gist_id}","starred_url":"https://api.github.com/users/codeforsanjose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeforsanjose/subscriptions","organizations_url":"https://api.github.com/users/codeforsanjose/orgs","repos_url":"https://api.github.com/users/codeforsanjose/repos","events_url":"https://api.github.com/users/codeforsanjose/events{/privacy}","received_events_url":"https://api.github.com/users/codeforsanjose/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/codeforsanjose/disaster-response-sj","description":"Exploration of adding civic tech component to San Jose disaster response","fork":false,"url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj","forks_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/forks","keys_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/teams","hooks_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/hooks","issue_events_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/events{/number}","events_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/events","assignees_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/assignees{/user}","branches_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/branches{/branch}","tags_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/tags","blobs_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/refs{/sha}","trees_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/statuses/{sha}","languages_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/languages","stargazers_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/stargazers","contributors_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/contributors","subscribers_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/subscribers","subscription_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/subscription","commits_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/commits{/sha}","git_commits_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/commits{/sha}","comments_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/comments{/number}","issue_comment_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/comments{/number}","contents_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/contents/{+path}","compare_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/merges","archive_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/downloads","issues_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues{/number}","pulls_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls{/number}","milestones_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/milestones{/number}","notifications_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/labels{/name}","releases_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/releases{/id}","deployments_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/deployments","created_at":"2017-09-22T03:14:56Z","updated_at":"2018-12-05T04:36:43Z","pushed_at":"2018-12-15T01:35:03Z","git_url":"git://github.com/codeforsanjose/disaster-response-sj.git","ssh_url":"git@github.com:codeforsanjose/disaster-response-sj.git","clone_url":"https://github.com/codeforsanjose/disaster-response-sj.git","svn_url":"https://github.com/codeforsanjose/disaster-response-sj","homepage":null,"size":212,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":12,"license":null,"forks":3,"open_issues":12,"watchers":1,"default_branch":"master"}},"base":{"label":"codeforsanjose:develop","ref":"develop","sha":"915b7638e555fa098d6f338f2548e8d4655e89a3","user":{"login":"codeforsanjose","id":6627417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2Mjc0MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/6627417?v=4","gravatar_id":"","url":"https://api.github.com/users/codeforsanjose","html_url":"https://github.com/codeforsanjose","followers_url":"https://api.github.com/users/codeforsanjose/followers","following_url":"https://api.github.com/users/codeforsanjose/following{/other_user}","gists_url":"https://api.github.com/users/codeforsanjose/gists{/gist_id}","starred_url":"https://api.github.com/users/codeforsanjose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeforsanjose/subscriptions","organizations_url":"https://api.github.com/users/codeforsanjose/orgs","repos_url":"https://api.github.com/users/codeforsanjose/repos","events_url":"https://api.github.com/users/codeforsanjose/events{/privacy}","received_events_url":"https://api.github.com/users/codeforsanjose/received_events","type":"Organization","site_admin":false},"repo":{"id":104426019,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ0MjYwMTk=","name":"disaster-response-sj","full_name":"codeforsanjose/disaster-response-sj","private":false,"owner":{"login":"codeforsanjose","id":6627417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2Mjc0MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/6627417?v=4","gravatar_id":"","url":"https://api.github.com/users/codeforsanjose","html_url":"https://github.com/codeforsanjose","followers_url":"https://api.github.com/users/codeforsanjose/followers","following_url":"https://api.github.com/users/codeforsanjose/following{/other_user}","gists_url":"https://api.github.com/users/codeforsanjose/gists{/gist_id}","starred_url":"https://api.github.com/users/codeforsanjose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeforsanjose/subscriptions","organizations_url":"https://api.github.com/users/codeforsanjose/orgs","repos_url":"https://api.github.com/users/codeforsanjose/repos","events_url":"https://api.github.com/users/codeforsanjose/events{/privacy}","received_events_url":"https://api.github.com/users/codeforsanjose/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/codeforsanjose/disaster-response-sj","description":"Exploration of adding civic tech component to San Jose disaster response","fork":false,"url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj","forks_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/forks","keys_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/teams","hooks_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/hooks","issue_events_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/events{/number}","events_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/events","assignees_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/assignees{/user}","branches_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/branches{/branch}","tags_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/tags","blobs_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/refs{/sha}","trees_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/statuses/{sha}","languages_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/languages","stargazers_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/stargazers","contributors_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/contributors","subscribers_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/subscribers","subscription_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/subscription","commits_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/commits{/sha}","git_commits_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/git/commits{/sha}","comments_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/comments{/number}","issue_comment_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/comments{/number}","contents_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/contents/{+path}","compare_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/merges","archive_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/downloads","issues_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues{/number}","pulls_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls{/number}","milestones_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/milestones{/number}","notifications_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/labels{/name}","releases_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/releases{/id}","deployments_url":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/deployments","created_at":"2017-09-22T03:14:56Z","updated_at":"2018-12-05T04:36:43Z","pushed_at":"2018-12-15T01:35:03Z","git_url":"git://github.com/codeforsanjose/disaster-response-sj.git","ssh_url":"git@github.com:codeforsanjose/disaster-response-sj.git","clone_url":"https://github.com/codeforsanjose/disaster-response-sj.git","svn_url":"https://github.com/codeforsanjose/disaster-response-sj","homepage":null,"size":212,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":12,"license":null,"forks":3,"open_issues":12,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24"},"html":{"href":"https://github.com/codeforsanjose/disaster-response-sj/pull/24"},"issue":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/24"},"comments":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/codeforsanjose/disaster-response-sj/statuses/96733b99af1c2b7fc8705d508bd60a8d490ea98b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jeffreyxiong"}}