├── .babelrc ├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── jest.config.json ├── package.json ├── src ├── components │ ├── bootstrap │ │ ├── bootstrap.spec.jsx │ │ └── bootstrap.tsx │ ├── footer │ │ ├── footer.css │ │ ├── footer.spec.tsx │ │ └── footer.tsx │ ├── header │ │ ├── header.css │ │ ├── header.spec.tsx │ │ └── header.tsx │ ├── hello-world │ │ ├── hello-world.spec.tsx │ │ └── hello-world.tsx │ ├── navigation │ │ ├── navigation.css │ │ ├── navigation.spec.tsx │ │ └── navigation.tsx │ ├── repositories-table │ │ ├── __snapshots__ │ │ │ └── repositories-table.spec.tsx.snap │ │ ├── fork-icon.svg │ │ ├── repositories-table.css │ │ ├── repositories-table.spec.tsx │ │ └── repositories-table.tsx │ └── user-details │ │ ├── user-details.css │ │ ├── user-details.spec.tsx │ │ └── user-details.tsx ├── index.html ├── index.tsx ├── routes.tsx ├── services │ ├── __mocks__ │ │ └── credentials.ts │ ├── credentials.spec.tsx │ ├── credentials.ts.tmpl │ ├── github-api.spec.tsx │ └── github-api.ts ├── stores │ ├── github-store.spec.tsx │ └── github-store.ts └── views │ ├── following │ ├── following.spec.tsx │ └── following.tsx │ └── personal │ ├── personal.spec.tsx │ └── personal.tsx ├── test ├── mocks │ ├── file-mock.js │ ├── issues-user-repository.json │ ├── issues-user-subscription.json │ ├── style-mock.js │ ├── user-details.json │ ├── user-repositories.json │ └── user-subscriptions.json ├── test-preprocessor.js └── test-setup.js ├── tsconfig.json ├── webpack.config.common.js ├── webpack.config.develop.js ├── webpack.config.prod.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "react"] 3 | } -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: thegreenhouse/nodejs-dev:0.3.0 6 | 7 | working_directory: ~/repo 8 | 9 | steps: 10 | - checkout 11 | 12 | # Download and cache dependencies 13 | - restore_cache: 14 | keys: 15 | - v1-dependencies-{{ checksum "package.json" }} 16 | # fallback to using the latest cache if no exact match is found 17 | - v1-dependencies- 18 | 19 | - run: 20 | name: Install Project Dependencies 21 | command: yarn install 22 | 23 | # tests expect this to be done 24 | # to ensure a credentials file is available 25 | - run: 26 | name: Run Setup 27 | command: yarn setup 28 | 29 | - run: 30 | name: Run Tests 31 | command: yarn test 32 | 33 | - store_test_results: 34 | path: reports/test-results 35 | 36 | - run: 37 | name: Run Build 38 | command: yarn build -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = false 7 | indent_size = 2 8 | indent_style = space 9 | trim_trailing_whitespace = true -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "parserOptions": { 4 | "ecmaVersion": 6, 5 | "ecmaFeatures": { 6 | "jsx": true 7 | }, 8 | "sourceType": "module" 9 | }, 10 | "extends": [ 11 | "plugin:react/recommended" 12 | ], 13 | "env": { 14 | "browser": true, 15 | "node": true 16 | }, 17 | "plugins": ["react"], 18 | "rules": { 19 | "comma-dangle": [2,"never"], 20 | "no-cond-assign": 2, 21 | "no-console": 2, 22 | "no-constant-condition": 2, 23 | "no-control-regex": 0, 24 | "no-debugger": 0, 25 | "no-dupe-args": 0, 26 | "no-dupe-keys": 0, 27 | "no-duplicate-case": 2, 28 | "no-empty-character-class": 0, 29 | "no-empty": 2, 30 | "no-ex-assign": 2, 31 | "no-extra-boolean-cast": 2, 32 | "no-extra-parens": [2, "all", { 33 | "conditionalAssign": false, 34 | "returnAssign": false, 35 | "nestedBinaryExpressions": false 36 | }], 37 | "no-extra-semi": 2, 38 | "no-func-assign": 2, 39 | "no-inner-declarations": 2, 40 | "no-invalid-regexp": 0, 41 | "no-irregular-whitespace": 2, 42 | "no-negated-in-lhs": 2, 43 | "no-obj-calls": 0, 44 | "no-regex-spaces": 0, 45 | "no-sparse-arrays": 2, 46 | "no-unreachable": 2, 47 | "use-isnan": 2, 48 | "valid-jsdoc": 0, 49 | "valid-typeof": 0, 50 | "no-unexpected-multiline": 0, 51 | "accessor-pairs": 2, 52 | "block-scoped-var": 2, 53 | "complexity": 2, 54 | "consistent-return": 0, 55 | "curly": 2, 56 | "default-case": 2, 57 | "dot-notation": 2, 58 | "dot-location": 0, 59 | "eqeqeq": [2,"allow-null"], 60 | "guard-for-in": 0, 61 | "no-alert": 0, 62 | "no-caller": 0, 63 | "no-div-regex": 0, 64 | "no-else-return": 0, 65 | "no-empty-label": 0, 66 | "no-eq-null": 0, 67 | "no-eval": 2, 68 | "no-extend-native": 0, 69 | "no-extra-bind": 2, 70 | "no-fallthrough": 2, 71 | "no-floating-decimal": 2, 72 | "no-implicit-coercion": [2,{"number":true,"string":true,"boolean":false}], 73 | "no-implied-eval": 2, 74 | "no-invalid-this": 0, 75 | "no-iterator": 2, 76 | "no-labels": 0, 77 | "no-lone-blocks": 0, 78 | "no-loop-func": 2, 79 | "no-multi-spaces": 2, 80 | "no-multi-str": 0, 81 | "no-native-reassign": 0, 82 | "no-new-func": 0, 83 | "no-new-wrappers": 2, 84 | "no-new": 2, 85 | "no-octal-escape": 0, 86 | "no-octal": 0, 87 | "no-param-reassign": 0, 88 | "no-process-env": 0, 89 | "no-proto": 0, 90 | "no-redeclare": 2, 91 | "no-return-assign": 0, 92 | "no-script-url": 0, 93 | "no-self-compare": 0, 94 | "no-sequences": 0, 95 | "no-throw-literal": 2, 96 | "no-unused-expressions": 0, 97 | "no-useless-call": 0, 98 | "no-void": 0, 99 | "no-warning-comments": [1,{"terms":["todo"," fixme"," TODO"," FIXME"],"location":"anywhere"}], 100 | "no-with": 0, 101 | "radix": 2, 102 | "vars-on-top": 2, 103 | "wrap-iife": [2,"inside"], 104 | "yoda": 0, 105 | "strict": [2,"global"], 106 | "init-declarations": 0, 107 | "no-catch-shadow": 2, 108 | "no-delete-var": 2, 109 | "no-label-var": 0, 110 | "no-shadow-restricted-names": 0, 111 | "no-shadow": 0, 112 | "no-undef-init": 0, 113 | "no-undef": 0, 114 | "no-undefined": 0, 115 | "no-unused-vars": 2, 116 | "no-use-before-define": 0, 117 | "callback-return": 0, 118 | "handle-callback-err": 2, 119 | "no-mixed-requires": 0, 120 | "no-new-require": 0, 121 | "no-path-concat": 2, 122 | "no-process-exit": 2, 123 | "no-restricted-modules": 0, 124 | "no-sync": 0, 125 | "array-bracket-spacing": 2, 126 | "brace-style": [2,"1tbs",{"allowSingleLine":true}], 127 | "camelcase": 2, 128 | "comma-spacing": 2, 129 | "comma-style": [2,"last"], 130 | "computed-property-spacing": 0, 131 | "consistent-this": [0, "self", "that"], 132 | "eol-last": 0, 133 | "func-names": 0, 134 | "func-style": 0, 135 | "id-length": 0, 136 | "indent": [2, 2, { 137 | "VariableDeclarator": 1, 138 | "SwitchCase": 1 139 | }], 140 | "key-spacing": [2,{"beforeColon":false,"afterColon":true}], 141 | "lines-around-comment": 0, 142 | "linebreak-style": 0, 143 | "max-nested-callbacks": [2, {"maximum":8}], 144 | "new-cap": 2, 145 | "new-parens": 2, 146 | "newline-after-var": 2, 147 | "no-array-constructor": 2, 148 | "no-continue": 0, 149 | "no-inline-comments": 0, 150 | "no-lonely-if": 0, 151 | "no-mixed-spaces-and-tabs": [2,"smart-tabs"], 152 | "no-multiple-empty-lines": [2,{"max":1}], 153 | "no-nested-ternary": 0, 154 | "no-new-object": 2, 155 | "no-spaced-func": 2, 156 | "no-ternary": 0, 157 | "no-trailing-spaces": 0, 158 | "no-underscore-dangle": [2, { "allowAfterThis": true }], 159 | "no-unneeded-ternary": 2, 160 | "object-curly-spacing": [2,"always",{}], 161 | "one-var": 0, 162 | "operator-assignment": 0, 163 | "operator-linebreak": 0, 164 | "padded-blocks": [2, {"switches":"always"}], 165 | "quote-props": [2, "consistent"], 166 | "quotes": [2,"single","avoid-escape"], 167 | "id-match": 0, 168 | "semi-spacing": [2,{"after":true}], 169 | "semi": [2,"always"], 170 | "sort-vars": 0, 171 | "keyword-spacing": 2, 172 | "space-before-blocks": 2, 173 | "space-before-function-paren": 0, 174 | "space-in-parens": 2, 175 | "space-infix-ops": 2, 176 | "space-return-throw-case": 0, 177 | "space-unary-ops": 0, 178 | "spaced-comment": [2, "always", { 179 | "line": { 180 | "markers": ["/"], 181 | "exceptions": ["-", "+"] 182 | }, 183 | "block": { 184 | "markers": ["!"], 185 | "exceptions": ["*"] 186 | } 187 | }], 188 | "wrap-regex": 2, 189 | "arrow-parens": 0, 190 | "arrow-spacing": 0, 191 | "constructor-super": 0, 192 | "generator-star-spacing": 0, 193 | "no-class-assign": 0, 194 | "no-const-assign": 0, 195 | "no-this-before-super": 0, 196 | "no-var": 0, 197 | "object-shorthand": 0, 198 | "prefer-const": 0, 199 | "prefer-spread": 0, 200 | "prefer-reflect": 0, 201 | "require-yield": 0, 202 | "max-depth": [2,4], 203 | "max-len": [2,200,1,{"ignorePattern":"true"}], 204 | "max-params": 0, 205 | "max-statements": 0, 206 | "no-bitwise": [2, { "allow": ["~"] }], 207 | "no-plusplus": 2 208 | } 209 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | 3 | .bat text eol=crlf 4 | .sh text eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | build/ 4 | dist/ 5 | node_modules/ 6 | reports/ 7 | coverage/ 8 | *.log 9 | 10 | # DO NOT DELETE 11 | src/services/credentials.ts -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 10 | 11 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 12 | 13 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 14 | 15 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 16 | 17 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 18 | 19 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 20 | 21 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 22 | 23 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 24 | 25 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 26 | 27 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 28 | 29 | 2. Grant of Copyright License. 30 | 31 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 32 | 33 | 3. Grant of Patent License. 34 | 35 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 36 | 37 | 4. Redistribution. 38 | 39 | You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 40 | 41 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 42 | You must cause any modified files to carry prominent notices stating that You changed the files; and 43 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 44 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 45 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 46 | 47 | 5. Submission of Contributions. 48 | 49 | Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 50 | 51 | 6. Trademarks. 52 | 53 | This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 54 | 55 | 7. Disclaimer of Warranty. 56 | 57 | Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 58 | 59 | 8. Limitation of Liability. 60 | 61 | In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 62 | 63 | 9. Accepting Warranty or Additional Liability. 64 | 65 | While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # github-dashboard 2 | 3 | [![GitHub release](https://img.shields.io/github/release/thescientist13/github-dashboard.svg)](https://github.com/thescientist13/github-dashboard/releases) 4 | [![CircleCI](https://img.shields.io/circleci/project/github/thescientist13/github-dashboard/master.svg)](https://circleci.com/gh/thescientist13/github-dashboard/tree/master) 5 | [![GitHub issues](https://img.shields.io/github/issues-raw/thescientist13/github-dashboard.svg)](https://github.com/thescientist13/github-dashboard/issues) 6 | [![GitHub issues](https://img.shields.io/github/issues-pr-raw/thescientist13/github-dashboard.svg)](https://github.com/thescientist13/github-dashboard/issues) 7 | [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/thescientist13/github-dashboard/master/LICENSE.md) 8 | 9 | ## Overview 10 | GitHub Dashboard is a locally running web application that aims to help streamline the management of your GitHub repos and issues in one place. Browse all your repos (personal and subscribed), see open issues, see if any are assigned to you, and link directly to any repo. You can check out a full product overview [here](https://github.com/thescientist13/github-dashboard/wiki/Product-Overview) 11 | 12 | ![GitHub Dashboard](https://s3.amazonaws.com/uploads.thegreenhouse.io/oss/github-dashboard-v1.2.0.png) 13 | 14 | To run, all that is required is the latest LTS version of [Node][] installed and the package manager, [Yarn][]. A GitHub access token will also need to be generated. The _Setup_ section below will cover all of this. 15 | 16 | [Node]: https://nodejs.org/ 17 | [Yarn]: https://yarnpkg.com/ 18 | 19 | ## Setup 20 | After cloning the repo, and making sure you have [Node LTS](https://nodejs.org/) installed, please do the following 21 | 22 | 1. [Install Yarn](https://yarnpkg.com/lang/en/docs/install/#mac-stable) globally (>= 1.0) 23 | 1. Install dependencies 24 | ```bash 25 | $ yarn install 26 | ``` 27 | 1. Setup the application 28 | ```bash 29 | $ yarn run setup 30 | ``` 31 | 1. Log into your GitHub account and create an [Personal Access Token](https://github.com/settings/tokens) with the following scopes: 32 | - repo 33 | - admin:org 34 | - notifications 35 | 36 | For information on creating an access token, please visit the [GitHub article on creating access tokens](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) 37 | 1. Open `/src/services/credentials.ts` and replace the `xxx`'s with your GitHub username and a Personal Access Token 38 | 39 | Note: The `credentials.ts` file is listed within the `.gitignore` to prevent accidental inclusion within the repository files. 40 | 41 | For information on architecture and design of this application, checkout the Developer's Guide [here](https://github.com/thescientist13/github-dashboard/wiki/Developers-Guide) 42 | 43 | ## Starting the application 44 | Once you've entered in your credentials, you can start the application: 45 | 46 | ```bash 47 | $ yarn run serve 48 | ``` 49 | 50 | For more information on available tasks, check out the [Developer's Guide](https://github.com/thescientist13/github-dashboard/wiki/Developers-Guide). 51 | 52 | [Webstorm]: https://www.jetbrains.com/webstorm/ 53 | 54 | ## Additional References 55 | - [Product Overview](https://github.com/thescientist13/github-dashboard/wiki/Product-Overview) 56 | - [FAQ](https://github.com/thescientist13/github-dashboard/wiki/F.A.Q.) 57 | - [Developer's Guide](https://github.com/thescientist13/github-dashboard/wiki/Developers-Guide) 58 | 59 | ## License 60 | Copyright 2017 Owen Buckley, The Greenhouse.io 61 | 62 | Licensed under the Apache License, Version 2.0 (the "License"); 63 | you may not use this file except in compliance with the License. 64 | You may obtain a copy of the License at 65 | 66 | http://www.apache.org/licenses/LICENSE-2.0 67 | 68 | Unless required by applicable law or agreed to in writing, software 69 | distributed under the License is distributed on an "AS IS" BASIS, 70 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 71 | See the License for the specific language governing permissions and 72 | limitations under the License. -------------------------------------------------------------------------------- /jest.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "verbose": true, 3 | 4 | "setupFiles": [ 5 | "raf/polyfill", 6 | "/test/test-setup.js" 7 | ], 8 | 9 | "transform": { 10 | "^.+\\.(ts|tsx)$": "/test/test-preprocessor.js" 11 | }, 12 | 13 | "testMatch": [ 14 | "/src/**/**/*.spec.(ts|tsx)" 15 | ], 16 | 17 | "testResultsProcessor": "./node_modules/jest-junit-reporter", 18 | 19 | "moduleFileExtensions": ["js", "ts", "tsx"], 20 | 21 | "moduleNameMapper": { 22 | "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/test/mocks/file-mock.js", 23 | "\\.(css|less)$": "/test/mocks/style-mock.js" 24 | }, 25 | 26 | "coverageReporters": ["html", "json", "lcov", "cobertura"], 27 | "coverageDirectory": "/reports/test-coverage", 28 | 29 | "coverageThreshold": { 30 | "global": { 31 | "branches": 85, 32 | "functions": 85, 33 | "lines": 90, 34 | "statements": 90 35 | } 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-dashboard", 3 | "version": "1.3.0", 4 | "description": "A GitHub Dashboard web app running on-top of Node", 5 | "main": "src/index.tsx", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/thescientist13/github-dashboard.git" 9 | }, 10 | "engines": { 11 | "node": ">=4.4.1" 12 | }, 13 | "keywords": [ 14 | "Node", 15 | "Github", 16 | "The Greenhouse" 17 | ], 18 | "author": "Owen Buckley ", 19 | "license": "Apache-2.0", 20 | "bugs": { 21 | "url": "https://github.com/thescientist13/github-dashboard/issues" 22 | }, 23 | "homepage": "https://github.com/thescientist13/github-dashboard#readme", 24 | "scripts": { 25 | "clean": "rimraf ./dist && rimraf ./reports && mkdir ./reports && mkdir ./reports/test-results", 26 | "build": "eslint *.js && yarn clean && webpack --config ./webpack.config.prod.js --progress --profile --bail", 27 | "develop": "webpack-dev-server --open --config ./webpack.config.develop.js --inline --progress", 28 | "serve": "yarn build && ws -d ./dist --spa index.html -z", 29 | "setup": "rimraf ./src/services/credentials.ts && cp ./src/services/credentials.ts.tmpl ./src/services/credentials.ts", 30 | "test": "yarn clean && eslint ./src/**/**/*.spec.tsx && export TEST_REPORT_PATH=./reports/test-results && jest --config jest.config.json --coverage" 31 | }, 32 | "dependencies": { 33 | "axios": "^0.18.0", 34 | "bootstrap": "^3.3.7", 35 | "react": "^16.4.1", 36 | "react-dom": "^16.4.1", 37 | "react-redux": "^5.0.7", 38 | "react-router": "^3.2.1", 39 | "redux": "^4.0.0" 40 | }, 41 | "devDependencies": { 42 | "@types/enzyme": "^3.1.11", 43 | "@types/react": "^16.4.6", 44 | "@types/react-addons-test-utils": "^0.14.21", 45 | "@types/react-dom": "^16.0.6", 46 | "@types/react-redux": "^6.0.2", 47 | "@types/react-router": "^3.0.5", 48 | "@types/react-test-renderer": "^16.0.1", 49 | "@types/redux": "^3.6.31", 50 | "awesome-typescript-loader": "^5.0.0", 51 | "axios-mock-adapter": "^1.15.0", 52 | "babel-jest": "^19.0.0", 53 | "babel-preset-env": "^1.7.0", 54 | "babel-preset-react": "^6.23.0", 55 | "css-loader": "^1.0.0", 56 | "enzyme": "^3.3.0", 57 | "enzyme-adapter-react-16": "^1.1.1", 58 | "eslint": "^3.18.0", 59 | "eslint-plugin-react": "^6.10.3", 60 | "file-loader": "^1.1.11", 61 | "html-critical-webpack-plugin": "^2.0.0", 62 | "html-webpack-plugin": "^3.2.0", 63 | "jest": "^23.3.0", 64 | "jest-junit-reporter": "^1.0.1", 65 | "local-web-server": "^2.5.5", 66 | "mini-css-extract-plugin": "^0.4.1", 67 | "optimize-css-assets-webpack-plugin": "^4.0.3", 68 | "react-addons-test-utils": "^15.6.2", 69 | "react-test-renderer": "^16.4.1", 70 | "redux-mock-store": "^1.5.3", 71 | "rimraf": "^2.6.2", 72 | "source-map-loader": "^0.1.5", 73 | "style-loader": "^0.21.0", 74 | "ts-jest": "^19.0.0", 75 | "tslint": "^5.10.0", 76 | "tslint-loader": "^3.6.0", 77 | "typescript": "^2.9.2", 78 | "uglifyjs-webpack-plugin": "^1.2.7", 79 | "url-loader": "^1.0.1", 80 | "webpack": "^4.12.0", 81 | "webpack-bundle-analyzer": "^2.13.1", 82 | "webpack-cli": "^3.0.8", 83 | "webpack-dev-server": "^3.1.4", 84 | "webpack-merge": "^0.14.1" 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/components/bootstrap/bootstrap.spec.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import axios from 'axios'; 3 | import configureStore from 'redux-mock-store'; 4 | import { mount } from 'enzyme'; 5 | import { Bootstrap } from './bootstrap'; 6 | import MockAdapter from 'axios-mock-adapter'; 7 | import { Credentials } from '../../services/credentials'; 8 | 9 | jest.mock('../../services/credentials'); 10 | 11 | describe('Bootstrap Component', () => { 12 | let store, mock, wrapper, dispatch, mockCredentials; 13 | 14 | const mockStore = configureStore(); 15 | const initialState = { 16 | userDetails: { 17 | username: '', 18 | avatar: '' 19 | }, 20 | userRepositories: { 21 | repositories: [], 22 | nextReposUrl: undefined 23 | }, 24 | userSubscriptions: { 25 | repositories: [], 26 | nextReposUrl: undefined 27 | } 28 | }; 29 | 30 | beforeEach(() => { 31 | store = mockStore(initialState); 32 | dispatch = store.dispatch.bind(store); 33 | 34 | mockCredentials = new Credentials().getCredentials(); 35 | 36 | mock = new MockAdapter(axios); 37 | mock.onGet('https://api.github.com/user').reply(200, {}); 38 | mock.onGet(`https://api.github.com/users/${mockCredentials.username}/repos`).reply(200, [], {}); 39 | mock.onGet(`https://api.github.com/users/${mockCredentials.username}/subscriptions`).reply(200, [], {}); 40 | 41 | wrapper = mount(); 42 | }); 43 | 44 | it('renders without crashing', () => { 45 | expect(wrapper.length).toBe(1); 46 | }); 47 | 48 | it('should render the shell of the page with a header component', () => { 49 | expect(wrapper.find('header').length).toEqual(1); 50 | expect(wrapper.find('.tgh-header').length).toEqual(1); 51 | }); 52 | 53 | it('should render the shell of the page with a footer component ', () => { 54 | expect(wrapper.find('footer').length).toEqual(1); 55 | expect(wrapper.find('.tgh-footer').length).toEqual(1); 56 | }); 57 | 58 | it('should render the shell of the page with a navigation component', () => { 59 | expect(wrapper.find('nav').length).toEqual(1); 60 | expect(wrapper.find('.tgh-navigation').length).toEqual(1); 61 | }); 62 | 63 | it('should render the shell of the page with a user details component', () => { 64 | expect(wrapper.find('.tgh-user-details').length).toEqual(1); 65 | }); 66 | 67 | }); -------------------------------------------------------------------------------- /src/components/bootstrap/bootstrap.tsx: -------------------------------------------------------------------------------- 1 | import '../../../node_modules/bootstrap/dist/css/bootstrap.css'; 2 | import * as React from 'react'; 3 | import { connect } from 'react-redux'; 4 | import { Credentials, CredentialsInterface } from '../../services/credentials'; 5 | import { GithubApi, RepositoriesInterface, IssueDetailsInterface, UserInterface } from '../../services/github-api'; 6 | import { getUserDetails, getUserSubscriptions, getUserRepositories, getIssuesForUserRepository, getIssuesForUserSubscription } from '../../stores/github-store'; 7 | import Footer from '../footer/footer'; 8 | import Header from '../header/header'; 9 | import Navigation from '../navigation/navigation'; 10 | import UserDetails from '../user-details/user-details'; 11 | 12 | interface BootstrapPropsInterface { 13 | dispatch?: any 14 | } 15 | interface BootstrapStateInterface { 16 | userDetails: { 17 | username: string, 18 | avatar: string 19 | } 20 | } 21 | 22 | export class Bootstrap extends React.Component { 23 | private credentials: CredentialsInterface; 24 | private githubApi: GithubApi; 25 | 26 | constructor(props: BootstrapPropsInterface) { 27 | super(props); 28 | 29 | this.credentials = new Credentials().getCredentials(); 30 | this.githubApi = new GithubApi(this.credentials); 31 | this.state = { 32 | userDetails: { 33 | username: '', 34 | avatar: '' 35 | } 36 | }; 37 | 38 | this.getUserDetails(); 39 | this.getUserRepositoriesWithIssues(); 40 | this.getUserSubscriptionsWithIssues(); 41 | } 42 | 43 | private getUserDetails(): void { 44 | const dispatch = this.props.dispatch; 45 | 46 | this.githubApi.getUserDetails().then((response: UserInterface) => { 47 | dispatch(getUserDetails(response)); 48 | 49 | this.setState({ 50 | userDetails: { 51 | username: response.username, 52 | avatar: response.avatar 53 | } 54 | }) 55 | }); 56 | } 57 | 58 | private getUserRepositoriesWithIssues(nextReposUrl?: string, length?: number): void { 59 | const dispatch = this.props.dispatch; 60 | const url: string = nextReposUrl ? nextReposUrl : null; 61 | 62 | this.githubApi.getUserRepositories(url).then((response: RepositoriesInterface) => { 63 | dispatch(getUserRepositories(response.repositories, response.nextReposUrl)); 64 | 65 | response.repositories.map((repo: any, index: number) => { 66 | let offsetIdx = nextReposUrl && length ? length + index : index; 67 | 68 | this.githubApi.getIssuesForRepository(repo.name, repo.owner).then((response: IssueDetailsInterface) => { 69 | dispatch(getIssuesForUserRepository(response, offsetIdx)); 70 | }) 71 | }) 72 | }); 73 | } 74 | 75 | private getUserSubscriptionsWithIssues(nextReposUrl?: string, length?: number): void { 76 | const dispatch = this.props.dispatch; 77 | const url: string = nextReposUrl ? nextReposUrl : null; 78 | 79 | this.githubApi.getUserSubscriptions(url).then((response: RepositoriesInterface) => { 80 | dispatch(getUserSubscriptions(response.repositories, response.nextReposUrl)); 81 | 82 | response.repositories.forEach((repo: any, index: number) => { 83 | let offsetIdx = nextReposUrl && length ? length + index : index; 84 | 85 | this.githubApi.getIssuesForRepository(repo.name, repo.owner).then((response: IssueDetailsInterface) => { 86 | dispatch(getIssuesForUserSubscription(response, offsetIdx)); 87 | }) 88 | }) 89 | }); 90 | } 91 | 92 | render() { 93 | const children = React.Children.map(this.props.children, (child: any) => { 94 | return React.cloneElement(child, { 95 | getNextUserRepositoriesWithIssues: this.getUserRepositoriesWithIssues.bind(this), 96 | getNextUserSubscriptionsWithIssues: this.getUserSubscriptionsWithIssues.bind(this) 97 | }) 98 | }); 99 | 100 | return ( 101 |
102 |
103 | 104 |
105 |
106 |
107 | 108 |
109 | 110 |
111 | 112 |
113 | 114 | 115 |
116 | 117 |
118 | {children} 119 |
120 | 121 |
122 | 123 |
124 | 125 |
126 |
127 |
128 | 129 |
130 |
131 | ) 132 | } 133 | } 134 | 135 | export default connect()(Bootstrap); -------------------------------------------------------------------------------- /src/components/footer/footer.css: -------------------------------------------------------------------------------- 1 | .tgh-footer{ 2 | text-align: center; 3 | } -------------------------------------------------------------------------------- /src/components/footer/footer.spec.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | import Footer from './footer'; 4 | 5 | describe('Footer Component', () => { 6 | let footer; 7 | 8 | beforeEach(() => { 9 | footer = shallow(