payload: {"action":"created","comment":{"url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/comments/345056700","pull_request_review_id":315344562,"id":345056700,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM0NTA1NjcwMA==","diff_hunk":"@@ -0,0 +1,310 @@\n+import React, { Component } from 'react';\n+import { Link } from 'react-router-dom';\n+import axios from 'axios';\n+import { Base64 } from 'js-base64';\n+import PropTypes from 'prop-types';\n+import {\n+  prettifyResourceCategory,\n+  slugifyResourceCategory,\n+  frontMatterParser,\n+  concatFrontMatterMdBody,\n+  enquoteString,\n+  dequoteString,\n+  generateResourceFileName,\n+} from '../utils';\n+\n+const ResourceCardModal = ({\n+  title,\n+  category,\n+  date,\n+  permalink,\n+  fileUrl,\n+  resourceCategories,\n+  changeHandler,\n+  saveHandler,\n+  deleteHandler,\n+  permalinkFileUrlToggle,\n+  isNewPost,\n+}) => (\n+  <div>\n+    <p>Category</p>\n+    <select id=\"category\" defaultValue={slugifyResourceCategory(category)} onChange={changeHandler}>\n+      {\n+        resourceCategories.map((resourceCategory) => (\n+          <option\n+            value={slugifyResourceCategory(resourceCategory.dirName)}\n+            label={prettifyResourceCategory(resourceCategory.dirName)}\n+          />\n+        ))\n+      }\n+    </select>\n+    <p>Title</p>\n+    <input value={dequoteString(title)} id=\"title\" onChange={changeHandler} />\n+    <p>Date</p>\n+    <input value={date} id=\"date\" onChange={changeHandler} />","path":"src/components/ResourceCard.jsx","position":44,"original_position":44,"commit_id":"9cc901efacf6dc7d86ae118ba6182fbf14c90504","original_commit_id":"9cc901efacf6dc7d86ae118ba6182fbf14c90504","user":{"login":"prestonlimlianjie","id":19917616,"node_id":"MDQ6VXNlcjE5OTE3NjE2","avatar_url":"https://avatars1.githubusercontent.com/u/19917616?v=4","gravatar_id":"","url":"https://api.github.com/users/prestonlimlianjie","html_url":"https://github.com/prestonlimlianjie","followers_url":"https://api.github.com/users/prestonlimlianjie/followers","following_url":"https://api.github.com/users/prestonlimlianjie/following{/other_user}","gists_url":"https://api.github.com/users/prestonlimlianjie/gists{/gist_id}","starred_url":"https://api.github.com/users/prestonlimlianjie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestonlimlianjie/subscriptions","organizations_url":"https://api.github.com/users/prestonlimlianjie/orgs","repos_url":"https://api.github.com/users/prestonlimlianjie/repos","events_url":"https://api.github.com/users/prestonlimlianjie/events{/privacy}","received_events_url":"https://api.github.com/users/prestonlimlianjie/received_events","type":"User","site_admin":false},"body":"Agreed","created_at":"2019-11-12T07:54:07Z","updated_at":"2019-11-12T07:54:07Z","html_url":"https://github.com/isomerpages/isomercms-frontend/pull/42#discussion_r345056700","pull_request_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/comments/345056700"},"html":{"href":"https://github.com/isomerpages/isomercms-frontend/pull/42#discussion_r345056700"},"pull_request":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42"}},"in_reply_to_id":345041164},"pull_request":{"url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42","id":337963391,"node_id":"MDExOlB1bGxSZXF1ZXN0MzM3OTYzMzkx","html_url":"https://github.com/isomerpages/isomercms-frontend/pull/42","diff_url":"https://github.com/isomerpages/isomercms-frontend/pull/42.diff","patch_url":"https://github.com/isomerpages/isomercms-frontend/pull/42.patch","issue_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/42","number":42,"state":"open","locked":false,"title":"Add basic resource room functionality","user":{"login":"prestonlimlianjie","id":19917616,"node_id":"MDQ6VXNlcjE5OTE3NjE2","avatar_url":"https://avatars1.githubusercontent.com/u/19917616?v=4","gravatar_id":"","url":"https://api.github.com/users/prestonlimlianjie","html_url":"https://github.com/prestonlimlianjie","followers_url":"https://api.github.com/users/prestonlimlianjie/followers","following_url":"https://api.github.com/users/prestonlimlianjie/following{/other_user}","gists_url":"https://api.github.com/users/prestonlimlianjie/gists{/gist_id}","starred_url":"https://api.github.com/users/prestonlimlianjie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestonlimlianjie/subscriptions","organizations_url":"https://api.github.com/users/prestonlimlianjie/orgs","repos_url":"https://api.github.com/users/prestonlimlianjie/repos","events_url":"https://api.github.com/users/prestonlimlianjie/events{/privacy}","received_events_url":"https://api.github.com/users/prestonlimlianjie/received_events","type":"User","site_admin":false},"body":"### Overview\r\nThis PR adds the resource room functionality to the frontend (https://github.com/isomerpages/isomercms-frontend/issues/26). \r\n\r\n### High latency in the resource room because there are too many API calls\r\n\r\nThe image below is the InVision design for the resource room. \r\n\r\n![Screenshot 2019-11-11 at 12 39 37 PM](https://user-images.githubusercontent.com/19917616/68561402-61b81380-0480-11ea-8f32-91fdc8f33182.png)\r\n\r\nIn order to display the `title`, `post-type`, and `date`, the frontend would need to retrieve the data in the frontmatter of each resource page.\r\n\r\nHowever, this means the backend would have had to call many GitHub APIs:\r\n- 1 API call to list directory in the `resources` folder, and then\r\n- 1 API call for each directory to list the names of all files in the directory, and then\r\n- 1 API call for each file to retrieve the front matter.\r\n\r\nIf there were on average `m` directories and `n` files in each directory, the frontend would have to call `mn+1` GitHub APIs, which could take a really long time. \r\n\r\n### Reducing API calls by caching `title`, `post-type`, and `date` in the resource page filename\r\n\r\nInstead, we can reduce the number of GitHub API calls to `m+1` by caching the fields we needed to display in the file names of the resource pages.\r\n\r\nAnd so, the frontend only calls:\r\n- 1 API call to list directory in the `resources` folder (to get the resource categories), and then\r\n- 1 API call for each directory to list the names of all files in the directory (resource category).\r\n\r\nAnd so the resource pages file names follow the format `{date}-{post-type}-{title}.md`, where:\r\n- `date` is a string with the format `YYYY-MM-DD`,\r\n- `post-type` is a string with two types: `post` or `download`,\r\n- `title` is a case-sensitive string that can contain the following characters `a` to `z`, `A` to `Z`,  `0` to `9`, and hyphen.\r\n\r\n","created_at":"2019-11-07T10:25:29Z","updated_at":"2019-11-12T07:54:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b04b3cf228590005b211996197a4f29e79db191","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1637806816,"node_id":"MDU6TGFiZWwxNjM3ODA2ODE2","url":"https://api.github.com/repos/isomerpages/isomercms-frontend/labels/P1","name":"P1","color":"93e575","default":false},{"id":1621360764,"node_id":"MDU6TGFiZWwxNjIxMzYwNzY0","url":"https://api.github.com/repos/isomerpages/isomercms-frontend/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42/commits","review_comments_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42/comments","review_comment_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/42/comments","statuses_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/statuses/9cc901efacf6dc7d86ae118ba6182fbf14c90504","head":{"label":"isomerpages:resource-room","ref":"resource-room","sha":"9cc901efacf6dc7d86ae118ba6182fbf14c90504","user":{"login":"isomerpages","id":40887764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODg3NzY0","avatar_url":"https://avatars1.githubusercontent.com/u/40887764?v=4","gravatar_id":"","url":"https://api.github.com/users/isomerpages","html_url":"https://github.com/isomerpages","followers_url":"https://api.github.com/users/isomerpages/followers","following_url":"https://api.github.com/users/isomerpages/following{/other_user}","gists_url":"https://api.github.com/users/isomerpages/gists{/gist_id}","starred_url":"https://api.github.com/users/isomerpages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isomerpages/subscriptions","organizations_url":"https://api.github.com/users/isomerpages/orgs","repos_url":"https://api.github.com/users/isomerpages/repos","events_url":"https://api.github.com/users/isomerpages/events{/privacy}","received_events_url":"https://api.github.com/users/isomerpages/received_events","type":"Organization","site_admin":false},"repo":{"id":215690505,"node_id":"MDEwOlJlcG9zaXRvcnkyMTU2OTA1MDU=","name":"isomercms-frontend","full_name":"isomerpages/isomercms-frontend","private":false,"owner":{"login":"isomerpages","id":40887764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODg3NzY0","avatar_url":"https://avatars1.githubusercontent.com/u/40887764?v=4","gravatar_id":"","url":"https://api.github.com/users/isomerpages","html_url":"https://github.com/isomerpages","followers_url":"https://api.github.com/users/isomerpages/followers","following_url":"https://api.github.com/users/isomerpages/following{/other_user}","gists_url":"https://api.github.com/users/isomerpages/gists{/gist_id}","starred_url":"https://api.github.com/users/isomerpages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isomerpages/subscriptions","organizations_url":"https://api.github.com/users/isomerpages/orgs","repos_url":"https://api.github.com/users/isomerpages/repos","events_url":"https://api.github.com/users/isomerpages/events{/privacy}","received_events_url":"https://api.github.com/users/isomerpages/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/isomerpages/isomercms-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/isomerpages/isomercms-frontend","forks_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/forks","keys_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/teams","hooks_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/hooks","issue_events_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/events","assignees_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/tags","blobs_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/languages","stargazers_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/stargazers","contributors_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/contributors","subscribers_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/subscribers","subscription_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/subscription","commits_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/merges","archive_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/downloads","issues_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/labels{/name}","releases_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/deployments","created_at":"2019-10-17T02:55:51Z","updated_at":"2019-11-05T08:14:25Z","pushed_at":"2019-11-11T11:45:57Z","git_url":"git://github.com/isomerpages/isomercms-frontend.git","ssh_url":"git@github.com:isomerpages/isomercms-frontend.git","clone_url":"https://github.com/isomerpages/isomercms-frontend.git","svn_url":"https://github.com/isomerpages/isomercms-frontend","homepage":null,"size":573,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":19,"license":null,"forks":0,"open_issues":19,"watchers":1,"default_branch":"master"}},"base":{"label":"isomerpages:master","ref":"master","sha":"40a967c672130b542756dc2bba8389db4fb2bdc2","user":{"login":"isomerpages","id":40887764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODg3NzY0","avatar_url":"https://avatars1.githubusercontent.com/u/40887764?v=4","gravatar_id":"","url":"https://api.github.com/users/isomerpages","html_url":"https://github.com/isomerpages","followers_url":"https://api.github.com/users/isomerpages/followers","following_url":"https://api.github.com/users/isomerpages/following{/other_user}","gists_url":"https://api.github.com/users/isomerpages/gists{/gist_id}","starred_url":"https://api.github.com/users/isomerpages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isomerpages/subscriptions","organizations_url":"https://api.github.com/users/isomerpages/orgs","repos_url":"https://api.github.com/users/isomerpages/repos","events_url":"https://api.github.com/users/isomerpages/events{/privacy}","received_events_url":"https://api.github.com/users/isomerpages/received_events","type":"Organization","site_admin":false},"repo":{"id":215690505,"node_id":"MDEwOlJlcG9zaXRvcnkyMTU2OTA1MDU=","name":"isomercms-frontend","full_name":"isomerpages/isomercms-frontend","private":false,"owner":{"login":"isomerpages","id":40887764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODg3NzY0","avatar_url":"https://avatars1.githubusercontent.com/u/40887764?v=4","gravatar_id":"","url":"https://api.github.com/users/isomerpages","html_url":"https://github.com/isomerpages","followers_url":"https://api.github.com/users/isomerpages/followers","following_url":"https://api.github.com/users/isomerpages/following{/other_user}","gists_url":"https://api.github.com/users/isomerpages/gists{/gist_id}","starred_url":"https://api.github.com/users/isomerpages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isomerpages/subscriptions","organizations_url":"https://api.github.com/users/isomerpages/orgs","repos_url":"https://api.github.com/users/isomerpages/repos","events_url":"https://api.github.com/users/isomerpages/events{/privacy}","received_events_url":"https://api.github.com/users/isomerpages/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/isomerpages/isomercms-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/isomerpages/isomercms-frontend","forks_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/forks","keys_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/teams","hooks_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/hooks","issue_events_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/events","assignees_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/tags","blobs_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/languages","stargazers_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/stargazers","contributors_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/contributors","subscribers_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/subscribers","subscription_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/subscription","commits_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/merges","archive_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/downloads","issues_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/labels{/name}","releases_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/isomerpages/isomercms-frontend/deployments","created_at":"2019-10-17T02:55:51Z","updated_at":"2019-11-05T08:14:25Z","pushed_at":"2019-11-11T11:45:57Z","git_url":"git://github.com/isomerpages/isomercms-frontend.git","ssh_url":"git@github.com:isomerpages/isomercms-frontend.git","clone_url":"https://github.com/isomerpages/isomercms-frontend.git","svn_url":"https://github.com/isomerpages/isomercms-frontend","homepage":null,"size":573,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":19,"license":null,"forks":0,"open_issues":19,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42"},"html":{"href":"https://github.com/isomerpages/isomercms-frontend/pull/42"},"issue":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/42"},"comments":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/isomerpages/isomercms-frontend/statuses/9cc901efacf6dc7d86ae118ba6182fbf14c90504"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"prestonlimlianjie"}}