{"action":"created","comment":{"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/comments/103091324","pull_request_review_id":23869647,"id":103091324,"diff_hunk":"@@ -19,38 +31,135 @@ export default class DecisionReviewer extends React.Component {\n \n   nextPdf = () => {\n     this.setState({\n-      pdf: Math.min(this.state.pdf + 1, this.props.appealDocuments.length - 1)\n+      pdf: Math.min(this.state.pdf + 1, this.state.documents.length - 1)\n+    });\n+  }\n+\n+  showPdf = (pdfNumber) => () => {\n+    this.setState({\n+      pdf: pdfNumber\n+    });\n+  }\n+\n+  showList = () => {\n+    this.setState({\n+      pdf: null\n+    });\n+  }\n+\n+  sortAndFilter = () => {\n+    this.setState({\n+      documents: this.filterDocuments(\n+        this.sortDocuments(this.props.appealDocuments))\n+    });\n+  }\n+\n+  sortDocuments = (documents) => {\n+    let documentCopy = [...documents];\n+    let multiplier;\n+\n+    if (this.state.sortDirection === 'ascending') {\n+      multiplier = 1;\n+    } else if (this.state.sortDirection === 'descending') {\n+      multiplier = -1;\n+    } else {\n+      return;\n+    }\n+\n+    documentCopy.sort((doc1, doc2) => {\n+      if (this.state.sortBy === 'sortByDate') {\n+        return multiplier * (new Date(doc1.received_at) - new Date(doc2.received_at));\n+      } else if (this.state.sortBy === 'sortByType') {\n+        return multiplier * (doc1.type < doc2.type ? -1 : 1);\n+      } else if (this.state.sortBy === 'sortByFilename') {\n+        return multiplier * (doc1.filename < doc2.filename ? -1 : 1);\n+      }\n+\n+      return 0;\n+\n     });\n+\n+    return documentCopy;\n+  }\n+\n+  changeSortState = (sortBy) => () => {\n+    let sortDirection = this.state.sortDirection;\n+\n+    if (this.state.sortBy === sortBy) {\n+      if (sortDirection === 'ascending') {\n+        sortDirection = 'descending';\n+      } else {\n+        sortDirection = 'ascending';\n+      }\n+    } else {\n+      sortDirection = 'ascending';\n+    }\n+\n+    this.setState({\n+      sortBy,\n+      sortDirection\n+    }, this.sortAndFilter);\n   }\n \n-  componentDidMount() {\n-    window.addEventListener('keydown', (event) => {\n-      if (event.key === 'ArrowLeft') {\n-        this.previousPdf();\n+  filterDocuments = (documents) => {","path":"client/app/containers/DecisionReviewer.jsx","position":105,"original_position":105,"commit_id":"081cb64796fcf2b213e486b661e63543e3ac3a7d","original_commit_id":"081cb64796fcf2b213e486b661e63543e3ac3a7d","user":{"login":"mdbenjam","id":3885236,"avatar_url":"https://avatars.githubusercontent.com/u/3885236?v=3","gravatar_id":"","url":"https://api.github.com/users/mdbenjam","html_url":"https://github.com/mdbenjam","followers_url":"https://api.github.com/users/mdbenjam/followers","following_url":"https://api.github.com/users/mdbenjam/following{/other_user}","gists_url":"https://api.github.com/users/mdbenjam/gists{/gist_id}","starred_url":"https://api.github.com/users/mdbenjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdbenjam/subscriptions","organizations_url":"https://api.github.com/users/mdbenjam/orgs","repos_url":"https://api.github.com/users/mdbenjam/repos","events_url":"https://api.github.com/users/mdbenjam/events{/privacy}","received_events_url":"https://api.github.com/users/mdbenjam/received_events","type":"User","site_admin":false},"body":"Not labels yet, but it will in the next PR.","created_at":"2017-02-25T23:28:34Z","updated_at":"2017-02-25T23:28:34Z","html_url":"https://github.com/department-of-veterans-affairs/caseflow/pull/1015#discussion_r103091324","pull_request_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015","_links":{"self":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/comments/103091324"},"html":{"href":"https://github.com/department-of-veterans-affairs/caseflow/pull/1015#discussion_r103091324"},"pull_request":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015"}}},"pull_request":{"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015","id":107856340,"html_url":"https://github.com/department-of-veterans-affairs/caseflow/pull/1015","diff_url":"https://github.com/department-of-veterans-affairs/caseflow/pull/1015.diff","patch_url":"https://github.com/department-of-veterans-affairs/caseflow/pull/1015.patch","issue_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/1015","number":1015,"state":"open","locked":false,"title":"E-reader UI changes","user":{"login":"mdbenjam","id":3885236,"avatar_url":"https://avatars.githubusercontent.com/u/3885236?v=3","gravatar_id":"","url":"https://api.github.com/users/mdbenjam","html_url":"https://github.com/mdbenjam","followers_url":"https://api.github.com/users/mdbenjam/followers","following_url":"https://api.github.com/users/mdbenjam/following{/other_user}","gists_url":"https://api.github.com/users/mdbenjam/gists{/gist_id}","starred_url":"https://api.github.com/users/mdbenjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdbenjam/subscriptions","organizations_url":"https://api.github.com/users/mdbenjam/orgs","repos_url":"https://api.github.com/users/mdbenjam/repos","events_url":"https://api.github.com/users/mdbenjam/events{/privacy}","received_events_url":"https://api.github.com/users/mdbenjam/received_events","type":"User","site_admin":false},"body":"Adding UI improvements to:\r\n- Provide a list view of documents\r\n- Show the number of comments for each document in that list view\r\n- Allow navigation into documents from the list view\r\n- Allow sorting and searching of documents\r\n\r\n**Test Plan**\r\n- [ ] Verify the above manually\r\n- [ ] Make sure there are no regressions to certification or dispatch.\r\n\r\n![screen shot 2017-02-24 at 3 40 57 pm](https://cloud.githubusercontent.com/assets/3885236/23320172/aa37160a-faa7-11e6-884b-bfb30bc74cfa.png)\r\n","created_at":"2017-02-24T16:02:08Z","updated_at":"2017-02-25T23:28:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebabe4e8d2b856f7e16135dd9281e5b30d44d262","assignee":{"login":"amprokop","id":3781835,"avatar_url":"https://avatars.githubusercontent.com/u/3781835?v=3","gravatar_id":"","url":"https://api.github.com/users/amprokop","html_url":"https://github.com/amprokop","followers_url":"https://api.github.com/users/amprokop/followers","following_url":"https://api.github.com/users/amprokop/following{/other_user}","gists_url":"https://api.github.com/users/amprokop/gists{/gist_id}","starred_url":"https://api.github.com/users/amprokop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amprokop/subscriptions","organizations_url":"https://api.github.com/users/amprokop/orgs","repos_url":"https://api.github.com/users/amprokop/repos","events_url":"https://api.github.com/users/amprokop/events{/privacy}","received_events_url":"https://api.github.com/users/amprokop/received_events","type":"User","site_admin":false},"assignees":[{"login":"amprokop","id":3781835,"avatar_url":"https://avatars.githubusercontent.com/u/3781835?v=3","gravatar_id":"","url":"https://api.github.com/users/amprokop","html_url":"https://github.com/amprokop","followers_url":"https://api.github.com/users/amprokop/followers","following_url":"https://api.github.com/users/amprokop/following{/other_user}","gists_url":"https://api.github.com/users/amprokop/gists{/gist_id}","starred_url":"https://api.github.com/users/amprokop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amprokop/subscriptions","organizations_url":"https://api.github.com/users/amprokop/orgs","repos_url":"https://api.github.com/users/amprokop/repos","events_url":"https://api.github.com/users/amprokop/events{/privacy}","received_events_url":"https://api.github.com/users/amprokop/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015/commits","review_comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015/comments","review_comment_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/1015/comments","statuses_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/statuses/081cb64796fcf2b213e486b661e63543e3ac3a7d","head":{"label":"department-of-veterans-affairs:mdbenjam-kavi-crazy","ref":"mdbenjam-kavi-crazy","sha":"081cb64796fcf2b213e486b661e63543e3ac3a7d","user":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"repo":{"id":51449239,"name":"caseflow","full_name":"department-of-veterans-affairs/caseflow","owner":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/department-of-veterans-affairs/caseflow","description":"Caseflow is a web application that enables the tracking and processing of appealed claims at the Board of Veterans' Appeals.","fork":false,"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow","forks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/forks","keys_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/teams","hooks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/hooks","issue_events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/events{/number}","events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/events","assignees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/assignees{/user}","branches_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/branches{/branch}","tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/tags","blobs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/statuses/{sha}","languages_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/languages","stargazers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/stargazers","contributors_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/contributors","subscribers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/subscribers","subscription_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/subscription","commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/contents/{+path}","compare_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/merges","archive_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/downloads","issues_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues{/number}","pulls_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls{/number}","milestones_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/milestones{/number}","notifications_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/labels{/name}","releases_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/releases{/id}","deployments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/deployments","created_at":"2016-02-10T15:20:50Z","updated_at":"2017-02-07T20:29:15Z","pushed_at":"2017-02-25T22:59:15Z","git_url":"git://github.com/department-of-veterans-affairs/caseflow.git","ssh_url":"git@github.com:department-of-veterans-affairs/caseflow.git","clone_url":"https://github.com/department-of-veterans-affairs/caseflow.git","svn_url":"https://github.com/department-of-veterans-affairs/caseflow","homepage":"","size":8222,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":138,"forks":8,"open_issues":138,"watchers":4,"default_branch":"master"}},"base":{"label":"department-of-veterans-affairs:master","ref":"master","sha":"0ddb6e6e470f009a9da83e0fab894caf28b0e34c","user":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"repo":{"id":51449239,"name":"caseflow","full_name":"department-of-veterans-affairs/caseflow","owner":{"login":"department-of-veterans-affairs","id":5421563,"avatar_url":"https://avatars.githubusercontent.com/u/5421563?v=3","gravatar_id":"","url":"https://api.github.com/users/department-of-veterans-affairs","html_url":"https://github.com/department-of-veterans-affairs","followers_url":"https://api.github.com/users/department-of-veterans-affairs/followers","following_url":"https://api.github.com/users/department-of-veterans-affairs/following{/other_user}","gists_url":"https://api.github.com/users/department-of-veterans-affairs/gists{/gist_id}","starred_url":"https://api.github.com/users/department-of-veterans-affairs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/department-of-veterans-affairs/subscriptions","organizations_url":"https://api.github.com/users/department-of-veterans-affairs/orgs","repos_url":"https://api.github.com/users/department-of-veterans-affairs/repos","events_url":"https://api.github.com/users/department-of-veterans-affairs/events{/privacy}","received_events_url":"https://api.github.com/users/department-of-veterans-affairs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/department-of-veterans-affairs/caseflow","description":"Caseflow is a web application that enables the tracking and processing of appealed claims at the Board of Veterans' Appeals.","fork":false,"url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow","forks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/forks","keys_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/teams","hooks_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/hooks","issue_events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/events{/number}","events_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/events","assignees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/assignees{/user}","branches_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/branches{/branch}","tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/tags","blobs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/statuses/{sha}","languages_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/languages","stargazers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/stargazers","contributors_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/contributors","subscribers_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/subscribers","subscription_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/subscription","commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/contents/{+path}","compare_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/merges","archive_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/downloads","issues_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues{/number}","pulls_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls{/number}","milestones_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/milestones{/number}","notifications_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/labels{/name}","releases_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/releases{/id}","deployments_url":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/deployments","created_at":"2016-02-10T15:20:50Z","updated_at":"2017-02-07T20:29:15Z","pushed_at":"2017-02-25T22:59:15Z","git_url":"git://github.com/department-of-veterans-affairs/caseflow.git","ssh_url":"git@github.com:department-of-veterans-affairs/caseflow.git","clone_url":"https://github.com/department-of-veterans-affairs/caseflow.git","svn_url":"https://github.com/department-of-veterans-affairs/caseflow","homepage":"","size":8222,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":138,"forks":8,"open_issues":138,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015"},"html":{"href":"https://github.com/department-of-veterans-affairs/caseflow/pull/1015"},"issue":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/1015"},"comments":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/issues/1015/comments"},"review_comments":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015/comments"},"review_comment":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/pulls/1015/commits"},"statuses":{"href":"https://api.github.com/repos/department-of-veterans-affairs/caseflow/statuses/081cb64796fcf2b213e486b661e63543e3ac3a7d"}}}}
{"actor":{"display_login":"mdbenjam"}}