From 5c4a9619af981de7636bad000317acc662d6bec0 Mon Sep 17 00:00:00 2001 From: Lydia Hallie Date: Sun, 10 Jun 2018 12:23:24 +0200 Subject: [PATCH 01/58] Update README.md --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7c8c1ac..6c26ef4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ -##CodeBuddy +## [NOT FINISHED] CodeBuddy -Personal project using React Redux, oAuth and MongoDB. - -![demo](preview1.gif) \ No newline at end of file +CodeBuddy is a personal project, representing a website where people can get in contact with other programmers to work with them on their own side projects, and create a team. Some technologies used: + - React + - Redux + - Node.js + - Express + - Passport + - JWT + - oAuth + - MongoDB + + ### First draft version +![demo](preview1.gif) From 46f06de73cfc4229bfe43a32c57f4feeb9f7dee4 Mon Sep 17 00:00:00 2001 From: Ben Styles Date: Sun, 2 Sep 2018 18:45:00 +0100 Subject: [PATCH 02/58] Install prettier and husky --- package.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index cefcd50..a1c0f04 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "client": "npm run start --prefix client", "dev": "concurrently \"npm run server\" \"npm run client\"", "postinstall": "chmod +x ./update-commit-hook.sh && ./update-commit-hook.sh", - "commit-hook": "rsync pre-commit .git/hooks && chmod 755 .git/hooks/pre-commit" + "commit-hook": "rsync pre-commit .git/hooks && chmod 755 .git/hooks/pre-commit", + "precommit": "pretty-quick --staged" }, "author": "", "license": "ISC", @@ -17,11 +18,14 @@ "concurrently": "^3.5.1" }, "devDependencies": { - "nodemon": "^1.18.3", "eslint": "^5.3.0", "eslint-config-airbnb": "17.1.0", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.1", - "eslint-plugin-react": "^7.11.0" + "eslint-plugin-react": "^7.11.0", + "husky": "^0.14.3", + "nodemon": "^1.18.3", + "prettier": "1.14.2", + "pretty-quick": "^1.6.0" } } From d15e92e8d30c07a8812d1c723caa3ca7a0caf2b9 Mon Sep 17 00:00:00 2001 From: Ben Styles Date: Sun, 2 Sep 2018 18:55:57 +0100 Subject: [PATCH 03/58] Add prettier config and test precommit hook --- .eslintrc.json | 4 +++- .prettierignore | 1 + .prettierrc | 4 ++++ client/src/index.js | 24 +++++++++++++----------- docs/CONTRIBUTING.md | 6 +++--- 5 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.eslintrc.json b/.eslintrc.json index 6bbe257..764fd30 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,9 @@ "plugins": ["react", "jsx-a11y", "import"], "rules": { "jsx-a11y/anchor-is-valid": 2, - "jsx-a11y/href-no-hash": "off" + "jsx-a11y/href-no-hash": "off", + "react/jsx-filename-extension": "off", + "import/prefer-default-export": "off" }, "env": { "browser": true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ec6d3cd --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +package.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..c6a1376 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "trailingComma": "es5", + "singleQuote": true +} diff --git a/client/src/index.js b/client/src/index.js index 42cc4aa..b477987 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,12 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import registerServiceWorker from './registerServiceWorker'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; +import thunk from 'redux-thunk'; +import { composeWithDevTools } from 'redux-devtools-extension'; import reducers from './reducers'; -import thunk from 'redux-thunk' -import { composeWithDevTools } from 'redux-devtools-extension' +import registerServiceWorker from './registerServiceWorker'; import App from './components/LandingPage/App'; import Dashboard from './containers/Dashboard'; @@ -14,17 +14,19 @@ import Dashboard from './containers/Dashboard'; import './styles/main.sass'; export const store = createStore( - reducers, - composeWithDevTools(applyMiddleware(thunk))) + reducers, + composeWithDevTools(applyMiddleware(thunk)), +); ReactDOM.render( - - + + - - -, document.getElementById('root')); -registerServiceWorker(); \ No newline at end of file + + , + document.getElementById('root'), +); +registerServiceWorker(); diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 9536953..53a6f8b 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -6,12 +6,12 @@ Hey everyone! Thank you so much for wanting to contribute! :+1::tada: Here are s Make sure that you've read and accepted the [Code of Conduct](CODE_OF_CONDUCT.md) before contributing to this project. :smile: -## Guidelines +## Guidelines ### Adding a commit Commit any improvements, additions, or bug fixes on new branches with: -* ```fix/name_of_fix``` +* ```fix/name_of_fix``` * ```feature/name_of_feature``` @@ -21,7 +21,7 @@ Commit any improvements, additions, or bug fixes on new branches with: * Use the imperative mood ("Move cursor to..." not "Moves cursor to...") * Limit the first line to 72 characters or less -### JavaScript Styleguide +### JavaScript Styleguide All JavaScript must adhere to [Airbnb JavaScript Styleguide](https://github.com/airbnb/javascript). From e0c85ba9e0e540a956bacdecbe35d2e9485325ad Mon Sep 17 00:00:00 2001 From: Ben Styles Date: Sun, 2 Sep 2018 18:58:12 +0100 Subject: [PATCH 04/58] Commit yarn.lock --- .gitignore | 3 +- yarn.lock | 2507 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2508 insertions(+), 2 deletions(-) create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index c7bd190..805269a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ yarn-error.log -yarn.lock -/node_modules \ No newline at end of file +/node_modules diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..01de0fd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,2507 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + +acorn-jsx@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e" + dependencies: + acorn "^5.0.3" + +acorn@^5.0.3, acorn@^5.6.0: + version "5.7.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5" + +ajv-keywords@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" + +ajv@^6.0.1, ajv@^6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9" + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-align@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" + dependencies: + string-width "^2.0.0" + +ansi-escapes@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + dependencies: + color-convert "^1.9.0" + +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + dependencies: + sprintf-js "~1.0.2" + +aria-query@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" + dependencies: + ast-types-flow "0.0.7" + commander "^2.11.0" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + +array-includes@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.7.0" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + +ast-types-flow@0.0.7, ast-types-flow@^0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" + +async-each@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" + +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + +axobject-query@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.1.tgz#05dfa705ada8ad9db993fa6896f22d395b0b0a07" + dependencies: + ast-types-flow "0.0.7" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +binary-extensions@^1.0.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" + +boxen@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" + dependencies: + ansi-align "^2.0.0" + camelcase "^4.0.0" + chalk "^2.0.1" + cli-boxes "^1.0.0" + string-width "^2.0.0" + term-size "^1.2.0" + widest-line "^2.0.0" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^2.3.0, braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +builtin-modules@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +camelcase@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + +capture-stack-trace@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d" + +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + +chokidar@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" + dependencies: + anymatch "^2.0.0" + async-each "^1.0.0" + braces "^2.3.0" + glob-parent "^3.1.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^4.0.0" + lodash.debounce "^4.0.8" + normalize-path "^2.1.1" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + upath "^1.0.5" + optionalDependencies: + fsevents "^1.2.2" + +chownr@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" + +ci-info@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.4.0.tgz#4841d53cad49f11b827b648ebde27a6e189b412f" + +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cli-boxes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + +commander@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" + +commander@^2.11.0: + version "2.17.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + +component-emitter@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concurrently@^3.5.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.6.1.tgz#2f95baec5c4051294dfbb55b57a3b98a3e2b45ec" + dependencies: + chalk "^2.4.1" + commander "2.6.0" + date-fns "^1.23.0" + lodash "^4.5.1" + read-pkg "^3.0.0" + rx "2.3.24" + spawn-command "^0.0.2-1" + supports-color "^3.2.3" + tree-kill "^1.1.0" + +configstore@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f" + dependencies: + dot-prop "^4.1.0" + graceful-fs "^4.1.2" + make-dir "^1.0.0" + unique-string "^1.0.0" + write-file-atomic "^2.0.0" + xdg-basedir "^3.0.0" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +create-error-class@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" + dependencies: + capture-stack-trace "^1.0.0" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +crypto-random-string@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" + +damerau-levenshtein@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514" + +date-fns@^1.23.0: + version "1.29.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" + +debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + dependencies: + ms "2.0.0" + +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +define-properties@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + dependencies: + object-keys "^1.0.12" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + dependencies: + esutils "^2.0.2" + +dot-prop@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" + dependencies: + is-obj "^1.0.0" + +duplexer3@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" + +duplexer@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + +emoji-regex@^6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" + +error-ex@^1.2.0, error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.6.1, es-abstract@^1.7.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" + dependencies: + es-to-primitive "^1.1.1" + function-bind "^1.1.1" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" + +es-to-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" + dependencies: + is-callable "^1.1.1" + is-date-object "^1.0.1" + is-symbol "^1.0.1" + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +eslint-config-airbnb-base@^13.1.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz#b5a1b480b80dfad16433d6c4ad84e6605052c05c" + dependencies: + eslint-restricted-globals "^0.1.1" + object.assign "^4.1.0" + object.entries "^1.0.4" + +eslint-config-airbnb@17.1.0: + version "17.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-17.1.0.tgz#3964ed4bc198240315ff52030bf8636f42bc4732" + dependencies: + eslint-config-airbnb-base "^13.1.0" + object.assign "^4.1.0" + object.entries "^1.0.4" + +eslint-import-resolver-node@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + dependencies: + debug "^2.6.9" + resolve "^1.5.0" + +eslint-module-utils@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + +eslint-plugin-import@^2.14.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" + dependencies: + contains-path "^0.1.0" + debug "^2.6.8" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.1" + eslint-module-utils "^2.2.0" + has "^1.0.1" + lodash "^4.17.4" + minimatch "^3.0.3" + read-pkg-up "^2.0.0" + resolve "^1.6.0" + +eslint-plugin-jsx-a11y@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.1.tgz#7bf56dbe7d47d811d14dbb3ddff644aa656ce8e1" + dependencies: + aria-query "^3.0.0" + array-includes "^3.0.3" + ast-types-flow "^0.0.7" + axobject-query "^2.0.1" + damerau-levenshtein "^1.0.4" + emoji-regex "^6.5.1" + has "^1.0.3" + jsx-ast-utils "^2.0.1" + +eslint-plugin-react@^7.11.0: + version "7.11.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz#c01a7af6f17519457d6116aa94fc6d2ccad5443c" + dependencies: + array-includes "^3.0.3" + doctrine "^2.1.0" + has "^1.0.3" + jsx-ast-utils "^2.0.1" + prop-types "^15.6.2" + +eslint-restricted-globals@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz#35f0d5cbc64c2e3ed62e93b4b1a7af05ba7ed4d7" + +eslint-scope@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + +eslint@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.5.0.tgz#8557fcceab5141a8197da9ffd9904f89f64425c6" + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.5.3" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^3.1.0" + doctrine "^2.1.0" + eslint-scope "^4.0.0" + eslint-utils "^1.3.1" + eslint-visitor-keys "^1.0.0" + espree "^4.0.0" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.7.0" + ignore "^4.0.6" + imurmurhash "^0.1.4" + inquirer "^6.1.0" + is-resolvable "^1.1.0" + js-yaml "^3.12.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.5" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^2.0.0" + require-uncached "^1.0.3" + semver "^5.5.1" + strip-ansi "^4.0.0" + strip-json-comments "^2.0.1" + table "^4.0.3" + text-table "^0.2.0" + +espree@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634" + dependencies: + acorn "^5.6.0" + acorn-jsx "^4.1.1" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-stream@~3.3.0: + version "3.3.4" + resolved "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" + dependencies: + duplexer "~0.1.1" + from "~0" + map-stream "~0.1.0" + pause-stream "0.0.11" + split "0.3" + stream-combiner "~0.0.4" + through "~2.3.1" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +external-editor@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + +flat-cache@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + dependencies: + map-cache "^0.2.2" + +from@~0: + version "0.1.7" + resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" + +fs-minipass@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" + dependencies: + minipass "^2.2.1" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +fsevents@^1.2.2: + version "1.2.4" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" + dependencies: + nan "^2.9.2" + node-pre-gyp "^0.10.0" + +function-bind@^1.1.0, function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + +glob-parent@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + +glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: + version "7.1.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +global-dirs@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" + dependencies: + ini "^1.3.4" + +globals@^11.7.0: + version "11.7.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +got@^6.7.1: + version "6.7.1" + resolved "http://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" + dependencies: + create-error-class "^3.0.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" + is-redirect "^1.0.0" + is-retry-allowed "^1.0.0" + is-stream "^1.0.0" + lowercase-keys "^1.0.0" + safe-buffer "^5.0.1" + timed-out "^4.0.0" + unzip-response "^2.0.1" + url-parse-lax "^1.0.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + dependencies: + function-bind "^1.1.1" + +hosted-git-info@^2.1.4: + version "2.7.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + +husky@^0.14.3: + version "0.14.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" + dependencies: + is-ci "^1.0.10" + normalize-path "^1.0.0" + strip-indent "^2.0.0" + +iconv-lite@^0.4.24, iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore-by-default@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" + +ignore-walk@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + dependencies: + minimatch "^3.0.4" + +ignore@^3.3.7: + version "3.3.10" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + +import-lazy@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.1, inherits@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +ini@^1.3.4, ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + +inquirer@^6.1.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.0.tgz#51adcd776f661369dc1e894859c2560a224abdd8" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.0" + figures "^2.0.0" + lodash "^4.17.10" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.1.0" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + dependencies: + binary-extensions "^1.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-callable@^1.1.1, is-callable@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + +is-ci@^1.0.10: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.0.tgz#3f4a08d6303a09882cef3f0fb97439c5f5ce2d53" + dependencies: + ci-info "^1.3.0" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + dependencies: + kind-of "^6.0.0" + +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^2.1.0, is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + dependencies: + is-extglob "^2.1.0" + +is-glob@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + dependencies: + is-extglob "^2.1.1" + +is-installed-globally@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80" + dependencies: + global-dirs "^0.1.0" + is-path-inside "^1.0.0" + +is-npm@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + +is-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + dependencies: + path-is-inside "^1.0.1" + +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + +is-redirect@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" + +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + dependencies: + has "^1.0.1" + +is-resolvable@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + +is-retry-allowed@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" + +is-stream@^1.0.0, is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + +is-symbol@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + +js-yaml@^3.12.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + +jsx-ast-utils@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" + dependencies: + array-includes "^3.0.3" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + +latest-version@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" + dependencies: + package-json "^4.0.0" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + +lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.5.1: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + +loose-envify@^1.3.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lowercase-keys@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" + +lru-cache@^4.0.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +make-dir@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" + dependencies: + pify "^3.0.0" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + +map-stream@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + dependencies: + object-visit "^1.0.0" + +micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.2.0: + version "1.2.0" + resolved "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +minipass@^2.2.1, minipass@^2.3.3: + version "2.3.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.4.tgz#4768d7605ed6194d6d576169b9e12ef71e9d9957" + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.1.0.tgz#11e13658ce46bc3a70a267aac58359d1e0c29ceb" + dependencies: + minipass "^2.2.1" + +mixin-deep@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mri@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.1.tgz#85aa26d3daeeeedf80dc5984af95cc5ca5cad9f1" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + +nan@^2.9.2: + version "2.11.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.0.tgz#574e360e4d954ab16966ec102c0c049fd961a099" + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +needle@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.2.tgz#1120ca4c41f2fcc6976fd28a8968afe239929418" + dependencies: + debug "^2.1.2" + iconv-lite "^0.4.4" + sax "^1.2.4" + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + +node-pre-gyp@^0.10.0: + version "0.10.3" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +nodemon@^1.18.3: + version "1.18.4" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.18.4.tgz#873f65fdb53220eb166180cf106b1354ac5d714d" + dependencies: + chokidar "^2.0.2" + debug "^3.1.0" + ignore-by-default "^1.0.1" + minimatch "^3.0.4" + pstree.remy "^1.1.0" + semver "^5.5.0" + supports-color "^5.2.0" + touch "^3.1.0" + undefsafe "^2.0.2" + update-notifier "^2.3.0" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + dependencies: + abbrev "1" + osenv "^0.1.4" + +nopt@~1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" + dependencies: + abbrev "1" + +normalize-package-data@^2.3.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" + +normalize-path@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + dependencies: + remove-trailing-separator "^1.0.1" + +npm-bundled@^1.0.1: + version "1.0.5" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" + +npm-packlist@^1.1.6: + version "1.1.11" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.1.11.tgz#84e8c683cbe7867d34b1d357d893ce29e28a02de" + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-keys@^1.0.11, object-keys@^1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + dependencies: + isobject "^3.0.0" + +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.entries@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.6.1" + function-bind "^1.1.0" + has "^1.0.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + dependencies: + isobject "^3.0.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + dependencies: + p-try "^1.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + +package-json@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" + dependencies: + got "^6.7.1" + registry-auth-token "^3.0.1" + registry-url "^3.0.3" + semver "^5.1.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1, path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + +path-parse@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + dependencies: + pify "^3.0.0" + +pause-stream@0.0.11: + version "0.0.11" + resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445" + dependencies: + through "~2.3" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +prepend-http@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" + +prettier@1.14.2: + version "1.14.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" + +pretty-quick@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.6.0.tgz#afc3591eb5c4cf37614a305d489a8a40e57c9258" + dependencies: + chalk "^2.3.0" + execa "^0.8.0" + find-up "^2.1.0" + ignore "^3.3.7" + mri "^1.1.0" + +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + +prop-types@^15.6.2: + version "15.6.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" + dependencies: + loose-envify "^1.3.1" + object-assign "^4.1.1" + +ps-tree@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.1.0.tgz#b421b24140d6203f1ed3c76996b4427b08e8c014" + dependencies: + event-stream "~3.3.0" + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +pstree.remy@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.0.tgz#f2af27265bd3e5b32bbfcc10e80bac55ba78688b" + dependencies: + ps-tree "^1.1.0" + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + +rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + +readable-stream@^2.0.2, readable-stream@^2.0.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readdirp@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" + dependencies: + graceful-fs "^4.1.2" + minimatch "^3.0.2" + readable-stream "^2.0.2" + set-immediate-shim "^1.0.1" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regexpp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" + +registry-auth-token@^3.0.1: + version "3.3.2" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.2.tgz#851fd49038eecb586911115af845260eec983f20" + dependencies: + rc "^1.1.6" + safe-buffer "^5.0.1" + +registry-url@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" + dependencies: + rc "^1.0.1" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + +resolve@^1.5.0, resolve@^1.6.0: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + dependencies: + path-parse "^1.0.5" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + +rimraf@^2.2.8, rimraf@^2.6.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + dependencies: + glob "^7.0.5" + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + +rx@2.3.24: + version "2.3.24" + resolved "https://registry.yarnpkg.com/rx/-/rx-2.3.24.tgz#14f950a4217d7e35daa71bbcbe58eff68ea4b2b7" + +rxjs@^6.1.0: + version "6.3.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.1.tgz#878a1a8c64b8a5da11dcf74b5033fe944cdafb84" + dependencies: + tslib "^1.9.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + +sax@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + +semver-diff@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36" + dependencies: + semver "^5.0.3" + +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.5.0, semver@^5.5.1: + version "5.5.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +set-immediate-shim@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + +set-value@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.1" + to-object-path "^0.3.0" + +set-value@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + +source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +spawn-command@^0.0.2-1: + version "0.0.2-1" + resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" + +spdx-correct@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + dependencies: + extend-shallow "^3.0.0" + +split@0.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f" + dependencies: + through "2" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +stream-combiner@~0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14" + dependencies: + duplexer "~0.1.1" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + +strip-indent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + +strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + +supports-color@^5.2.0, supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + dependencies: + has-flag "^3.0.0" + +table@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" + dependencies: + ajv "^6.0.1" + ajv-keywords "^3.0.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + +tar@^4: + version "4.4.6" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.6.tgz#63110f09c00b4e60ac8bcfe1bf3c8660235fbc9b" + dependencies: + chownr "^1.0.1" + fs-minipass "^1.2.5" + minipass "^2.3.3" + minizlib "^1.1.0" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.2" + +term-size@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" + dependencies: + execa "^0.7.0" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through@2, through@^2.3.6, through@~2.3, through@~2.3.1: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +timed-out@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + dependencies: + os-tmpdir "~1.0.2" + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +touch@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" + dependencies: + nopt "~1.0.10" + +tree-kill@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36" + +tslib@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +undefsafe@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.2.tgz#225f6b9e0337663e0d8e7cfd686fc2836ccace76" + dependencies: + debug "^2.2.0" + +union-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^0.4.3" + +unique-string@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a" + dependencies: + crypto-random-string "^1.0.0" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +unzip-response@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" + +upath@^1.0.5: + version "1.1.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" + +update-notifier@^2.3.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.5.0.tgz#d0744593e13f161e406acb1d9408b72cad08aff6" + dependencies: + boxen "^1.2.1" + chalk "^2.0.1" + configstore "^3.0.0" + import-lazy "^2.1.0" + is-ci "^1.0.10" + is-installed-globally "^0.1.0" + is-npm "^1.0.0" + latest-version "^3.0.0" + semver-diff "^2.0.0" + xdg-basedir "^3.0.0" + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + dependencies: + punycode "^2.1.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + +url-parse-lax@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" + dependencies: + prepend-http "^1.0.1" + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + dependencies: + string-width "^1.0.2 || 2" + +widest-line@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.0.tgz#0142a4e8a243f8882c0233aa0e0281aa76152273" + dependencies: + string-width "^2.1.1" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write-file-atomic@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab" + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +xdg-basedir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + +yallist@^3.0.0, yallist@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" From 5dd7f14fe0a20e16eb0d633459d45cc87189f25e Mon Sep 17 00:00:00 2001 From: Ben Styles Date: Mon, 3 Sep 2018 12:04:57 +0100 Subject: [PATCH 05/58] Remove manual pre-commit hook in favour of using husky and lint-staged for eslint --- package.json | 8 +- pre-commit | 37 ----- update-commit-hook.sh | 11 -- yarn.lock | 307 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 303 insertions(+), 60 deletions(-) delete mode 100644 pre-commit delete mode 100755 update-commit-hook.sh diff --git a/package.json b/package.json index a1c0f04..b20ee9a 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,10 @@ "server": "nodemon server/server.js", "client": "npm run start --prefix client", "dev": "concurrently \"npm run server\" \"npm run client\"", - "postinstall": "chmod +x ./update-commit-hook.sh && ./update-commit-hook.sh", - "commit-hook": "rsync pre-commit .git/hooks && chmod 755 .git/hooks/pre-commit", - "precommit": "pretty-quick --staged" + "precommit": "pretty-quick --staged && lint-staged" + }, + "lint-staged": { + "*.js": "eslint" }, "author": "", "license": "ISC", @@ -24,6 +25,7 @@ "eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-react": "^7.11.0", "husky": "^0.14.3", + "lint-staged": "^7.2.2", "nodemon": "^1.18.3", "prettier": "1.14.2", "pretty-quick": "^1.6.0" diff --git a/pre-commit b/pre-commit deleted file mode 100644 index 9a9bed8..0000000 --- a/pre-commit +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Extract staged files to a temp directory -export NODE_MODULES=$(cd ./node_modules && pwd) -export ESLINT_PATH=`echo $NODE_MODULES"/eslint/bin/eslint.js"` -JSFILES=$(git diff-index --name-status --cached HEAD | grep -v ^D | egrep '.jsx?$' | cut -c3-) - - -if [ "$JSFILES" == "" ]; then - exit 0 -fi - -PASS=true -for FILE in $JSFILES -do - $ESLINT_PATH "$FILE" > /dev/null - - if [ $? -eq 0 ]; then - printf "\t\033[32mESLint Passed: $FILE\033[0m\n" - else - printf "\t\033[41mESLint Failed: $FILE\033[0m\n" - $ESLINT_PATH "$FILE" --fix - - if [ $? -eq 0 ]; then - printf "\n \n There were errors, but they were all able to be \033[42mautomatically fixed\033[0m by eslint. Please stage those fixes and commit again. \n \n" - fi - - PASS=false - fi -done - -if ! $PASS; then - printf "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n" - exit 1 -else - printf "\033[42mESLINT SUCCEEDED\033[0m\n" -fi diff --git a/update-commit-hook.sh b/update-commit-hook.sh deleted file mode 100755 index 61f3ec5..0000000 --- a/update-commit-hook.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -PRE_COMMIT_HOOK_DIR=".git/hooks" - -if [ ! -d "$PRE_COMMIT_HOOK_DIR" ]; then - exit 0 -fi - -if [ -d "$PRE_COMMIT_HOOK_DIR" ]; then - npm run commit-hook -fi diff --git a/yarn.lock b/yarn.lock index 01de0fd..e6c4805 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,6 +16,12 @@ esutils "^2.0.2" js-tokens "^4.0.0" +"@samverschueren/stream-to-observable@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" + dependencies: + any-observable "^0.3.0" + abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -49,6 +55,10 @@ ansi-align@^2.0.0: dependencies: string-width "^2.0.0" +ansi-escapes@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + ansi-escapes@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" @@ -61,12 +71,20 @@ ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" -ansi-styles@^3.2.1: +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" dependencies: color-convert "^1.9.0" +any-observable@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" + anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -247,7 +265,17 @@ capture-stack-trace@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1: +chalk@^1.0.0, chalk@^1.1.3: + version "1.1.3" + resolved "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: @@ -303,12 +331,25 @@ cli-boxes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" +cli-cursor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" dependencies: restore-cursor "^2.0.0" +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" @@ -338,7 +379,7 @@ commander@2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" -commander@^2.11.0: +commander@^2.11.0, commander@^2.14.1, commander@^2.9.0: version "2.17.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" @@ -391,6 +432,14 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cosmiconfig@^5.0.2: + version "5.0.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" + dependencies: + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^4.0.0" + create-error-class@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" @@ -423,7 +472,7 @@ damerau-levenshtein@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514" -date-fns@^1.23.0: +date-fns@^1.23.0, date-fns@^1.27.2: version "1.29.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" @@ -443,6 +492,10 @@ decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -523,6 +576,10 @@ duplexer@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + emoji-regex@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" @@ -551,7 +608,7 @@ es-to-primitive@^1.1.1: is-date-object "^1.0.1" is-symbol "^1.0.1" -escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -752,6 +809,22 @@ execa@^0.8.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -810,6 +883,13 @@ fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" +figures@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" @@ -832,6 +912,10 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" +find-parent-dir@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -906,6 +990,10 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" +get-own-enumerable-property-symbols@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -973,6 +1061,12 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" @@ -1066,6 +1160,10 @@ imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" +indent-string@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1173,6 +1271,10 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-data-descriptor "^1.0.0" kind-of "^6.0.2" +is-directory@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -1226,10 +1328,16 @@ is-number@^3.0.0: dependencies: kind-of "^3.0.2" -is-obj@^1.0.0: +is-obj@^1.0.0, is-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" +is-observable@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e" + dependencies: + symbol-observable "^1.1.0" + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -1266,6 +1374,10 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" +is-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + is-resolvable@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" @@ -1304,11 +1416,24 @@ isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" +jest-get-type@^22.1.0: + version "22.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" + +jest-validate@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231" + dependencies: + chalk "^2.0.1" + jest-get-type "^22.1.0" + leven "^2.1.0" + pretty-format "^23.5.0" + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" -js-yaml@^3.12.0: +js-yaml@^3.12.0, js-yaml@^3.9.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: @@ -1359,6 +1484,10 @@ latest-version@^3.0.0: dependencies: package-json "^4.0.0" +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -1366,6 +1495,73 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lint-staged@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.2.2.tgz#0983d55d497f19f36d11ff2c8242b2f56cc2dd05" + dependencies: + chalk "^2.3.1" + commander "^2.14.1" + cosmiconfig "^5.0.2" + debug "^3.1.0" + dedent "^0.7.0" + execa "^0.9.0" + find-parent-dir "^0.3.0" + is-glob "^4.0.0" + is-windows "^1.0.2" + jest-validate "^23.5.0" + listr "^0.14.1" + lodash "^4.17.5" + log-symbols "^2.2.0" + micromatch "^3.1.8" + npm-which "^3.0.1" + p-map "^1.1.1" + path-is-inside "^1.0.2" + pify "^3.0.0" + please-upgrade-node "^3.0.2" + staged-git-files "1.1.1" + string-argv "^0.0.2" + stringify-object "^3.2.2" + +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz#344d980da2ca2e8b145ba305908f32ae3f4cc8a7" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@^0.14.1: + version "0.14.2" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.2.tgz#cbe44b021100a15376addfc2d79349ee430bfe14" + dependencies: + "@samverschueren/stream-to-observable" "^0.3.0" + is-observable "^1.1.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.4.0" + listr-verbose-renderer "^0.4.0" + p-map "^1.1.1" + rxjs "^6.1.0" + load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" @@ -1399,6 +1595,25 @@ lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.5.1: version "4.17.10" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-symbols@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + dependencies: + chalk "^2.0.1" + +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + loose-envify@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -1436,7 +1651,7 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -micromatch@^3.1.4: +micromatch@^3.1.4, micromatch@^3.1.8: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" dependencies: @@ -1619,12 +1834,26 @@ npm-packlist@^1.1.6: ignore-walk "^3.0.1" npm-bundled "^1.0.1" +npm-path@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" + dependencies: + which "^1.2.10" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" dependencies: path-key "^2.0.0" +npm-which@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + dependencies: + commander "^2.9.0" + npm-path "^2.0.2" + which "^1.2.10" + npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -1690,6 +1919,10 @@ once@^1.3.0: dependencies: wrappy "1" +onetime@^1.0.0: + version "1.1.0" + resolved "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" @@ -1738,6 +1971,10 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-map@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" @@ -1840,6 +2077,12 @@ pkg-dir@^1.0.0: dependencies: find-up "^1.0.0" +please-upgrade-node@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" + dependencies: + semver-compare "^1.0.0" + pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" @@ -1860,6 +2103,13 @@ prettier@1.14.2: version "1.14.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" +pretty-format@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.5.0.tgz#0f9601ad9da70fe690a269cd3efca732c210687c" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + pretty-quick@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.6.0.tgz#afc3591eb5c4cf37614a305d489a8a40e57c9258" @@ -2015,6 +2265,13 @@ resolve@^1.5.0, resolve@^1.6.0: dependencies: path-parse "^1.0.5" +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -2066,6 +2323,10 @@ sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" +semver-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + semver-diff@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36" @@ -2116,6 +2377,10 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + slice-ansi@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" @@ -2209,6 +2474,10 @@ sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" +staged-git-files@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b" + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -2222,6 +2491,10 @@ stream-combiner@~0.0.4: dependencies: duplexer "~0.1.1" +string-argv@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -2243,6 +2516,14 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +stringify-object@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" + dependencies: + get-own-enumerable-property-symbols "^2.0.1" + is-obj "^1.0.1" + is-regexp "^1.0.0" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -2271,6 +2552,10 @@ strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + supports-color@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" @@ -2283,6 +2568,10 @@ supports-color@^5.2.0, supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +symbol-observable@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + table@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" @@ -2454,7 +2743,7 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -which@^1.2.9: +which@^1.2.10, which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" dependencies: From d6eaedc7a03410799c67d7c7e2a1111072800bc8 Mon Sep 17 00:00:00 2001 From: Mary Mazi Date: Wed, 5 Sep 2018 00:06:00 +0100 Subject: [PATCH 06/58] implement feedback on PR --- .eslintignore | 2 + client/config/webpackDevServer.config.js | 3 +- client/scripts/build.js | 5 +- .../Dashboard/DashboardView/DashProfile.js | 55 ++++++++++--------- .../components/Dashboard/Find/CardContact.js | 4 +- client/src/components/Dashboard/index.js | 3 +- server/server.js | 8 +-- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/.eslintignore b/.eslintignore index 6b2963c..8c49ce2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,4 @@ client/node_modules server/node_modules +client/config +client/scripts \ No newline at end of file diff --git a/client/config/webpackDevServer.config.js b/client/config/webpackDevServer.config.js index 87ce3ad..428e1b3 100644 --- a/client/config/webpackDevServer.config.js +++ b/client/config/webpackDevServer.config.js @@ -1,4 +1,3 @@ -/* eslint-disable func-names */ const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); const ignoredFiles = require('react-dev-utils/ignoredFiles'); @@ -8,7 +7,7 @@ const paths = require('./paths'); const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; const host = process.env.HOST || '0.0.0.0'; -module.exports = function (proxy, allowedHost) { +module.exports = function(proxy, allowedHost) { return { // WebpackDevServer 2.4.3 introduced a security fix that prevents remote // websites from potentially accessing local content through DNS rebinding: diff --git a/client/scripts/build.js b/client/scripts/build.js index 429e175..1500bab 100644 --- a/client/scripts/build.js +++ b/client/scripts/build.js @@ -1,5 +1,3 @@ -/* eslint-disable global-require, import/no-dynamic-require, no-console */ - // Do this as the first thing so that any code reading it knows the right env. process.env.BABEL_ENV = 'production'; process.env.NODE_ENV = 'production'; @@ -26,8 +24,7 @@ const printBuildError = require('react-dev-utils/printBuildError'); const paths = require('../config/paths'); const config = require('../config/webpack.config.prod'); -const { measureFileSizesBeforeBuild } = FileSizeReporter; -const { printFileSizesAfterBuild } = FileSizeReporter; +const { measureFileSizesBeforeBuild, printFileSizesAfterBuild } = FileSizeReporter; const useYarn = fs.existsSync(paths.yarnLockFile); // These sizes are pretty large. We'll warn for bundles exceeding them. diff --git a/client/src/components/Dashboard/DashboardView/DashProfile.js b/client/src/components/Dashboard/DashboardView/DashProfile.js index 40a6d74..9b66c8e 100644 --- a/client/src/components/Dashboard/DashboardView/DashProfile.js +++ b/client/src/components/Dashboard/DashboardView/DashProfile.js @@ -15,34 +15,37 @@ const StatsInfo = ({ val, name, line }) => ( ); -const DashUserProfile = ({ currentUser }) => ( - currentUser && currentUser.profile !== undefined - && ( - -
-
- -
-

- {currentUser.firstName} - {' '} - {currentUser.lastName} -

-
{currentUser.profile.title}
- +const DashUserProfile = ({ currentUser }) => { + const { profile, firstName, lastName } = currentUser; + return ( + currentUser && profile !== undefined + && ( + +
+
+ +
+

+ {firstName} + {' '} + {lastName} +

+
{profile.title}
+ +
+
+ + + +
+ {/* */} + {/* */}
-
- - - -
- {/* */} - {/* */} -
- - ) -); + + ) + ); +}; StatsInfo.propTypes = { val: PropTypes.number.isRequired, diff --git a/client/src/components/Dashboard/Find/CardContact.js b/client/src/components/Dashboard/Find/CardContact.js index 9ef649f..be9ca77 100644 --- a/client/src/components/Dashboard/Find/CardContact.js +++ b/client/src/components/Dashboard/Find/CardContact.js @@ -23,8 +23,6 @@ ContactForm.propTypes = { handleSubmit: PropTypes.func.isRequired, }; -const CardContact = reduxForm({ +export default reduxForm({ form: 'contactMessage', })(ContactForm); - -export default CardContact; diff --git a/client/src/components/Dashboard/index.js b/client/src/components/Dashboard/index.js index 3c38cba..d9f465a 100644 --- a/client/src/components/Dashboard/index.js +++ b/client/src/components/Dashboard/index.js @@ -45,7 +45,8 @@ class Dashboard extends Component { return ; case 'messages': return ; - default: + + // no default } } diff --git a/server/server.js b/server/server.js index a27c88e..a70c542 100644 --- a/server/server.js +++ b/server/server.js @@ -31,9 +31,9 @@ app.use(passport.session()); const PORT = process.env.PORT || 5000; -require('./routes/authRoutes.js')(app); -require('./routes/usersRoutes.js')(app); -require('./routes/postsRoutes.js')(app); -require('./routes/messageRoutes.js')(app); +require('./routes/authRoutes.js'); +require('./routes/usersRoutes.js'); +require('./routes/postsRoutes.js'); +require('./routes/messageRoutes.js'); app.listen(PORT, console.log(`Listening on ${PORT}!`)); From 9570aa66b349e3ace8d1636017e13d021ad3ce6e Mon Sep 17 00:00:00 2001 From: Satyadeep Roat Date: Wed, 5 Sep 2018 13:43:09 +0530 Subject: [PATCH 07/58] password verification if emailId exist in DB --- server/services/passport.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/server/services/passport.js b/server/services/passport.js index 3234272..bc8265c 100644 --- a/server/services/passport.js +++ b/server/services/passport.js @@ -50,11 +50,19 @@ passport.use(new LocalStrategy( passwordField: 'password', passReqToCallback: true, }, async (req, email, password, done) => { - // console.log('Being called now'); const { userName, firstName, lastName } = req.body; try { const user = await User.findOne({ email }); - if (user) return done(null, user); + if (user) { + if (!bcrypt.compareSync(password, user.password)) { + return done(null, false, { message: 'Incorrect Password' }); + } + return done(null, user); + } + } catch (e) { + return done(e); + } + try { const newUser = await new User({ email, password: bcrypt.hashSync(password, 10), @@ -64,9 +72,8 @@ passport.use(new LocalStrategy( }).save(); if (newUser) return done(null, newUser); } catch (e) { - console.log('Error: ', e); // eslint-disable-line no-console + return done(e); } - return null; }, )); From e446c42e44d1f81cf2ffe5869a5c226bc003dc88 Mon Sep 17 00:00:00 2001 From: Jesse Peterman Date: Wed, 5 Sep 2018 11:24:09 -0700 Subject: [PATCH 08/58] adjusted footer, and image-preview for viewing on smaller screens --- client/src/styles/LandingPage/_app.sass | 8 ++++---- client/src/styles/LandingPage/_form.sass | 7 ------- client/src/styles/LandingPage/_preview.sass | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/client/src/styles/LandingPage/_app.sass b/client/src/styles/LandingPage/_app.sass index 8e28546..89a1754 100644 --- a/client/src/styles/LandingPage/_app.sass +++ b/client/src/styles/LandingPage/_app.sass @@ -35,7 +35,7 @@ $font2: 'Source Sans Pro', sans-serif font-size: 50px !important .info - height: 30% + height: 30% +flex(center, center) flex-direction: column padding: 0 50px @@ -71,15 +71,15 @@ $font2: 'Source Sans Pro', sans-serif height: 200px .footer - height: 25% + height: 25% display: flex - // flex-direction: column + justify-content: space-around background-color: #2a2a2a border-top: 2px solid #262626 padding: 50px 0px text-align: left - @include md + @include sm flex-direction: row justify-content: left text-align: left diff --git a/client/src/styles/LandingPage/_form.sass b/client/src/styles/LandingPage/_form.sass index 0489b74..ae615b7 100644 --- a/client/src/styles/LandingPage/_form.sass +++ b/client/src/styles/LandingPage/_form.sass @@ -1,10 +1,3 @@ -//.signup-form -// display: flex -// flex-direciton: column -// justify-content: center -// @include md - - .content height: 80vh +flex-align(center) diff --git a/client/src/styles/LandingPage/_preview.sass b/client/src/styles/LandingPage/_preview.sass index 2887607..099d817 100644 --- a/client/src/styles/LandingPage/_preview.sass +++ b/client/src/styles/LandingPage/_preview.sass @@ -14,7 +14,7 @@ $breakpoint-medium: 1000px; +flex-align(center) flex-direction: column transition: .3s ease-in-out - width: 60% + width: 75% @include sm width: 33% @include md From 81857dee7232ca2766dc47705ea478f8776abcd5 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat Date: Fri, 7 Sep 2018 15:00:00 +0530 Subject: [PATCH 09/58] login and signup routes separated --- server/routes/authRoutes.js | 31 ++++++++++++++++++++++++++----- server/server.js | 8 ++++---- server/services/passport.js | 33 ++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index a4b6f57..17c3fa3 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -20,10 +20,31 @@ module.exports = app => { }); app.post( - '/api/userauth', - passport.authenticate('local'), - (req, res) => { - res.send('Done'); - }, + '/api/login', + (req, res, next) => { + passport.authenticate('local-login', (err, user, info) => { + if (err) { + return res.status(500).send({ error: 'Internal Server Error' }); + } + if (!user) { + return res.status(400).send({ error: info }); + } + return res.send('Done'); + })(req, res, next); + } + ); + app.post( + '/api/signup', + (req, res, next) => { + passport.authenticate('local-signup', (err, user, info) => { + if (err) { + return res.status(500).send({ error: 'Internal Server Error' }); + } + if (!user) { + return res.status(400).send({ error: info }); + } + return res.send('Done'); + })(req, res, next); + } ); }; diff --git a/server/server.js b/server/server.js index b59f361..3f5005c 100644 --- a/server/server.js +++ b/server/server.js @@ -30,9 +30,9 @@ app.use(passport.session()); const PORT = process.env.PORT || 5000; -require('./routes/authRoutes.js'); -require('./routes/usersRoutes.js'); -require('./routes/postsRoutes.js'); -require('./routes/messageRoutes.js'); +require('./routes/authRoutes.js')(app); +require('./routes/usersRoutes.js')(app); +require('./routes/postsRoutes.js')(app); +require('./routes/messageRoutes.js')(app); app.listen(PORT, console.log(`Listening on ${PORT}!`)); diff --git a/server/services/passport.js b/server/services/passport.js index bc8265c..f488336 100644 --- a/server/services/passport.js +++ b/server/services/passport.js @@ -44,7 +44,7 @@ passport.use( */ -passport.use(new LocalStrategy( +passport.use('local-signup', new LocalStrategy( { usernameField: 'email', passwordField: 'password', @@ -53,12 +53,7 @@ passport.use(new LocalStrategy( const { userName, firstName, lastName } = req.body; try { const user = await User.findOne({ email }); - if (user) { - if (!bcrypt.compareSync(password, user.password)) { - return done(null, false, { message: 'Incorrect Password' }); - } - return done(null, user); - } + if (user) return done(null, false, 'This emailId is already taken.'); } catch (e) { return done(e); } @@ -70,10 +65,30 @@ passport.use(new LocalStrategy( firstName, lastName, }).save(); - if (newUser) return done(null, newUser); + return done(null, newUser); + } catch (e) { + return done(e); + } + }, +)); + +passport.use('local-login', new LocalStrategy( + { + usernameField: 'email', + passwordField: 'password', + passReqToCallback: true, + }, async (req, email, password, done) => { + try { + const user = await User.findOne({ email }); + if (!user) { + return done(null, false, 'Invalid Username'); + } + if (!bcrypt.compareSync(password, user.password)) { + return done(null, false, 'Wrong Password'); + } + return done(null, user); } catch (e) { return done(e); } - return null; }, )); From 74103cabe4bd8bf663163eb24d0d8d38754e925e Mon Sep 17 00:00:00 2001 From: Jacob Adlers Date: Sat, 8 Sep 2018 22:30:08 +0200 Subject: [PATCH 10/58] Extend eslintrc with prettier --- .eslintrc.json | 2 +- package.json | 1 + yarn.lock | 108 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 108 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index deaddf1..d99087e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,6 @@ { "parser": "babel-eslint", - "extends": "airbnb", + "extends": ["airbnb", "prettier", "prettier/react"], "plugins": ["react", "jsx-a11y", "import"], "rules": { "jsx-a11y/no-static-element-interactions": 0, diff --git a/package.json b/package.json index 4a52fe3..e309979 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "babel-eslint": "^9.0.0", "eslint": "^5.3.0", "eslint-config-airbnb": "17.1.0", + "eslint-config-prettier": "^3.0.1", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-react": "^7.11.0", diff --git a/yarn.lock b/yarn.lock index e6c4805..9b6e796 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8,6 +8,36 @@ dependencies: "@babel/highlight" "^7.0.0" +"@babel/generator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0.tgz#1efd58bffa951dc846449e58ce3a1d7f02d393aa" + dependencies: + "@babel/types" "^7.0.0" + jsesc "^2.5.1" + lodash "^4.17.10" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-function-name@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0.tgz#a68cc8d04420ccc663dd258f9cc41b8261efa2d4" + dependencies: + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.0.0" + "@babel/types" "^7.0.0" + +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-split-export-declaration@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" + dependencies: + "@babel/types" "^7.0.0" + "@babel/highlight@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" @@ -16,6 +46,40 @@ esutils "^2.0.2" js-tokens "^4.0.0" +"@babel/parser@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0.tgz#697655183394facffb063437ddf52c0277698775" + +"@babel/template@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0.tgz#c2bc9870405959c89a9c814376a2ecb247838c80" + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/types" "^7.0.0" + +"@babel/traverse@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0.tgz#b1fe9b6567fdf3ab542cfad6f3b31f854d799a61" + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.0.0" + "@babel/helper-function-name" "^7.0.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/types" "^7.0.0" + debug "^3.1.0" + globals "^11.1.0" + lodash "^4.17.10" + +"@babel/types@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0.tgz#6e191793d3c854d19c6749989e3bc55f0e962118" + dependencies: + esutils "^2.0.2" + lodash "^4.17.10" + to-fast-properties "^2.0.0" + "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" @@ -175,6 +239,17 @@ axobject-query@^2.0.1: dependencies: ast-types-flow "0.0.7" +babel-eslint@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220" + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + eslint-scope "3.7.1" + eslint-visitor-keys "^1.0.0" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -628,6 +703,12 @@ eslint-config-airbnb@17.1.0: object.assign "^4.1.0" object.entries "^1.0.4" +eslint-config-prettier@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.0.1.tgz#479214f64c1a4b344040924bfb97543db334b7b1" + dependencies: + get-stdin "^6.0.0" + eslint-import-resolver-node@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" @@ -684,6 +765,13 @@ eslint-restricted-globals@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz#35f0d5cbc64c2e3ed62e93b4b1a7af05ba7ed4d7" +eslint-scope@3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + eslint-scope@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" @@ -994,6 +1082,10 @@ get-own-enumerable-property-symbols@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -1026,7 +1118,7 @@ global-dirs@^0.1.0: dependencies: ini "^1.3.4" -globals@^11.7.0: +globals@^11.1.0, globals@^11.7.0: version "11.7.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" @@ -1440,6 +1532,10 @@ js-yaml@^3.12.0, js-yaml@^3.9.0: argparse "^1.0.7" esprima "^4.0.0" +jsesc@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -2428,7 +2524,7 @@ source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" -source-map@^0.5.6: +source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -2619,6 +2715,10 @@ tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" @@ -2651,6 +2751,10 @@ tree-kill@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36" +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" From 6bca57c8f6ae097a43d7ce50f59c127a0b37f311 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat Date: Mon, 10 Sep 2018 17:17:48 +0530 Subject: [PATCH 11/58] api/userauth is divided into /login and /signup --- client/src/components/LandingPage/Form/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/LandingPage/Form/index.js b/client/src/components/LandingPage/Form/index.js index 4816605..39feb6a 100644 --- a/client/src/components/LandingPage/Form/index.js +++ b/client/src/components/LandingPage/Form/index.js @@ -20,7 +20,9 @@ class AuthForm extends Component { changeActiveBtn = value => this.setState({ activeBtn: value }); handleSubmit = values => { - axios.post('/api/userauth', values) + const { activeBtn } = this.state; + const userauth = activeBtn === 'login' ? 'login' : 'signup'; + axios.post(`/api/${userauth}`, values) .then(() => this.props.history.push('/dashboard/dashboard')); //eslint-disable-line } From 5d2db8588e64dc32c5d3b1ca3d7655719366f087 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat Date: Mon, 10 Sep 2018 17:17:48 +0530 Subject: [PATCH 12/58] api/userauth is divided into /login and /signup --- client/src/components/LandingPage/Form/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/LandingPage/Form/index.js b/client/src/components/LandingPage/Form/index.js index 4816605..39feb6a 100644 --- a/client/src/components/LandingPage/Form/index.js +++ b/client/src/components/LandingPage/Form/index.js @@ -20,7 +20,9 @@ class AuthForm extends Component { changeActiveBtn = value => this.setState({ activeBtn: value }); handleSubmit = values => { - axios.post('/api/userauth', values) + const { activeBtn } = this.state; + const userauth = activeBtn === 'login' ? 'login' : 'signup'; + axios.post(`/api/${userauth}`, values) .then(() => this.props.history.push('/dashboard/dashboard')); //eslint-disable-line } From f8bf5b990bf7fa3cb67a497021b64e2d5ea5683e Mon Sep 17 00:00:00 2001 From: Jacob Adlers Date: Tue, 11 Sep 2018 23:01:05 +0200 Subject: [PATCH 13/58] Remove eslint-config-prettier & add rules manually --- .eslintrc.json | 87 +++++++++++++++++-- .../Dashboard/styled_components/Title.js | 1 + package.json | 1 - yarn.lock | 10 --- 4 files changed, 79 insertions(+), 20 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index d99087e..2aabdec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,16 +1,21 @@ { "parser": "babel-eslint", - "extends": ["airbnb", "prettier", "prettier/react"], + "extends": "airbnb", "plugins": ["react", "jsx-a11y", "import"], "rules": { - "jsx-a11y/no-static-element-interactions": 0, - "jsx-a11y/click-events-have-key-events": 0, - "jsx-a11y/anchor-is-valid": 2, - "jsx-a11y/href-no-hash": "off", - "react/jsx-filename-extension": "off", - "react/button-has-type": 0, "allowArrowFunctions": true, - "no-underscore-dangle": 0, + "array-bracket-spacing": "off", + "arrow-parens": ["error", "as-needed", { "requireForBlockBody": false }], + "arrow-parens": [ + "error", + "as-needed", + { + "requireForBlockBody": false + } + ], + "arrow-spacing": "off", + "block-spacing": "off", + "brace-style": "off", "comma-dangle": ["error", { "arrays": "always-multiline", "objects": "always-multiline", @@ -18,7 +23,71 @@ "exports": "always-multiline", "functions": "ignore" }], - "arrow-parens": ["error", "as-needed", { "requireForBlockBody": false }] + "comma-spacing": "off", + "comma-style": "off", + "computed-property-spacing": "off", + "dot-location": "off", + "eol-last": "error", + "func-call-spacing": "off", + "function-paren-newline": "off", + "generator-star-spacing": "off", + "implicit-arrow-linebreak": "off", + "indent": "off", + "jsx-a11y/anchor-is-valid": 2, + "jsx-a11y/click-events-have-key-events": 0, + "jsx-a11y/href-no-hash": "off", + "jsx-a11y/no-static-element-interactions": 0, + "jsx-quotes": "off", + "key-spacing": "off", + "keyword-spacing": "off", + "new-parens": "off", + "newline-per-chained-call": "off", + "no-confusing-arrow": ["error", {"allowParens": true}], + "no-extra-semi": "off", + "no-floating-decimal": "off", + "no-mixed-spaces-and-tabs": "off", + "no-multi-spaces": "off", + "no-multiple-empty-lines": "off", + "no-spaced-func": "off", + "no-trailing-spaces": "off", + "no-underscore-dangle": 0, + "no-whitespace-before-property": "off", + "nonblock-statement-body-position": "off", + "object-curly-newline": "off", + "object-curly-spacing": "off", + "object-property-newline": "off", + "one-var-declaration-per-line": "off", + "operator-linebreak": "off", + "padded-blocks": "off", + "quote-props": "off", + "react/button-has-type": 0, + "react/jsx-closing-bracket-location": "off", + "react/jsx-closing-tag-location": "off", + "react/jsx-curly-spacing": "off", + "react/jsx-filename-extension": "off", + "react/jsx-first-prop-new-line": "off", + "react/jsx-indent": "off", + "react/jsx-indent-props": "off", + "react/jsx-max-props-per-line": "off", + "react/jsx-one-expression-per-line": "off", + "react/jsx-props-no-multi-spaces": "off", + "react/jsx-tag-spacing": "off", + "react/jsx-wrap-multilines": "off", + "rest-spread-spacing": "off", + "semi": "off", + "semi-spacing": "off", + "semi-style": "off", + "space-before-blocks": "off", + "space-before-function-paren": "off", + "space-in-parens": "off", + "space-infix-ops": "off", + "space-unary-ops": "off", + "switch-colon-spacing": "off", + "template-curly-spacing": "off", + "template-tag-spacing": "off", + "unicode-bom": "off", + "wrap-iife": "off", + "yield-star-spacing": "off" }, "parserOptions": { "ecmaVersion": 8 diff --git a/client/src/components/Dashboard/styled_components/Title.js b/client/src/components/Dashboard/styled_components/Title.js index 3cd2eda..876eb47 100644 --- a/client/src/components/Dashboard/styled_components/Title.js +++ b/client/src/components/Dashboard/styled_components/Title.js @@ -1,3 +1,4 @@ +/* eslint-disable no-confusing-arrow */ import styled from 'styled-components'; const Title = styled.span` diff --git a/package.json b/package.json index e309979..4a52fe3 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "babel-eslint": "^9.0.0", "eslint": "^5.3.0", "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "^3.0.1", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-react": "^7.11.0", diff --git a/yarn.lock b/yarn.lock index 9b6e796..be93536 100644 --- a/yarn.lock +++ b/yarn.lock @@ -703,12 +703,6 @@ eslint-config-airbnb@17.1.0: object.assign "^4.1.0" object.entries "^1.0.4" -eslint-config-prettier@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.0.1.tgz#479214f64c1a4b344040924bfb97543db334b7b1" - dependencies: - get-stdin "^6.0.0" - eslint-import-resolver-node@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" @@ -1082,10 +1076,6 @@ get-own-enumerable-property-symbols@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" From 1ac5361576a2925bbc828101062f523b4960483f Mon Sep 17 00:00:00 2001 From: Jacob Adlers Date: Tue, 11 Sep 2018 23:06:27 +0200 Subject: [PATCH 14/58] Run `prettier --write` on entire code-base --- client/src/actions/index.js | 6 +- client/src/assets/spinners.js | 15 ++- .../Dashboard/DashboardView/DashProfile.js | 16 +-- .../Dashboard/DashboardView/InfoBoxes.js | 7 +- .../Dashboard/DashboardView/MessageTable.js | 45 ++++---- .../Dashboard/DashboardView/TextInput.js | 13 ++- client/src/components/Dashboard/Find/Card.js | 82 +++++++------- .../components/Dashboard/Find/CardContact.js | 18 ++- client/src/components/Dashboard/Find/Find.js | 32 ++++-- .../Dashboard/Messages/MessageReply.js | 36 +++--- .../components/Dashboard/Profile/Profile.js | 28 ++--- .../Dashboard/Profile/ProfileInfo.js | 103 +++++++++++------- .../components/Dashboard/Profile/Skills.js | 17 +-- .../Dashboard/SidePane/Header/index.js | 14 ++- .../Dashboard/SidePane/Menu/index.js | 9 +- .../Dashboard/SidePane/Menu/menuBtns.js | 5 +- client/src/components/Dashboard/index.js | 14 +-- .../Dashboard/styled_components/Bar.js | 2 +- .../Dashboard/styled_components/Title.js | 3 +- .../src/components/LandingPage/App/index.js | 5 +- .../src/components/LandingPage/App/title.js | 12 +- .../components/LandingPage/Footer/index.js | 4 +- .../src/components/LandingPage/Form/index.js | 23 ++-- .../components/LandingPage/Form/inputField.js | 10 +- .../components/LandingPage/Header/index.js | 42 ++++--- .../src/components/LandingPage/Info/index.js | 7 +- .../LandingPage/Preview/previewData.js | 19 +++- client/src/containers/DashProfile.js | 1 - client/src/containers/Dashboard.js | 5 +- client/src/containers/Find.js | 5 +- client/src/containers/InfoBoxes.js | 1 - client/src/containers/MessageTable.js | 1 - client/src/containers/Profile.js | 5 +- client/src/data/dashboard_data.js | 17 ++- client/src/fake_backend/messages.js | 12 +- client/src/fake_backend/posts.js | 3 +- client/src/fake_backend/users.js | 45 +++++--- client/src/index.js | 4 +- client/src/reducers/auth.js | 2 +- client/src/reducers/messages.js | 2 +- client/src/reducers/posts.js | 2 +- client/src/registerServiceWorker.js | 30 ++--- server/models/defaultModel.js | 3 +- server/routes/authRoutes.js | 54 ++++----- server/routes/usersRoutes.js | 7 +- server/server.js | 2 +- server/services/passport.js | 97 +++++++++-------- 47 files changed, 508 insertions(+), 377 deletions(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 655263f..4ece531 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -1,5 +1,9 @@ import axios from 'axios'; -import { FETCH_USER, FETCH_POSTS, FETCH_MESSAGES } from '../constants/actionTypes'; +import { + FETCH_USER, + FETCH_POSTS, + FETCH_MESSAGES, +} from '../constants/actionTypes'; // import { POSTS } from '../fake_backend/posts'; // import { CURRENT_USER } from '../fake_backend/users'; // import { MESSAGES } from '../fake_backend/messages'; diff --git a/client/src/assets/spinners.js b/client/src/assets/spinners.js index eae40e7..ea2f9f9 100644 --- a/client/src/assets/spinners.js +++ b/client/src/assets/spinners.js @@ -2,7 +2,13 @@ import React from 'react'; export const Spinner = () => (
- + ( export const Success = () => (
- + diff --git a/client/src/components/Dashboard/DashboardView/DashProfile.js b/client/src/components/Dashboard/DashboardView/DashProfile.js index 9b66c8e..5eda995 100644 --- a/client/src/components/Dashboard/DashboardView/DashProfile.js +++ b/client/src/components/Dashboard/DashboardView/DashProfile.js @@ -7,28 +7,24 @@ import InfoBox from '../styled_components/InfoBox'; const StatsInfo = ({ val, name, line }) => (
- {val} - {' '} - {name} + {val} {name}
- { line &&
} + {line &&
} ); const DashUserProfile = ({ currentUser }) => { const { profile, firstName, lastName } = currentUser; return ( - currentUser && profile !== undefined - && ( + currentUser && + profile !== undefined && (

- {firstName} - {' '} - {lastName} + {firstName} {lastName}

{profile.title}
@@ -43,7 +39,7 @@ const DashUserProfile = ({ currentUser }) => { {/* */}
- ) + ) ); }; diff --git a/client/src/components/Dashboard/DashboardView/InfoBoxes.js b/client/src/components/Dashboard/DashboardView/InfoBoxes.js index 39cb95b..782b48a 100644 --- a/client/src/components/Dashboard/DashboardView/InfoBoxes.js +++ b/client/src/components/Dashboard/DashboardView/InfoBoxes.js @@ -7,7 +7,6 @@ import Bar from '../styled_components/Bar'; import { BOX_INFO } from '../../../data/dashboard_data'; import { MessagesIcon } from '../../../assets/icons'; - export const ProgressBar = ({ width }) => (
@@ -25,7 +24,9 @@ const InfoBoxes = ({ messages }) => ( ))} -
+
+ +
{Object.keys(messages).length} Unread Messages @@ -48,7 +49,7 @@ InfoBoxes.propTypes = { }), body: PropTypes.string.isRequired, __v: PropTypes.number, - }), + }) ).isRequired, }; diff --git a/client/src/components/Dashboard/DashboardView/MessageTable.js b/client/src/components/Dashboard/DashboardView/MessageTable.js index d12c303..b7a8621 100644 --- a/client/src/components/Dashboard/DashboardView/MessageTable.js +++ b/client/src/components/Dashboard/DashboardView/MessageTable.js @@ -6,35 +6,33 @@ import PropTypes from 'prop-types'; import InfoBox from '../styled_components/InfoBox'; import TextInput from './TextInput'; -const Message = ({ msg }) => ( - msg.post - && ( -
-
- -

- {msg.firstName} - {' '} - {msg.lastName} -

- {moment(msg.post.date).fromNow()} - +const Message = ({ msg }) => + msg.post && ( +
+
+ +

+ {msg.firstName} {msg.lastName} +

+ + {moment(msg.post.date).fromNow()} + + +
+

{msg.post.body}

-

{msg.post.body}

-
- ) -); + ); class MessagesTable extends Component { state = { body: '' }; - onPostChange = (key, e) => this.setState({ [key]: e.target.value }) + onPostChange = (key, e) => this.setState({ [key]: e.target.value }); addPost = () => { const formData = this.state; const data = this.props; axios.post('/api/all_posts', { data, formData }); - } + }; render() { // eslint-disable-next-line react/destructuring-assignment @@ -42,12 +40,11 @@ class MessagesTable extends Component { const { body } = this.state; return ( - +
- {posts.reverse().map(msg => )} + {posts.reverse().map(msg => ( + + ))}
); diff --git a/client/src/components/Dashboard/DashboardView/TextInput.js b/client/src/components/Dashboard/DashboardView/TextInput.js index 456fb3b..fab1578 100644 --- a/client/src/components/Dashboard/DashboardView/TextInput.js +++ b/client/src/components/Dashboard/DashboardView/TextInput.js @@ -7,19 +7,21 @@ class TextInput extends Component { toggleMessage = () => { this.setState(({ expanded }) => ({ expanded: !expanded })); - } + }; render() { const { expanded } = this.state; const { body, onPostChange } = this.props; return (
-
+
- {expanded - && ( + {expanded && ( - ) - } + )}
); diff --git a/client/src/components/Dashboard/Find/Card.js b/client/src/components/Dashboard/Find/Card.js index 2d5df71..17d30a7 100644 --- a/client/src/components/Dashboard/Find/Card.js +++ b/client/src/components/Dashboard/Find/Card.js @@ -6,10 +6,7 @@ import { ProgressBar } from '../DashboardView/InfoBoxes'; import CardContact from './CardContact'; const CardButton = ({ btn, changeView }) => ( -
changeView(btn.toLowerCase())} - > +
changeView(btn.toLowerCase())}> {btn}
); @@ -20,24 +17,19 @@ const CardAbout = ({ text }) => (
); -const CardSkills = ({ skills }) => ( - skills - && ( -
-
- {skills.slice(0, 3).map(skill => ( -
- - {skill.lang} -: - - -
- ))} +const CardSkills = ({ skills }) => + skills && ( +
+
+ {skills.slice(0, 3).map(skill => ( +
+ {skill.lang}: + +
+ ))} +
-
- ) -); + ); class Card extends Component { constructor() { @@ -50,48 +42,60 @@ class Card extends Component { showIcons = () => { const { expanded } = this.state; this.setState({ expanded: !expanded }); - } + }; changeView = view => { this.setState({ active: view }); - } + }; onSubmit = values => { const { user, currentUser, fetchMessages } = this.props; axios.post('/api/add_message', { values, user, currentUser }); fetchMessages(); - } + }; render() { const { user, i } = this.props; const { active } = this.state; return ( - +
{user.firstName}

- {user.firstName} - {' '} - {user.lastName} + {user.firstName} {user.lastName}

{user.profile.title || 'Developer'}

- - + +
- { active === 'about' - ? ( -
- - -
- ) - : - } + {active === 'about' ? ( +
+ + +
+ ) : ( + + )} ); } diff --git a/client/src/components/Dashboard/Find/CardContact.js b/client/src/components/Dashboard/Find/CardContact.js index be9ca77..c98c82b 100644 --- a/client/src/components/Dashboard/Find/CardContact.js +++ b/client/src/components/Dashboard/Find/CardContact.js @@ -2,10 +2,18 @@ import React from 'react'; import { reduxForm, Field } from 'redux-form'; import PropTypes from 'prop-types'; import { - ProfileIcon, MessagesIcon, LinkedinIcon, GithubIcon, + ProfileIcon, + MessagesIcon, + LinkedinIcon, + GithubIcon, } from '../../../assets/icons'; -const Icons = [, , , ]; +const Icons = [ + , + , + , + , +]; const ContactForm = ({ handleSubmit }) => (
@@ -14,7 +22,11 @@ const ContactForm = ({ handleSubmit }) => (
); diff --git a/client/src/components/Dashboard/Find/Find.js b/client/src/components/Dashboard/Find/Find.js index b384f79..65ba510 100644 --- a/client/src/components/Dashboard/Find/Find.js +++ b/client/src/components/Dashboard/Find/Find.js @@ -60,11 +60,15 @@ class Find extends Component { } getUsers = async () => { - setTimeout(() => this.setState({ - loaded: true, - activeUsers: ALL_USERS, - }), 2000); - } + setTimeout( + () => + this.setState({ + loaded: true, + activeUsers: ALL_USERS, + }), + 2000 + ); + }; updateResults = name => { const { filterOptions, activeUsers } = this.state; @@ -74,11 +78,13 @@ class Find extends Component { const deleteIndex = filterOptions.indexOf(name); filterOptions.splice(deleteIndex, 1); } - const updatedUsers = activeUsers.filter( - user => filterOptions.every(opt => user.skills.includes(opt)), + const updatedUsers = activeUsers.filter(user => + filterOptions.every(opt => user.skills.includes(opt)) ); - this.setState({ activeUsers: filterOptions.length ? updatedUsers : activeUsers }); - } + this.setState({ + activeUsers: filterOptions.length ? updatedUsers : activeUsers, + }); + }; render() { const { activeUsers, loaded } = this.state; @@ -87,12 +93,14 @@ class Find extends Component {
{/* */}
- {!loaded ? - : Object.values(activeUsers).map( + {!loaded ? ( + + ) : ( + Object.values(activeUsers).map( // eslint-disable-next-line comma-dangle (user, i) => ) - } + )}
); diff --git a/client/src/components/Dashboard/Messages/MessageReply.js b/client/src/components/Dashboard/Messages/MessageReply.js index 58e3e25..71cdd71 100644 --- a/client/src/components/Dashboard/Messages/MessageReply.js +++ b/client/src/components/Dashboard/Messages/MessageReply.js @@ -5,26 +5,24 @@ import { MessageConsumer } from './Messages'; const MessageReply = ({ messages, activeMessage, handleSubmit }) => { const message = messages.length && messages[activeMessage]; - return messages.length && ( -
-
-
-
- - {message.author.firstName} - {' '} - {message.author.lastName} - + return ( + messages.length && ( +
+ +
+
+ + {message.author.firstName} {message.author.lastName} + +
+
- -
-
- {message.body} -
- - - -
+
{message.body}
+ + + +
+ ) ); }; diff --git a/client/src/components/Dashboard/Profile/Profile.js b/client/src/components/Dashboard/Profile/Profile.js index 8e519bf..54eef1f 100644 --- a/client/src/components/Dashboard/Profile/Profile.js +++ b/client/src/components/Dashboard/Profile/Profile.js @@ -21,24 +21,26 @@ class UserProfile extends React.Component { success: res.status === 200, loaded: true, }); - } + }; render() { const reqData = { ...this.state }; const { currentUser } = this.props; - return currentUser && ( -
-
- + return ( + currentUser && ( +
+
+ +
-
+ ) ); } } diff --git a/client/src/components/Dashboard/Profile/ProfileInfo.js b/client/src/components/Dashboard/Profile/ProfileInfo.js index bb1e875..7a2ef5b 100644 --- a/client/src/components/Dashboard/Profile/ProfileInfo.js +++ b/client/src/components/Dashboard/Profile/ProfileInfo.js @@ -9,30 +9,33 @@ import { Spinner, Success } from '../../../assets/spinners'; const selectOpts = ['Male', 'Female', 'Other']; const lower = x => x.toLowerCase(); -const sortInputForms = x => (!(x === 'complete' - || x === 'img' - || x === 'skills' - || x === 'password' - || x === 'profile' - || x.startsWith('_') -)); +const sortInputForms = x => + !( + x === 'complete' || + x === 'img' || + x === 'skills' || + x === 'password' || + x === 'profile' || + x.startsWith('_') + ); const RequestMessage = ({ req, loaded, success }) => ( - { !req ? 'Save Changes' - : req && !loaded ? ( - - - Updating... - - ) - : success && loaded ? ( - - - Successfully updated! - - ) - : !success && loaded && 'Something went wrong..' } + {!req ? ( + 'Save Changes' + ) : req && !loaded ? ( + + + Updating... + + ) : success && loaded ? ( + + + Successfully updated! + + ) : ( + !success && loaded && 'Something went wrong..' + )} ); @@ -40,17 +43,32 @@ const ProfileInputField = ({ field, currentUser }) => (
{field}
- { field === 'description' - ? - : field === 'gender' ? ( - - {selectOpts.map( - // eslint-disable-next-line comma-dangle - opt => - )} - - ) - : } + {field === 'description' ? ( + + ) : field === 'gender' ? ( + + {selectOpts.map( + // eslint-disable-next-line comma-dangle + opt => ( + + ) + )} + + ) : ( + + )}
); @@ -61,13 +79,17 @@ const ProfileInputFields = ({ currentUser, profile = false }) => { fields = fields.filter(x => sortInputForms(x)); return fields.map( // eslint-disable-next-line comma-dangle - field => + field => ( + + ) ); }; -const ProfileInfoForm = ({ - info, handleSubmit, reqData, -}) => ( +const ProfileInfoForm = ({ info, handleSubmit, reqData }) => // console.log('profile info form props', props); info && (
@@ -87,12 +109,15 @@ const ProfileInfoForm = ({
- ) -); + ); RequestMessage.propTypes = { req: PropTypes.bool.isRequired, diff --git a/client/src/components/Dashboard/Profile/Skills.js b/client/src/components/Dashboard/Profile/Skills.js index 57cab8f..f11a613 100644 --- a/client/src/components/Dashboard/Profile/Skills.js +++ b/client/src/components/Dashboard/Profile/Skills.js @@ -22,10 +22,14 @@ class Skill extends Component { return (
- - { USED_LANGUAGES.map(lang => ( - )) - } + + {USED_LANGUAGES.map(lang => ( + + ))} (
Skills {skills.map((skill, i) => ( - + ))}
); diff --git a/client/src/components/Dashboard/SidePane/Header/index.js b/client/src/components/Dashboard/SidePane/Header/index.js index 5decd1d..90d11f5 100644 --- a/client/src/components/Dashboard/SidePane/Header/index.js +++ b/client/src/components/Dashboard/SidePane/Header/index.js @@ -1,18 +1,20 @@ import React from 'react'; -const DashHeaderContent = ({ currentUser }) => ( - currentUser !== undefined - && ( +const DashHeaderContent = ({ currentUser }) => + currentUser !== undefined && (

CodeBuddy

- +
- ) -); + ); export default DashHeaderContent; diff --git a/client/src/components/Dashboard/SidePane/Menu/index.js b/client/src/components/Dashboard/SidePane/Menu/index.js index e1bf97d..ca6dd3f 100644 --- a/client/src/components/Dashboard/SidePane/Menu/index.js +++ b/client/src/components/Dashboard/SidePane/Menu/index.js @@ -13,16 +13,11 @@ const Menu = () => ( activeClassName="active" key={shortid.generate()} > -
- {btn.icon} -
+
{btn.icon}
{btn.name} ))} - +
diff --git a/client/src/components/Dashboard/SidePane/Menu/menuBtns.js b/client/src/components/Dashboard/SidePane/Menu/menuBtns.js index c5e6f7f..252e1e2 100644 --- a/client/src/components/Dashboard/SidePane/Menu/menuBtns.js +++ b/client/src/components/Dashboard/SidePane/Menu/menuBtns.js @@ -1,6 +1,9 @@ import React from 'react'; import { - SearchIcon, ProfileIcon, MessagesIcon, DashboardIcon, + SearchIcon, + ProfileIcon, + MessagesIcon, + DashboardIcon, } from '../../../../assets/icons'; const MENU_CONTENTS = [ diff --git a/client/src/components/Dashboard/index.js b/client/src/components/Dashboard/index.js index 9c3c63c..e150882 100644 --- a/client/src/components/Dashboard/index.js +++ b/client/src/components/Dashboard/index.js @@ -11,9 +11,7 @@ import Messages from '../../containers/Messages'; const View = ({ children }) => ( // console.log('children', children); -
- {children} -
+
{children}
); class Dashboard extends Component { @@ -25,9 +23,7 @@ class Dashboard extends Component { } componentDidMount() { - const { - fetchUser, fetchPosts, fetchMessages, currentUser, - } = this.props; + const { fetchUser, fetchPosts, fetchMessages, currentUser } = this.props; // console.log('=====>', currentUser); fetchUser(); fetchPosts(); @@ -46,13 +42,13 @@ class Dashboard extends Component { case 'messages': return ; - // no default + // no default } - } + }; changeView = view => { this.setState({ currentView: view }); - } + }; render() { // eslint-disable-next-line react/destructuring-assignment diff --git a/client/src/components/Dashboard/styled_components/Bar.js b/client/src/components/Dashboard/styled_components/Bar.js index 165a95b..a0966b3 100644 --- a/client/src/components/Dashboard/styled_components/Bar.js +++ b/client/src/components/Dashboard/styled_components/Bar.js @@ -1,7 +1,7 @@ import styled from 'styled-components'; const Bar = styled.div` - animation: grow .8s cubic-bezier(.75,.2,.39,1.02) forwards; + animation: grow 0.8s cubic-bezier(0.75, 0.2, 0.39, 1.02) forwards; width: ${props => props.width}px; background-color: #00b496; box-shadow: #00b496 0px 0px 10px; diff --git a/client/src/components/Dashboard/styled_components/Title.js b/client/src/components/Dashboard/styled_components/Title.js index 876eb47..72ab9a2 100644 --- a/client/src/components/Dashboard/styled_components/Title.js +++ b/client/src/components/Dashboard/styled_components/Title.js @@ -2,7 +2,8 @@ import styled from 'styled-components'; const Title = styled.span` - font-family: ${props => (props.title ? 'Roboto' : 'Source Sans Pro')};, sans-serif; + font-family: ${props => + props.title ? 'Roboto' : 'Source Sans Pro'};, sans-serif; font-size: ${props => (props.title ? '25px' : '14px')}; font-weight: lighter; color: rgba(255, 255, 255, 0.8); diff --git a/client/src/components/LandingPage/App/index.js b/client/src/components/LandingPage/App/index.js index fba5e47..22a6032 100644 --- a/client/src/components/LandingPage/App/index.js +++ b/client/src/components/LandingPage/App/index.js @@ -24,4 +24,7 @@ App.propTypes = { history: PropTypes.object.isRequired, //eslint-disable-line }; -export default connect(null, actions)(App); +export default connect( + null, + actions +)(App); diff --git a/client/src/components/LandingPage/App/title.js b/client/src/components/LandingPage/App/title.js index 069a1c5..14632ea 100644 --- a/client/src/components/LandingPage/App/title.js +++ b/client/src/components/LandingPage/App/title.js @@ -5,9 +5,13 @@ export default class Title extends Component { state = { activeIndex: 0 }; componentDidMount() { - setInterval(() => this.setState(prevState => ({ - activeIndex: prevState.activeIndex + 1, - })), 4000); + setInterval( + () => + this.setState(prevState => ({ + activeIndex: prevState.activeIndex + 1, + })), + 4000 + ); } render() { @@ -15,7 +19,7 @@ export default class Title extends Component { const index = activeIndex % WORDS.length; return (

-Find A Partner To + Find A Partner To {WORDS[index].word}

); diff --git a/client/src/components/LandingPage/Footer/index.js b/client/src/components/LandingPage/Footer/index.js index 7cd5e72..34ddbc5 100644 --- a/client/src/components/LandingPage/Footer/index.js +++ b/client/src/components/LandingPage/Footer/index.js @@ -6,7 +6,9 @@ const FooterWrapper = () => ( {FOOTER_CONTENT.map(block => (
))}
diff --git a/client/src/components/LandingPage/Form/index.js b/client/src/components/LandingPage/Form/index.js index 39feb6a..b22c872 100644 --- a/client/src/components/LandingPage/Form/index.js +++ b/client/src/components/LandingPage/Form/index.js @@ -9,8 +9,12 @@ import InputFields from './inputField'; const ButtonSwipe = ({ activeBtn, changeActiveBtn }) => (
); @@ -22,21 +26,22 @@ class AuthForm extends Component { handleSubmit = values => { const { activeBtn } = this.state; const userauth = activeBtn === 'login' ? 'login' : 'signup'; - axios.post(`/api/${userauth}`, values) + axios + .post(`/api/${userauth}`, values) .then(() => this.props.history.push('/dashboard/dashboard')); //eslint-disable-line - } + }; render() { const { activeBtn } = this.state; return (
- +
- +
diff --git a/client/src/components/LandingPage/Form/inputField.js b/client/src/components/LandingPage/Form/inputField.js index 82ceb20..9f98516 100644 --- a/client/src/components/LandingPage/Form/inputField.js +++ b/client/src/components/LandingPage/Form/inputField.js @@ -15,9 +15,10 @@ class InputFields extends Component { render() { const { handleSubmit, activeBtn } = this.props; const { animate } = this.state; - const fieldInfo = activeBtn === 'login' - ? { type: LOGIN_FIELDS, class: 'lg' } - : { type: SIGNUP_FIELDS, class: 'su' }; + const fieldInfo = + activeBtn === 'login' + ? { type: LOGIN_FIELDS, class: 'lg' } + : { type: SIGNUP_FIELDS, class: 'su' }; return (
@@ -28,7 +29,8 @@ class InputFields extends Component { type={field.type} component="input" placeholder={field.placeholder} - className={`input-${fieldInfo.class}-${index + 1} animate-${animate}`} + className={`input-${fieldInfo.class}-${index + + 1} animate-${animate}`} /> ))} diff --git a/client/src/components/LandingPage/Header/index.js b/client/src/components/LandingPage/Header/index.js index 4e13a0b..9710d55 100644 --- a/client/src/components/LandingPage/Header/index.js +++ b/client/src/components/LandingPage/Header/index.js @@ -4,18 +4,21 @@ import { MenuIcon } from '../../../assets/icons'; const ListMenu = () => ( ); const MobileListMenu = ({ onClick, menuActive }) => (
    - {!menuActive - ? - : - } + {!menuActive ? : }
); @@ -31,26 +34,29 @@ class Header extends Component { } updateWindowDimensions = () => { - const width = window.innerWidth - || document.documentElement.clientWidth - || document.body.clientWidth; + const width = + window.innerWidth || + document.documentElement.clientWidth || + document.body.clientWidth; this.setState({ width }); - } + }; - toggleMenu = () => this.setState(prevState => ({ - menuActive: !prevState.menuActive, - })); + toggleMenu = () => + this.setState(prevState => ({ + menuActive: !prevState.menuActive, + })); render() { const { menuActive, width } = this.state; return (

CodeBuddy

- {width > 700 - ? - : - } + {width > 700 ? ( + + ) : ( + + )}
); } diff --git a/client/src/components/LandingPage/Info/index.js b/client/src/components/LandingPage/Info/index.js index 0d2f92c..b286258 100644 --- a/client/src/components/LandingPage/Info/index.js +++ b/client/src/components/LandingPage/Info/index.js @@ -2,7 +2,12 @@ import React from 'react'; const Info = () => (
- CodeBuddy is the best way to help you hone your coding skills and make new friends. CodeBuddy is an amazing way to get real experience on projects you're passionate about working in technology you already know or want to learn. + + CodeBuddy is the best way to help you hone your coding skills and make new + friends. CodeBuddy is an amazing way to get real experience on projects + you're passionate about working in technology you already know or + want to learn. +
); diff --git a/client/src/components/LandingPage/Preview/previewData.js b/client/src/components/LandingPage/Preview/previewData.js index ba73865..d8fb2ef 100644 --- a/client/src/components/LandingPage/Preview/previewData.js +++ b/client/src/components/LandingPage/Preview/previewData.js @@ -3,9 +3,22 @@ import fakepic2 from '../../../assets/fakepic2.png'; import fakepic3 from '../../../assets/fakepic3.png'; const PREVIEW_DATA = [ - { img: fakepic1, title: 'Find People', subtitle: 'Find people who are valuable to your project.' }, - { img: fakepic2, title: 'Share Ideas', subtitle: 'Inspire other people with your side project ideas.' }, - { img: fakepic3, title: 'Create a Team', subtitle: 'Work together with people who have the right skill set, and start your own team.' }, + { + img: fakepic1, + title: 'Find People', + subtitle: 'Find people who are valuable to your project.', + }, + { + img: fakepic2, + title: 'Share Ideas', + subtitle: 'Inspire other people with your side project ideas.', + }, + { + img: fakepic3, + title: 'Create a Team', + subtitle: + 'Work together with people who have the right skill set, and start your own team.', + }, ]; export default PREVIEW_DATA; diff --git a/client/src/containers/DashProfile.js b/client/src/containers/DashProfile.js index 7f30cc7..739acd7 100644 --- a/client/src/containers/DashProfile.js +++ b/client/src/containers/DashProfile.js @@ -1,7 +1,6 @@ import { connect } from 'react-redux'; import DashUserProfile from '../components/Dashboard/DashboardView/DashProfile'; - const mapStateToProps = state => ({ currentUser: state.user, messages: state.messages, diff --git a/client/src/containers/Dashboard.js b/client/src/containers/Dashboard.js index cbf2c6a..56da6d6 100644 --- a/client/src/containers/Dashboard.js +++ b/client/src/containers/Dashboard.js @@ -12,4 +12,7 @@ const mapDispatchToProps = dispatch => ({ fetchMessages: () => dispatch(fetchMessages), }); -export default connect(mapStateToProps, mapDispatchToProps)(Dashboard); +export default connect( + mapStateToProps, + mapDispatchToProps +)(Dashboard); diff --git a/client/src/containers/Find.js b/client/src/containers/Find.js index ccd64bc..1cfc7ef 100644 --- a/client/src/containers/Find.js +++ b/client/src/containers/Find.js @@ -10,4 +10,7 @@ const mapDispatchToProps = dispatch => ({ fetchMessages: () => dispatch(fetchMessages), }); -export default connect(mapStateToProps, mapDispatchToProps)(Find); +export default connect( + mapStateToProps, + mapDispatchToProps +)(Find); diff --git a/client/src/containers/InfoBoxes.js b/client/src/containers/InfoBoxes.js index 07bd8ad..37c74a3 100644 --- a/client/src/containers/InfoBoxes.js +++ b/client/src/containers/InfoBoxes.js @@ -1,7 +1,6 @@ import { connect } from 'react-redux'; import InfoBoxes from '../components/Dashboard/DashboardView/InfoBoxes'; - const mapStateToProps = state => ({ messages: state.messages, }); diff --git a/client/src/containers/MessageTable.js b/client/src/containers/MessageTable.js index 09331b1..e92cd50 100644 --- a/client/src/containers/MessageTable.js +++ b/client/src/containers/MessageTable.js @@ -1,7 +1,6 @@ import { connect } from 'react-redux'; import MessagesTable from '../components/Dashboard/DashboardView/MessageTable'; - const mapStateToProps = state => ({ user: state.user, posts: state.posts, diff --git a/client/src/containers/Profile.js b/client/src/containers/Profile.js index 73a7ce2..842559b 100644 --- a/client/src/containers/Profile.js +++ b/client/src/containers/Profile.js @@ -10,4 +10,7 @@ const mapDispatchToProps = dispatch => ({ fetchUser: () => dispatch(fetchUser), }); -export default connect(mapStateToProps, mapDispatchToProps)(UserProfile); +export default connect( + mapStateToProps, + mapDispatchToProps +)(UserProfile); diff --git a/client/src/data/dashboard_data.js b/client/src/data/dashboard_data.js index 569b2ae..acb8fa2 100644 --- a/client/src/data/dashboard_data.js +++ b/client/src/data/dashboard_data.js @@ -1,5 +1,9 @@ import React from 'react'; -import { ConnectRequestIcon, ProfileViewIcon, MessagesIcon } from '../assets/icons'; +import { + ConnectRequestIcon, + ProfileViewIcon, + MessagesIcon, +} from '../assets/icons'; export const BOX_INFO = [ { value: 931, name: 'Profile Views', icon: }, @@ -49,7 +53,6 @@ export const BAR_CHART_DATA = { ], }; - export const MESSAGES_DATA = [ { author: 'Sarah Green', @@ -60,13 +63,14 @@ export const MESSAGES_DATA = [ { author: 'John Doe', imgURL: 'https://randomuser.me/api/portraits/men/33.jpg', - message: 'Working on a great new project! Does anyone have experience with GraphQL?', + message: + 'Working on a great new project! Does anyone have experience with GraphQL?', publishTime: '6m', }, { author: 'Harry Red', imgURL: 'https://randomuser.me/api/portraits/men/17.jpg', - message: 'Can\'t wait until our app goes live! Exciting times! Thanks team!', + message: "Can't wait until our app goes live! Exciting times! Thanks team!", publishTime: '11m', }, { @@ -84,13 +88,14 @@ export const MESSAGES_DATA = [ { author: 'John Doe', imgURL: 'https://randomuser.me/api/portraits/men/33.jpg', - message: 'Working on a great new project! Does anyone have experience with GraphQL?', + message: + 'Working on a great new project! Does anyone have experience with GraphQL?', publishTime: '19m', }, { author: 'Harry Red', imgURL: 'https://randomuser.me/api/portraits/men/17.jpg', - message: 'Can\'t wait until our app goes live! Exciting times! Thanks team!', + message: "Can't wait until our app goes live! Exciting times! Thanks team!", publishTime: '44m', }, { diff --git a/client/src/fake_backend/messages.js b/client/src/fake_backend/messages.js index 456eca0..ff6bc3c 100644 --- a/client/src/fake_backend/messages.js +++ b/client/src/fake_backend/messages.js @@ -6,7 +6,8 @@ const MESSAGES = [ img: 'https://randomuser.me/api/portraits/men/74.jpg', date: { $date: '2018-06-03T19:51:52.578Z' }, }, - body: "Hi Lydia! I saw your profile and I was wondering if you'd be interested in collaborating with me!", + body: + "Hi Lydia! I saw your profile and I was wondering if you'd be interested in collaborating with me!", __v: 0, }, { @@ -26,7 +27,8 @@ const MESSAGES = [ img: 'https://randomuser.me/api/portraits/women/11.jpg', date: { $date: '2018-06-03T19:51:52.578Z' }, }, - body: "I am Kristiina, an Android developer. If you want help with your android app, I'm free to help!", + body: + "I am Kristiina, an Android developer. If you want help with your android app, I'm free to help!", __v: 0, }, { @@ -36,7 +38,8 @@ const MESSAGES = [ img: 'https://randomuser.me/api/portraits/women/58.jpg', date: { $date: '2018-06-03T19:51:52.578Z' }, }, - body: "Hi Lydia! I'm thinking about a really nice app that I want to build, but I need a JS developer. Are you interested?", + body: + "Hi Lydia! I'm thinking about a really nice app that I want to build, but I need a JS developer. Are you interested?", __v: 0, }, { @@ -46,7 +49,8 @@ const MESSAGES = [ img: 'https://randomuser.me/api/portraits/women/28.jpg', date: { $date: '2018-06-03T19:51:52.578Z' }, }, - body: 'Do you need help with any backend implementation? If so, let me know!', + body: + 'Do you need help with any backend implementation? If so, let me know!', __v: 0, }, ]; diff --git a/client/src/fake_backend/posts.js b/client/src/fake_backend/posts.js index b904f61..3b78a63 100644 --- a/client/src/fake_backend/posts.js +++ b/client/src/fake_backend/posts.js @@ -54,7 +54,8 @@ const POSTS = [ { post: { title: 'hoi', - body: 'Does anyone know a good UI/UX designer who could help out with svg animation?', + body: + 'Does anyone know a good UI/UX designer who could help out with svg animation?', date: { $date: '2018-06-01T11:24:44.603Z', }, diff --git a/client/src/fake_backend/users.js b/client/src/fake_backend/users.js index 3e8e2f9..8be371f 100644 --- a/client/src/fake_backend/users.js +++ b/client/src/fake_backend/users.js @@ -2,7 +2,8 @@ export const CURRENT_USER = [ { profile: { userName: 'lydiahallie', - img: 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', + img: + 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', title: 'JavaScript Developer', skills: [ { lang: 'JavaScript', value: 95 }, @@ -10,7 +11,8 @@ export const CURRENT_USER = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Lydia', lastName: 'Hallie', @@ -22,7 +24,8 @@ export const ALL_USERS = [ { profile: { userName: 'lydiahallie', - img: 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', + img: + 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', title: 'JavaScript Developer', skills: [ { lang: 'JavaScript', value: 95 }, @@ -30,7 +33,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Lydia', lastName: 'Hallie', @@ -64,7 +68,8 @@ export const ALL_USERS = [ { lang: 'Ruby on Rails', value: 70 }, ], level: 'Advanced', - description: 'I am an experience front end engineer who works a lot with JavaScript, Python and RoR.', + description: + 'I am an experience front end engineer who works a lot with JavaScript, Python and RoR.', }, firstName: 'Sarah', lastName: 'Johnson', @@ -115,7 +120,8 @@ export const ALL_USERS = [ { lang: 'Sass', value: 90 }, ], level: 'Advanced', - description: 'I am an art school graduate who has designed websites for tech giants.', + description: + 'I am an art school graduate who has designed websites for tech giants.', }, firstName: 'Sara', lastName: 'Wade', @@ -132,7 +138,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 60 }, ], level: 'Advanced', - description: "I'm a computer science student in Iceland, working on strengthening my backend skills.", + description: + "I'm a computer science student in Iceland, working on strengthening my backend skills.", }, firstName: 'Sigurðr', lastName: ' Melvin', @@ -149,7 +156,8 @@ export const ALL_USERS = [ { lang: 'Haskell', value: 80 }, ], level: 'Advanced', - description: 'I am a computer programmer who has worked a lot with game developement.', + description: + 'I am a computer programmer who has worked a lot with game developement.', }, firstName: 'Hubert', lastName: 'Beran', @@ -183,7 +191,8 @@ export const ALL_USERS = [ { lang: 'Go', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Kristiina', lastName: 'Thomas', @@ -217,7 +226,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: 'I am a backend engineer who works on 2D games in my free time!', + description: + 'I am a backend engineer who works on 2D games in my free time!', }, firstName: 'Rosalina', lastName: 'Holub', @@ -251,7 +261,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Marina', lastName: 'Hewitt', @@ -268,7 +279,8 @@ export const ALL_USERS = [ { lang: 'Ruby', value: 80 }, ], level: 'Advanced', - description: "I'm a front end developer who is always coding in his freetime!", + description: + "I'm a front end developer who is always coding in his freetime!", }, firstName: 'Merav', lastName: 'Kuiper', @@ -285,7 +297,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Mosi', lastName: 'Holzer', @@ -319,7 +332,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Nikhil', lastName: 'Jedlička', @@ -336,7 +350,8 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", + description: + "I'm a highly motivated JavaScript developer who is always looking for interesting side projects!", }, firstName: 'Jóna', lastName: 'Mutton', diff --git a/client/src/index.js b/client/src/index.js index 9c4dc41..9efdb23 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -15,7 +15,7 @@ import './styles/main.sass'; const store = createStore( reducers, - composeWithDevTools(applyMiddleware(thunk)), + composeWithDevTools(applyMiddleware(thunk)) ); export default store; @@ -29,6 +29,6 @@ ReactDOM.render( , - document.getElementById('root'), + document.getElementById('root') ); registerServiceWorker(); diff --git a/client/src/reducers/auth.js b/client/src/reducers/auth.js index a4e0e19..1b3bd2b 100644 --- a/client/src/reducers/auth.js +++ b/client/src/reducers/auth.js @@ -14,7 +14,7 @@ export const authReducer = (state = {}, action) => { case LOGOUT: case REGISTER: case FETCH_USER: - return state.user = action.payload || false; + return (state.user = action.payload || false); default: return state; } diff --git a/client/src/reducers/messages.js b/client/src/reducers/messages.js index a4c6833..b5147d9 100644 --- a/client/src/reducers/messages.js +++ b/client/src/reducers/messages.js @@ -14,7 +14,7 @@ export const messagesReducer = (state = [], action) => { case DELETE_MESSAGE: case FETCH_MESSAGES: console.log('yepppp definitely messages!!!', action.payload); - return state.messages = action.payload || false; + return (state.messages = action.payload || false); default: return state; } diff --git a/client/src/reducers/posts.js b/client/src/reducers/posts.js index f073fbb..66d3029 100644 --- a/client/src/reducers/posts.js +++ b/client/src/reducers/posts.js @@ -5,7 +5,7 @@ import { FETCH_POSTS } from '../constants/actionTypes.js'; export const postsReducer = (state = {}, action) => { switch (action.type) { case FETCH_POSTS: - return state.posts = action.payload || false; + return (state.posts = action.payload || false); default: return state; } diff --git a/client/src/registerServiceWorker.js b/client/src/registerServiceWorker.js index 9d71ded..ab54470 100644 --- a/client/src/registerServiceWorker.js +++ b/client/src/registerServiceWorker.js @@ -11,13 +11,13 @@ // This link also includes instructions on opting out of this behavior. const isLocalhost = Boolean( - window.location.hostname === 'localhost' + window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. - || window.location.hostname === '[::1]' + window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. - || window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/, - ), + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) ); export default function register() { @@ -42,8 +42,8 @@ export default function register() { // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( - 'This web app is being served cache-first by a service ' - + 'worker. To learn more, visit https://goo.gl/SC7cgQ', + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://goo.gl/SC7cgQ' ); }); } else { @@ -57,7 +57,7 @@ export default function register() { function registerValidSW(swUrl) { navigator.serviceWorker .register(swUrl) - .then((registration) => { + .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; installingWorker.onstatechange = () => { @@ -78,7 +78,7 @@ function registerValidSW(swUrl) { }; }; }) - .catch((error) => { + .catch(error => { console.error('Error during service worker registration:', error); }); } @@ -86,14 +86,14 @@ function registerValidSW(swUrl) { function checkValidServiceWorker(swUrl) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) - .then((response) => { + .then(response => { // Ensure service worker exists, and that we really are getting a JS file. if ( - response.status === 404 - || response.headers.get('content-type').indexOf('javascript') === -1 + response.status === 404 || + response.headers.get('content-type').indexOf('javascript') === -1 ) { // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then((registration) => { + navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); @@ -105,14 +105,14 @@ function checkValidServiceWorker(swUrl) { }) .catch(() => { console.log( - 'No internet connection found. App is running in offline mode.', + 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then((registration) => { + navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); } diff --git a/server/models/defaultModel.js b/server/models/defaultModel.js index f630d16..bfcdb20 100644 --- a/server/models/defaultModel.js +++ b/server/models/defaultModel.js @@ -10,5 +10,6 @@ exports.DEFAULT_USER_MODEL = { { lang: 'Language3', value: 30 }, ], level: 'Beginner', - description: 'This is the default description for new users. Please update this to your own original bio!', + description: + 'This is the default description for new users. Please update this to your own original bio!', }; diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index 17c3fa3..02b315c 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -5,13 +5,13 @@ module.exports = app => { '/auth/google', passport.authenticate('google', { scope: ['profile', 'email'], - }), + }) ); app.get( '/auth/google/callback', passport.authenticate('google'), - (req, res) => res.redirect('/dashboard'), + (req, res) => res.redirect('/dashboard') ); app.get('/api/logout', (req, res) => { @@ -19,32 +19,26 @@ module.exports = app => { res.redirect('/'); }); - app.post( - '/api/login', - (req, res, next) => { - passport.authenticate('local-login', (err, user, info) => { - if (err) { - return res.status(500).send({ error: 'Internal Server Error' }); - } - if (!user) { - return res.status(400).send({ error: info }); - } - return res.send('Done'); - })(req, res, next); - } - ); - app.post( - '/api/signup', - (req, res, next) => { - passport.authenticate('local-signup', (err, user, info) => { - if (err) { - return res.status(500).send({ error: 'Internal Server Error' }); - } - if (!user) { - return res.status(400).send({ error: info }); - } - return res.send('Done'); - })(req, res, next); - } - ); + app.post('/api/login', (req, res, next) => { + passport.authenticate('local-login', (err, user, info) => { + if (err) { + return res.status(500).send({ error: 'Internal Server Error' }); + } + if (!user) { + return res.status(400).send({ error: info }); + } + return res.send('Done'); + })(req, res, next); + }); + app.post('/api/signup', (req, res, next) => { + passport.authenticate('local-signup', (err, user, info) => { + if (err) { + return res.status(500).send({ error: 'Internal Server Error' }); + } + if (!user) { + return res.status(400).send({ error: info }); + } + return res.send('Done'); + })(req, res, next); + }); }; diff --git a/server/routes/usersRoutes.js b/server/routes/usersRoutes.js index adef7b5..75e804b 100644 --- a/server/routes/usersRoutes.js +++ b/server/routes/usersRoutes.js @@ -24,8 +24,8 @@ module.exports = app => { app.post('/api/update_user', requireLogin, (req, res) => { const { currentUser, values } = req.body; const { profile } = currentUser; - User.findOne({ _id: currentUser._id }) - .then(user => user.update({ + User.findOne({ _id: currentUser._id }).then(user => + user.update({ profile: { userName: values.userName || profile.userName, img: values.img || profile.img, @@ -51,7 +51,8 @@ module.exports = app => { lastName: values.lastName || currentUser.lastName, email: values.email || currentUser.email, gender: values.gender || currentUser.gender, - })); + }) + ); res.send(res.json()); }); }; diff --git a/server/server.js b/server/server.js index 3f5005c..bf5f4e5 100644 --- a/server/server.js +++ b/server/server.js @@ -22,7 +22,7 @@ app.use( cookieSession({ maxAge: 30 * 24 * 60 * 60 * 1000, keys: [keys.cookieKey], - }), + }) ); app.use(passport.initialize()); diff --git a/server/services/passport.js b/server/services/passport.js index f488336..d9d8cb4 100644 --- a/server/services/passport.js +++ b/server/services/passport.js @@ -43,52 +43,59 @@ passport.use( ); */ - -passport.use('local-signup', new LocalStrategy( - { - usernameField: 'email', - passwordField: 'password', - passReqToCallback: true, - }, async (req, email, password, done) => { - const { userName, firstName, lastName } = req.body; - try { - const user = await User.findOne({ email }); - if (user) return done(null, false, 'This emailId is already taken.'); - } catch (e) { - return done(e); - } - try { - const newUser = await new User({ - email, - password: bcrypt.hashSync(password, 10), - userName, - firstName, - lastName, - }).save(); - return done(null, newUser); - } catch (e) { - return done(e); +passport.use( + 'local-signup', + new LocalStrategy( + { + usernameField: 'email', + passwordField: 'password', + passReqToCallback: true, + }, + async (req, email, password, done) => { + const { userName, firstName, lastName } = req.body; + try { + const user = await User.findOne({ email }); + if (user) return done(null, false, 'This emailId is already taken.'); + } catch (e) { + return done(e); + } + try { + const newUser = await new User({ + email, + password: bcrypt.hashSync(password, 10), + userName, + firstName, + lastName, + }).save(); + return done(null, newUser); + } catch (e) { + return done(e); + } } - }, -)); + ) +); -passport.use('local-login', new LocalStrategy( - { - usernameField: 'email', - passwordField: 'password', - passReqToCallback: true, - }, async (req, email, password, done) => { - try { - const user = await User.findOne({ email }); - if (!user) { - return done(null, false, 'Invalid Username'); - } - if (!bcrypt.compareSync(password, user.password)) { - return done(null, false, 'Wrong Password'); +passport.use( + 'local-login', + new LocalStrategy( + { + usernameField: 'email', + passwordField: 'password', + passReqToCallback: true, + }, + async (req, email, password, done) => { + try { + const user = await User.findOne({ email }); + if (!user) { + return done(null, false, 'Invalid Username'); + } + if (!bcrypt.compareSync(password, user.password)) { + return done(null, false, 'Wrong Password'); + } + return done(null, user); + } catch (e) { + return done(e); } - return done(null, user); - } catch (e) { - return done(e); } - }, -)); + ) +); From 4c2e792c63ff8f925ef4a7f96e842325ea9b3b20 Mon Sep 17 00:00:00 2001 From: Jacob Adlers Date: Tue, 11 Sep 2018 23:08:47 +0200 Subject: [PATCH 15/58] Disable warning for server startup console.log --- server/server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/server.js b/server/server.js index bf5f4e5..c271037 100644 --- a/server/server.js +++ b/server/server.js @@ -35,4 +35,5 @@ require('./routes/usersRoutes.js')(app); require('./routes/postsRoutes.js')(app); require('./routes/messageRoutes.js')(app); +// eslint-disable-next-line no-console app.listen(PORT, console.log(`Listening on ${PORT}!`)); From 2316afdc32eb7bdf89505df903b6850af001578e Mon Sep 17 00:00:00 2001 From: Jacob Adlers Date: Tue, 11 Sep 2018 23:33:01 +0200 Subject: [PATCH 16/58] Add max-len rule set to 100 Should be enforced according to the airbnb styleguide: https://github.com/airbnb/javascript#whitespace--max-len --- .eslintrc.json | 5 +++++ .prettierrc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2aabdec..10a69cc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -40,6 +40,11 @@ "jsx-quotes": "off", "key-spacing": "off", "keyword-spacing": "off", + "max-len": ["error", { + "code": 100, + "ignoreUrls": true, + "ignoreStrings": true + }], "new-parens": "off", "newline-per-chained-call": "off", "no-confusing-arrow": ["error", {"allowParens": true}], diff --git a/.prettierrc b/.prettierrc index c6a1376..4cc6aa6 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,5 @@ { "trailingComma": "es5", - "singleQuote": true + "singleQuote": true, + "printWidth": 100 } From 66f3e5b0a55494f6752fa009329cef32897388a8 Mon Sep 17 00:00:00 2001 From: Jacob Adlers Date: Tue, 11 Sep 2018 23:33:56 +0200 Subject: [PATCH 17/58] Run `prettier --write` on entire code-base --- client/src/actions/index.js | 6 +--- client/src/assets/spinners.js | 15 ++------ .../Dashboard/DashboardView/TextInput.js | 5 +-- client/src/components/Dashboard/Find/Card.js | 21 ++--------- .../components/Dashboard/Find/CardContact.js | 14 ++------ .../Dashboard/Messages/MessageReply.js | 6 +--- .../components/Dashboard/Messages/Messages.js | 17 ++------- .../Dashboard/Profile/ProfileInfo.js | 28 +++------------ .../components/Dashboard/Profile/formInfo.js | 12 +------ .../Dashboard/SidePane/Header/index.js | 6 +--- .../Dashboard/SidePane/Menu/menuBtns.js | 7 +--- .../Dashboard/styled_components/Title.js | 3 +- .../src/components/LandingPage/Form/index.js | 5 +-- .../components/LandingPage/Form/inputField.js | 3 +- .../components/LandingPage/Header/index.js | 4 +-- .../src/components/LandingPage/Info/index.js | 7 ++-- .../LandingPage/Preview/previewData.js | 3 +- client/src/data/dashboard_data.js | 12 ++----- client/src/fake_backend/messages.js | 3 +- client/src/fake_backend/posts.js | 3 +- client/src/fake_backend/users.js | 36 +++++-------------- client/src/index.js | 5 +-- client/src/reducers/auth.js | 7 +--- client/src/registerServiceWorker.js | 8 ++--- server/routes/authRoutes.js | 6 ++-- 25 files changed, 48 insertions(+), 194 deletions(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 4ece531..655263f 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -1,9 +1,5 @@ import axios from 'axios'; -import { - FETCH_USER, - FETCH_POSTS, - FETCH_MESSAGES, -} from '../constants/actionTypes'; +import { FETCH_USER, FETCH_POSTS, FETCH_MESSAGES } from '../constants/actionTypes'; // import { POSTS } from '../fake_backend/posts'; // import { CURRENT_USER } from '../fake_backend/users'; // import { MESSAGES } from '../fake_backend/messages'; diff --git a/client/src/assets/spinners.js b/client/src/assets/spinners.js index ea2f9f9..eae40e7 100644 --- a/client/src/assets/spinners.js +++ b/client/src/assets/spinners.js @@ -2,13 +2,7 @@ import React from 'react'; export const Spinner = () => (
- + ( export const Success = () => (
- + diff --git a/client/src/components/Dashboard/DashboardView/TextInput.js b/client/src/components/Dashboard/DashboardView/TextInput.js index fab1578..821add8 100644 --- a/client/src/components/Dashboard/DashboardView/TextInput.js +++ b/client/src/components/Dashboard/DashboardView/TextInput.js @@ -14,10 +14,7 @@ class TextInput extends Component { const { body, onPostChange } = this.props; return (
-
+
diff --git a/client/src/components/Dashboard/Find/Card.js b/client/src/components/Dashboard/Find/Card.js index 17d30a7..941ff27 100644 --- a/client/src/components/Dashboard/Find/Card.js +++ b/client/src/components/Dashboard/Find/Card.js @@ -58,14 +58,7 @@ class Card extends Component { const { user, i } = this.props; const { active } = this.state; return ( - +
{user.firstName}
@@ -76,16 +69,8 @@ class Card extends Component {
- - + +
{active === 'about' ? ( diff --git a/client/src/components/Dashboard/Find/CardContact.js b/client/src/components/Dashboard/Find/CardContact.js index c98c82b..ee2102e 100644 --- a/client/src/components/Dashboard/Find/CardContact.js +++ b/client/src/components/Dashboard/Find/CardContact.js @@ -1,19 +1,9 @@ import React from 'react'; import { reduxForm, Field } from 'redux-form'; import PropTypes from 'prop-types'; -import { - ProfileIcon, - MessagesIcon, - LinkedinIcon, - GithubIcon, -} from '../../../assets/icons'; +import { ProfileIcon, MessagesIcon, LinkedinIcon, GithubIcon } from '../../../assets/icons'; -const Icons = [ - , - , - , - , -]; +const Icons = [, , , ]; const ContactForm = ({ handleSubmit }) => (
diff --git a/client/src/components/Dashboard/Messages/MessageReply.js b/client/src/components/Dashboard/Messages/MessageReply.js index 71cdd71..3f3a8f0 100644 --- a/client/src/components/Dashboard/Messages/MessageReply.js +++ b/client/src/components/Dashboard/Messages/MessageReply.js @@ -29,11 +29,7 @@ const MessageReply = ({ messages, activeMessage, handleSubmit }) => { export const MessageReplyInput = ({ handleSubmit }) => ( {({ activeMessage, messages }) => ( - + )} ); diff --git a/client/src/components/Dashboard/Messages/Messages.js b/client/src/components/Dashboard/Messages/Messages.js index cb040f4..4f87475 100644 --- a/client/src/components/Dashboard/Messages/Messages.js +++ b/client/src/components/Dashboard/Messages/Messages.js @@ -23,10 +23,7 @@ export const MessageConsumer = props => ( // https://github.com/eslint/eslint/issues/9259 // eslint-disable-next-line const Message = ({ msg, toggle, i, activeMessage }) => ( -
toggle(i)} - className={`message active-${i === activeMessage}`} - > +
toggle(i)} className={`message active-${i === activeMessage}`}>
@@ -42,10 +39,7 @@ const Message = ({ msg, toggle, i, activeMessage }) => ( const NoMessagesInfo = () => (
-

- You have not yet received any messages. Once you do, they will appear - here! -

+

You have not yet received any messages. Once you do, they will appear here!

); @@ -57,12 +51,7 @@ const MessagesOverview = () => ( ) : ( messages.map((msg, i) => ( - + )) )}
diff --git a/client/src/components/Dashboard/Profile/ProfileInfo.js b/client/src/components/Dashboard/Profile/ProfileInfo.js index 7a2ef5b..97998f9 100644 --- a/client/src/components/Dashboard/Profile/ProfileInfo.js +++ b/client/src/components/Dashboard/Profile/ProfileInfo.js @@ -44,12 +44,7 @@ const ProfileInputField = ({ field, currentUser }) => ( {field}
{field === 'description' ? ( - + ) : field === 'gender' ? ( {selectOpts.map( @@ -62,12 +57,7 @@ const ProfileInputField = ({ field, currentUser }) => ( )} ) : ( - + )}
@@ -79,13 +69,7 @@ const ProfileInputFields = ({ currentUser, profile = false }) => { fields = fields.filter(x => sortInputForms(x)); return fields.map( // eslint-disable-next-line comma-dangle - field => ( - - ) + field => ); }; @@ -109,11 +93,7 @@ const ProfileInfoForm = ({ info, handleSubmit, reqData }) =>
diff --git a/client/src/components/Dashboard/Profile/formInfo.js b/client/src/components/Dashboard/Profile/formInfo.js index e621bc4..588071a 100644 --- a/client/src/components/Dashboard/Profile/formInfo.js +++ b/client/src/components/Dashboard/Profile/formInfo.js @@ -1,13 +1,3 @@ -const USED_LANGUAGES = [ - 'HTML', - 'CSS', - 'JavaScript', - 'Ruby', - 'Java', - 'Python', - 'C', - 'C++', - 'C#', -]; +const USED_LANGUAGES = ['HTML', 'CSS', 'JavaScript', 'Ruby', 'Java', 'Python', 'C', 'C++', 'C#']; export default USED_LANGUAGES; diff --git a/client/src/components/Dashboard/SidePane/Header/index.js b/client/src/components/Dashboard/SidePane/Header/index.js index 90d11f5..b921ad0 100644 --- a/client/src/components/Dashboard/SidePane/Header/index.js +++ b/client/src/components/Dashboard/SidePane/Header/index.js @@ -8,11 +8,7 @@ const DashHeaderContent = ({ currentUser }) =>
- +
); diff --git a/client/src/components/Dashboard/SidePane/Menu/menuBtns.js b/client/src/components/Dashboard/SidePane/Menu/menuBtns.js index 252e1e2..3fb93d0 100644 --- a/client/src/components/Dashboard/SidePane/Menu/menuBtns.js +++ b/client/src/components/Dashboard/SidePane/Menu/menuBtns.js @@ -1,10 +1,5 @@ import React from 'react'; -import { - SearchIcon, - ProfileIcon, - MessagesIcon, - DashboardIcon, -} from '../../../../assets/icons'; +import { SearchIcon, ProfileIcon, MessagesIcon, DashboardIcon } from '../../../../assets/icons'; const MENU_CONTENTS = [ { name: 'Dashboard', icon: }, diff --git a/client/src/components/Dashboard/styled_components/Title.js b/client/src/components/Dashboard/styled_components/Title.js index 72ab9a2..876eb47 100644 --- a/client/src/components/Dashboard/styled_components/Title.js +++ b/client/src/components/Dashboard/styled_components/Title.js @@ -2,8 +2,7 @@ import styled from 'styled-components'; const Title = styled.span` - font-family: ${props => - props.title ? 'Roboto' : 'Source Sans Pro'};, sans-serif; + font-family: ${props => (props.title ? 'Roboto' : 'Source Sans Pro')};, sans-serif; font-size: ${props => (props.title ? '25px' : '14px')}; font-weight: lighter; color: rgba(255, 255, 255, 0.8); diff --git a/client/src/components/LandingPage/Form/index.js b/client/src/components/LandingPage/Form/index.js index b22c872..c852cfd 100644 --- a/client/src/components/LandingPage/Form/index.js +++ b/client/src/components/LandingPage/Form/index.js @@ -36,10 +36,7 @@ class AuthForm extends Component { return (
- +
diff --git a/client/src/components/LandingPage/Form/inputField.js b/client/src/components/LandingPage/Form/inputField.js index 9f98516..3252354 100644 --- a/client/src/components/LandingPage/Form/inputField.js +++ b/client/src/components/LandingPage/Form/inputField.js @@ -29,8 +29,7 @@ class InputFields extends Component { type={field.type} component="input" placeholder={field.placeholder} - className={`input-${fieldInfo.class}-${index + - 1} animate-${animate}`} + className={`input-${fieldInfo.class}-${index + 1} animate-${animate}`} /> ))} diff --git a/client/src/components/LandingPage/Header/index.js b/client/src/components/LandingPage/Header/index.js index 9710d55..7401706 100644 --- a/client/src/components/LandingPage/Header/index.js +++ b/client/src/components/LandingPage/Header/index.js @@ -35,9 +35,7 @@ class Header extends Component { updateWindowDimensions = () => { const width = - window.innerWidth || - document.documentElement.clientWidth || - document.body.clientWidth; + window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; this.setState({ width }); }; diff --git a/client/src/components/LandingPage/Info/index.js b/client/src/components/LandingPage/Info/index.js index b286258..af21c4e 100644 --- a/client/src/components/LandingPage/Info/index.js +++ b/client/src/components/LandingPage/Info/index.js @@ -3,10 +3,9 @@ import React from 'react'; const Info = () => (
- CodeBuddy is the best way to help you hone your coding skills and make new - friends. CodeBuddy is an amazing way to get real experience on projects - you're passionate about working in technology you already know or - want to learn. + CodeBuddy is the best way to help you hone your coding skills and make new friends. CodeBuddy + is an amazing way to get real experience on projects you're passionate about working in + technology you already know or want to learn.
diff --git a/client/src/components/LandingPage/Preview/previewData.js b/client/src/components/LandingPage/Preview/previewData.js index d8fb2ef..ce7cdcb 100644 --- a/client/src/components/LandingPage/Preview/previewData.js +++ b/client/src/components/LandingPage/Preview/previewData.js @@ -16,8 +16,7 @@ const PREVIEW_DATA = [ { img: fakepic3, title: 'Create a Team', - subtitle: - 'Work together with people who have the right skill set, and start your own team.', + subtitle: 'Work together with people who have the right skill set, and start your own team.', }, ]; diff --git a/client/src/data/dashboard_data.js b/client/src/data/dashboard_data.js index acb8fa2..80dd074 100644 --- a/client/src/data/dashboard_data.js +++ b/client/src/data/dashboard_data.js @@ -1,9 +1,5 @@ import React from 'react'; -import { - ConnectRequestIcon, - ProfileViewIcon, - MessagesIcon, -} from '../assets/icons'; +import { ConnectRequestIcon, ProfileViewIcon, MessagesIcon } from '../assets/icons'; export const BOX_INFO = [ { value: 931, name: 'Profile Views', icon: }, @@ -63,8 +59,7 @@ export const MESSAGES_DATA = [ { author: 'John Doe', imgURL: 'https://randomuser.me/api/portraits/men/33.jpg', - message: - 'Working on a great new project! Does anyone have experience with GraphQL?', + message: 'Working on a great new project! Does anyone have experience with GraphQL?', publishTime: '6m', }, { @@ -88,8 +83,7 @@ export const MESSAGES_DATA = [ { author: 'John Doe', imgURL: 'https://randomuser.me/api/portraits/men/33.jpg', - message: - 'Working on a great new project! Does anyone have experience with GraphQL?', + message: 'Working on a great new project! Does anyone have experience with GraphQL?', publishTime: '19m', }, { diff --git a/client/src/fake_backend/messages.js b/client/src/fake_backend/messages.js index ff6bc3c..7dae99a 100644 --- a/client/src/fake_backend/messages.js +++ b/client/src/fake_backend/messages.js @@ -49,8 +49,7 @@ const MESSAGES = [ img: 'https://randomuser.me/api/portraits/women/28.jpg', date: { $date: '2018-06-03T19:51:52.578Z' }, }, - body: - 'Do you need help with any backend implementation? If so, let me know!', + body: 'Do you need help with any backend implementation? If so, let me know!', __v: 0, }, ]; diff --git a/client/src/fake_backend/posts.js b/client/src/fake_backend/posts.js index 3b78a63..b904f61 100644 --- a/client/src/fake_backend/posts.js +++ b/client/src/fake_backend/posts.js @@ -54,8 +54,7 @@ const POSTS = [ { post: { title: 'hoi', - body: - 'Does anyone know a good UI/UX designer who could help out with svg animation?', + body: 'Does anyone know a good UI/UX designer who could help out with svg animation?', date: { $date: '2018-06-01T11:24:44.603Z', }, diff --git a/client/src/fake_backend/users.js b/client/src/fake_backend/users.js index 8be371f..3410b9e 100644 --- a/client/src/fake_backend/users.js +++ b/client/src/fake_backend/users.js @@ -2,8 +2,7 @@ export const CURRENT_USER = [ { profile: { userName: 'lydiahallie', - img: - 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', + img: 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', title: 'JavaScript Developer', skills: [ { lang: 'JavaScript', value: 95 }, @@ -24,8 +23,7 @@ export const ALL_USERS = [ { profile: { userName: 'lydiahallie', - img: - 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', + img: 'https://pbs.twimg.com/profile_images/933660989802807296/maudzPZE_400x400.jpg', title: 'JavaScript Developer', skills: [ { lang: 'JavaScript', value: 95 }, @@ -45,11 +43,7 @@ export const ALL_USERS = [ userName: 'johndoe', img: 'https://randomuser.me/api/portraits/men/33.jpg', title: 'Backend Developer', - skills: [ - { lang: 'Java', value: 90 }, - { lang: 'Ruby', value: 80 }, - { lang: 'C', value: 60 }, - ], + skills: [{ lang: 'Java', value: 90 }, { lang: 'Ruby', value: 80 }, { lang: 'C', value: 60 }], level: 'Advanced', description: 'I love everything about backend', }, @@ -97,11 +91,7 @@ export const ALL_USERS = [ userName: 'eulatliam', img: 'https://randomuser.me/api/portraits/women/61.jpg', title: 'Security Engineer', - skills: [ - { lang: 'Python', value: 95 }, - { lang: 'C', value: 90 }, - { lang: 'C++', value: 80 }, - ], + skills: [{ lang: 'Python', value: 95 }, { lang: 'C', value: 90 }, { lang: 'C++', value: 80 }], level: 'Advanced', description: 'I have a lot of experience in application security.', }, @@ -120,8 +110,7 @@ export const ALL_USERS = [ { lang: 'Sass', value: 90 }, ], level: 'Advanced', - description: - 'I am an art school graduate who has designed websites for tech giants.', + description: 'I am an art school graduate who has designed websites for tech giants.', }, firstName: 'Sara', lastName: 'Wade', @@ -156,8 +145,7 @@ export const ALL_USERS = [ { lang: 'Haskell', value: 80 }, ], level: 'Advanced', - description: - 'I am a computer programmer who has worked a lot with game developement.', + description: 'I am a computer programmer who has worked a lot with game developement.', }, firstName: 'Hubert', lastName: 'Beran', @@ -226,8 +214,7 @@ export const ALL_USERS = [ { lang: 'Python', value: 80 }, ], level: 'Advanced', - description: - 'I am a backend engineer who works on 2D games in my free time!', + description: 'I am a backend engineer who works on 2D games in my free time!', }, firstName: 'Rosalina', lastName: 'Holub', @@ -238,11 +225,7 @@ export const ALL_USERS = [ userName: 'matirtza', img: 'https://randomuser.me/api/portraits/women/77.jpg', title: 'Software Engineer', - skills: [ - { lang: 'C++', value: 80 }, - { lang: 'C#', value: 80 }, - { lang: 'C', value: 70 }, - ], + skills: [{ lang: 'C++', value: 80 }, { lang: 'C#', value: 80 }, { lang: 'C', value: 70 }], level: 'Advanced', description: "I'm an amateur embedded software engineer.", }, @@ -279,8 +262,7 @@ export const ALL_USERS = [ { lang: 'Ruby', value: 80 }, ], level: 'Advanced', - description: - "I'm a front end developer who is always coding in his freetime!", + description: "I'm a front end developer who is always coding in his freetime!", }, firstName: 'Merav', lastName: 'Kuiper', diff --git a/client/src/index.js b/client/src/index.js index 9efdb23..a99d735 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -13,10 +13,7 @@ import Dashboard from './containers/Dashboard'; import './styles/main.sass'; -const store = createStore( - reducers, - composeWithDevTools(applyMiddleware(thunk)) -); +const store = createStore(reducers, composeWithDevTools(applyMiddleware(thunk))); export default store; diff --git a/client/src/reducers/auth.js b/client/src/reducers/auth.js index 1b3bd2b..e612e72 100644 --- a/client/src/reducers/auth.js +++ b/client/src/reducers/auth.js @@ -1,11 +1,6 @@ /* eslint-disable */ -import { - LOGIN, - REGISTER, - LOGOUT, - FETCH_USER, -} from '../constants/actionTypes.js'; +import { LOGIN, REGISTER, LOGOUT, FETCH_USER } from '../constants/actionTypes.js'; export const authReducer = (state = {}, action) => { console.log('payload', action.payload); diff --git a/client/src/registerServiceWorker.js b/client/src/registerServiceWorker.js index ab54470..a73bf90 100644 --- a/client/src/registerServiceWorker.js +++ b/client/src/registerServiceWorker.js @@ -15,9 +15,7 @@ const isLocalhost = Boolean( // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) + window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) ); export default function register() { @@ -104,9 +102,7 @@ function checkValidServiceWorker(swUrl) { } }) .catch(() => { - console.log( - 'No internet connection found. App is running in offline mode.' - ); + console.log('No internet connection found. App is running in offline mode.'); }); } diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index 02b315c..94baa39 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -8,10 +8,8 @@ module.exports = app => { }) ); - app.get( - '/auth/google/callback', - passport.authenticate('google'), - (req, res) => res.redirect('/dashboard') + app.get('/auth/google/callback', passport.authenticate('google'), (req, res) => + res.redirect('/dashboard') ); app.get('/api/logout', (req, res) => { From 0b1eca21809f41da876e0cf7f33c9c7ddc6c0793 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat Date: Wed, 12 Sep 2018 12:24:16 +0530 Subject: [PATCH 18/58] req.user set using a custom callback for authentication in passportjs --- server/routes/authRoutes.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index 17c3fa3..ee32211 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -29,7 +29,12 @@ module.exports = app => { if (!user) { return res.status(400).send({ error: info }); } - return res.send('Done'); + return req.logIn(user, error => { + if (err) { + return res.status(500).send({ error }); + } + return res.send('Done'); + }); })(req, res, next); } ); @@ -43,7 +48,12 @@ module.exports = app => { if (!user) { return res.status(400).send({ error: info }); } - return res.send('Done'); + return req.logIn(user, error => { + if (err) { + return res.status(500).send({ error }); + } + return res.send('Done'); + }); })(req, res, next); } ); From 6693ffe8bf8bcf715180568f733b0c200f99de5e Mon Sep 17 00:00:00 2001 From: Mary Mazi Date: Tue, 11 Sep 2018 12:30:08 +0100 Subject: [PATCH 19/58] modify the redux flow for signup and login --- client/src/actions/index.js | 12 +++++++- .../src/components/LandingPage/Form/index.js | 28 +++++++++++++------ client/src/constants/actionTypes.js | 1 + client/src/reducers/auth.js | 20 +++++++------ client/src/reducers/index.js | 2 +- 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 655263f..fe09a2d 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -1,5 +1,10 @@ import axios from 'axios'; -import { FETCH_USER, FETCH_POSTS, FETCH_MESSAGES } from '../constants/actionTypes'; +import { + AUTH_USER, + FETCH_USER, + FETCH_POSTS, + FETCH_MESSAGES, +} from '../constants/actionTypes'; // import { POSTS } from '../fake_backend/posts'; // import { CURRENT_USER } from '../fake_backend/users'; // import { MESSAGES } from '../fake_backend/messages'; @@ -18,6 +23,11 @@ import { FETCH_USER, FETCH_POSTS, FETCH_MESSAGES } from '../constants/actionType // } // Using real backend. +export const authenticateUser = (userauth, values) => async dispatch => { + const res = await axios.post(`/api/${userauth}`, values); + dispatch({ type: AUTH_USER, payload: res.data }); +}; + export const fetchUser = async dispatch => { const res = await axios.get('/api/current_user'); dispatch({ type: FETCH_USER, payload: res.data }); diff --git a/client/src/components/LandingPage/Form/index.js b/client/src/components/LandingPage/Form/index.js index c852cfd..5444c8a 100644 --- a/client/src/components/LandingPage/Form/index.js +++ b/client/src/components/LandingPage/Form/index.js @@ -1,10 +1,11 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ +/* eslint-disable jsx-a11y/anchor-is-valid, no-shadow */ import React, { Component } from 'react'; +import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import axios from 'axios'; import ParticleWrapper from '../Particles'; import Title from '../App/title'; import InputFields from './inputField'; +import { authenticateUser } from '../../../actions'; const ButtonSwipe = ({ activeBtn, changeActiveBtn }) => (
@@ -25,11 +26,15 @@ class AuthForm extends Component { handleSubmit = values => { const { activeBtn } = this.state; + const { authenticateUser } = this.props; const userauth = activeBtn === 'login' ? 'login' : 'signup'; - axios - .post(`/api/${userauth}`, values) - .then(() => this.props.history.push('/dashboard/dashboard')); //eslint-disable-line - }; + + authenticateUser(userauth, values) + .then(() => { + this.props.history.push('/dashboard/dashboard'); //eslint-disable-line + }) + .catch(err => console.log(err.response.data.error)); + } render() { const { activeBtn } = this.state; @@ -46,11 +51,14 @@ class AuthForm extends Component { } } -const Content = ({ history }) => ( +const Content = ({ history, authenticateUser }) => (
- <AuthForm history={history} /> + <AuthForm + history={history} + authenticateUser={authenticateUser} + /> </div> <ParticleWrapper /> </div> @@ -63,10 +71,12 @@ ButtonSwipe.propTypes = { AuthForm.propTypes = { history: PropTypes.object.isRequired, //eslint-disable-line + authenticateUser: PropTypes.func.isRequired, }; Content.propTypes = { history: PropTypes.object.isRequired, //eslint-disable-line + authenticateUser: PropTypes.func.isRequired, }; -export default Content; +export default connect(null, { authenticateUser })(Content); diff --git a/client/src/constants/actionTypes.js b/client/src/constants/actionTypes.js index 692415a..9e0bf0b 100644 --- a/client/src/constants/actionTypes.js +++ b/client/src/constants/actionTypes.js @@ -5,6 +5,7 @@ export const REDIRECT = 'REDIRECT'; export const APP_LOAD = 'APP_LOAD'; export const DASHBOARD_LOADED = 'DASHBOARD_LOADED'; +export const AUTH_USER = 'AUTH_USER'; export const FETCH_USER = 'FETCH_USER'; export const FETCH_MESSAGES = 'FETCH_MESSAGES'; export const FETCH_POSTS = 'FETCH_POSTS'; diff --git a/client/src/reducers/auth.js b/client/src/reducers/auth.js index e612e72..2008514 100644 --- a/client/src/reducers/auth.js +++ b/client/src/reducers/auth.js @@ -1,16 +1,20 @@ -/* eslint-disable */ +import { + AUTH_USER, + LOGOUT, + FETCH_USER, +} from '../constants/actionTypes'; -import { LOGIN, REGISTER, LOGOUT, FETCH_USER } from '../constants/actionTypes.js'; - -export const authReducer = (state = {}, action) => { - console.log('payload', action.payload); +const authReducer = (state = {}, action = {}) => { switch (action.type) { - case LOGIN: + case AUTH_USER: case LOGOUT: - case REGISTER: case FETCH_USER: - return (state.user = action.payload || false); + return { + ...state, ...action.payload, + }; default: return state; } }; + +export default authReducer; diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index 558948e..c757c88 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -1,6 +1,6 @@ import { combineReducers } from 'redux'; import { reducer as formReducer } from 'redux-form'; -import { authReducer } from './auth'; +import authReducer from './auth'; import { postsReducer } from './posts'; import { messagesReducer } from './messages'; From 41fa201dc36ca2944803ec032352e6765a1a4ef5 Mon Sep 17 00:00:00 2001 From: Mary Mazi <mazi.mary.o@gmail.com> Date: Tue, 11 Sep 2018 12:39:34 +0100 Subject: [PATCH 20/58] update response sent to the client after successful signup and login --- server/routes/authRoutes.js | 38 +++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index 71145e5..ea5214f 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -22,35 +22,57 @@ module.exports = app => { (req, res, next) => { passport.authenticate('local-login', (err, user, info) => { if (err) { - return res.status(500).send({ error: 'Internal Server Error' }); + return res.status(500).send({ error: err }); } if (!user) { return res.status(400).send({ error: info }); } + return req.logIn(user, error => { - if (err) { - return res.status(500).send({ error }); + if(error) { + return res.send(500).send({error}); } - return res.send('Done'); + const { + profile, firstName, lastName, _id, email, __v, + } = user; + return res.send({ + profile, + firstName, + lastName, + _id, + email, + __v, + }); }); })(req, res, next); } ); + app.post( '/api/signup', (req, res, next) => { passport.authenticate('local-signup', (err, user, info) => { if (err) { - return res.status(500).send({ error: 'Internal Server Error' }); + return res.status(500).send({ error: err }); } if (!user) { return res.status(400).send({ error: info }); } return req.logIn(user, error => { - if (err) { - return res.status(500).send({ error }); + if(error) { + return res.send(500).send({error}); } - return res.send('Done'); + const { + profile, firstName, lastName, _id, email, __v, + } = user; + return res.send({ + profile, + firstName, + lastName, + _id, + email, + __v, + }); }); })(req, res, next); } From 40410faef3e03e7e19e37b02e3e8a8a3cf71750d Mon Sep 17 00:00:00 2001 From: Mary Mazi <mazi.mary.o@gmail.com> Date: Tue, 11 Sep 2018 12:49:45 +0100 Subject: [PATCH 21/58] fixes on auth form input fields --- client/package.json | 1 + client/src/components/LandingPage/Form/formFields.js | 4 ++-- client/src/components/LandingPage/Form/inputField.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/package.json b/client/package.json index 2fe2ca2..5ed28d1 100644 --- a/client/package.json +++ b/client/package.json @@ -23,6 +23,7 @@ "fs-extra": "3.0.1", "html-webpack-plugin": "2.29.0", "jest": "20.0.4", + "lodash": "^4.17.10", "moment": "^2.22.2", "node-sass": "^4.9.0", "object-assign": "4.1.1", diff --git a/client/src/components/LandingPage/Form/formFields.js b/client/src/components/LandingPage/Form/formFields.js index 17624da..a02bb4d 100644 --- a/client/src/components/LandingPage/Form/formFields.js +++ b/client/src/components/LandingPage/Form/formFields.js @@ -5,8 +5,8 @@ export const LOGIN_FIELDS = [ ]; export const SIGNUP_FIELDS = [ - { type: 'text', placeholder: 'Firstname' }, - { type: 'text', placeholder: 'Lastname' }, + { type: 'text', placeholder: 'First Name' }, + { type: 'text', placeholder: 'Last Name' }, { type: 'text', placeholder: 'Email' }, { type: 'password', placeholder: 'Password' }, ]; diff --git a/client/src/components/LandingPage/Form/inputField.js b/client/src/components/LandingPage/Form/inputField.js index 3252354..a3c2ca6 100644 --- a/client/src/components/LandingPage/Form/inputField.js +++ b/client/src/components/LandingPage/Form/inputField.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import shortid from 'short-id'; import PropTypes from 'prop-types'; +import camelCase from 'lodash/camelCase'; import { reduxForm, Field } from 'redux-form'; import { LOGIN_FIELDS, SIGNUP_FIELDS } from './formFields'; @@ -25,7 +26,7 @@ class InputFields extends Component { {fieldInfo.type.map((field, index) => ( <Field key={shortid.generate()} - name={field.placeholder.toLowerCase()} + name={camelCase(field.placeholder)} type={field.type} component="input" placeholder={field.placeholder} From 7990598c129ded3981f0016a18d2ec3b6623f81a Mon Sep 17 00:00:00 2001 From: Mary Mazi <mazi.mary.o@gmail.com> Date: Tue, 11 Sep 2018 14:33:03 +0100 Subject: [PATCH 22/58] fix state mutation in messages and posts reducers --- client/src/reducers/index.js | 4 ++-- client/src/reducers/messages.js | 13 +++++++------ client/src/reducers/posts.js | 12 +++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index c757c88..091099c 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -1,8 +1,8 @@ import { combineReducers } from 'redux'; import { reducer as formReducer } from 'redux-form'; import authReducer from './auth'; -import { postsReducer } from './posts'; -import { messagesReducer } from './messages'; +import postsReducer from './posts'; +import messagesReducer from './messages'; export default combineReducers({ user: authReducer, diff --git a/client/src/reducers/messages.js b/client/src/reducers/messages.js index b5147d9..4f1ea7c 100644 --- a/client/src/reducers/messages.js +++ b/client/src/reducers/messages.js @@ -1,21 +1,22 @@ -/* eslint-disable */ - import { EXPAND_MESSAGE, FETCH_MESSAGES, SEND_MESSAGE, DELETE_MESSAGE, -} from '../constants/actionTypes.js'; +} from '../constants/actionTypes'; -export const messagesReducer = (state = [], action) => { +const messagesReducer = (state = [], action = {}) => { switch (action.type) { case EXPAND_MESSAGE: case SEND_MESSAGE: case DELETE_MESSAGE: case FETCH_MESSAGES: - console.log('yepppp definitely messages!!!', action.payload); - return (state.messages = action.payload || false); + return [ + ...state, ...action.payload, + ]; default: return state; } }; + +export default messagesReducer; diff --git a/client/src/reducers/posts.js b/client/src/reducers/posts.js index 66d3029..7c205c1 100644 --- a/client/src/reducers/posts.js +++ b/client/src/reducers/posts.js @@ -1,12 +1,14 @@ -/* eslint-disable */ +import { FETCH_POSTS } from '../constants/actionTypes'; -import { FETCH_POSTS } from '../constants/actionTypes.js'; - -export const postsReducer = (state = {}, action) => { +const postsReducer = (state = {}, action = {}) => { switch (action.type) { case FETCH_POSTS: - return (state.posts = action.payload || false); + return { + ...state, ...action.payload, + }; default: return state; } }; + +export default postsReducer; From 424eebaff954cbb409ca94f9382f8d31d97d8c68 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat <satyadeep.roat@gmail.com> Date: Thu, 13 Sep 2018 18:16:23 +0530 Subject: [PATCH 23/58] GraphQL schema and mutation for login and signup --- server/package.json | 2 + server/routes/authRoutes.js | 67 +++++++++++++--------------- server/schema/mutations.js | 46 +++++++++++++++++++ server/schema/schema.js | 10 +++++ server/schema/types/rootQueryType.js | 18 ++++++++ server/schema/types/userType.js | 14 ++++++ server/server.js | 12 ++--- 7 files changed, 128 insertions(+), 41 deletions(-) create mode 100644 server/schema/mutations.js create mode 100644 server/schema/schema.js create mode 100644 server/schema/types/rootQueryType.js create mode 100644 server/schema/types/userType.js diff --git a/server/package.json b/server/package.json index e1c056f..a699b5c 100644 --- a/server/package.json +++ b/server/package.json @@ -4,6 +4,8 @@ "body-parser": "1.18.2", "cookie-session": "^2.0.0-beta.3", "express": "^4.16.3", + "express-graphql": "^0.6.12", + "graphql": "^14.0.2", "mongoose": "^5.1.4", "nodemon": "^1.17.5", "passport": "^0.4.0", diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index 71145e5..0c04a7e 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -1,5 +1,6 @@ const passport = require('passport'); +/* module.exports = app => { app.get( '/auth/google', @@ -16,43 +17,39 @@ module.exports = app => { req.logOut(); res.redirect('/'); }); +*/ - app.post( - '/api/login', - (req, res, next) => { - passport.authenticate('local-login', (err, user, info) => { +const login = ({email, password, req}) => ( + new Promise((resolve, reject) => { + passport.authenticate('local-login', (err, user, info) => { + if (!user) { + reject(info); + } + return req.logIn(user, error => { if (err) { - return res.status(500).send({ error: 'Internal Server Error' }); + return reject(error); } - if (!user) { - return res.status(400).send({ error: info }); - } - return req.logIn(user, error => { - if (err) { - return res.status(500).send({ error }); - } - return res.send('Done'); - }); - })(req, res, next); - } - ); - app.post( - '/api/signup', - (req, res, next) => { - passport.authenticate('local-signup', (err, user, info) => { + return resolve(user); + }); + })({body: {email, password}}); + }) +); + + +const signup = ({firstName, lastName, email, password, req}) => ( + new Promise((resolve, reject) => { + passport.authenticate('local-signup', (err, user, info) => { + if (!user) { + reject(info); + } + return req.logIn(user, error => { if (err) { - return res.status(500).send({ error: 'Internal Server Error' }); + return reject(error); } - if (!user) { - return res.status(400).send({ error: info }); - } - return req.logIn(user, error => { - if (err) { - return res.status(500).send({ error }); - } - return res.send('Done'); - }); - })(req, res, next); - } - ); -}; + return resolve(user); + }); + })({body: {firstName, lastName, email, password}}); + }) +); + +module.exports = {login, signup}; diff --git a/server/schema/mutations.js b/server/schema/mutations.js new file mode 100644 index 0000000..0d2d10d --- /dev/null +++ b/server/schema/mutations.js @@ -0,0 +1,46 @@ +const graphql = require('graphql'); + +const { GraphQLObjectType, GraphQLString } = graphql; + +const UserType = require('./types/userType'); +const AuthService = require('../routes/authRoutes'); + +const mutation = new GraphQLObjectType({ + name: 'Mutation', + fields: { + login: { + type: UserType, + args: { + email: { type: GraphQLString }, + password: { type: GraphQLString }, + }, + resolve(parentValue, { email, password }, req) { + return AuthService.login({ email, password, req}); + }, + }, + + logout: { + type: UserType, + resolve(parentValue, args, req) { + const { user } = req; + req.logout(); + return user; + }, + }, + + signup: { + type: UserType, + args: { + email: { type: GraphQLString }, + password: { type: GraphQLString }, + firstName: { type: GraphQLString }, + lastName: { type: GraphQLString }, + }, + resolve(parentValue, { firstName, lastName, email, password }, req) { + return AuthService.signup({ firstName, lastName, email, password, req }); + }, + }, + }, +}); + +module.exports = mutation; diff --git a/server/schema/schema.js b/server/schema/schema.js new file mode 100644 index 0000000..a9fde3a --- /dev/null +++ b/server/schema/schema.js @@ -0,0 +1,10 @@ +const graphql = require('graphql'); + +const { GraphQLSchema } = graphql; +const RootQueryType = require('./types/rootQueryType'); +const mutation = require('./mutations'); + +module.exports = new GraphQLSchema({ + query: RootQueryType, + mutation, +}); diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js new file mode 100644 index 0000000..a40aab4 --- /dev/null +++ b/server/schema/types/rootQueryType.js @@ -0,0 +1,18 @@ +const graphql = require('graphql'); + +const { GraphQLObjectType } = graphql; +const UserType = require('./userType'); + +const RootQueryType = new GraphQLObjectType({ + name: 'RootQueryType', + fields: { + user: { + type: UserType, + resolve(parentValue, args, req) { + return req.user; + }, + }, + }, +}); + +module.exports = RootQueryType; diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js new file mode 100644 index 0000000..e19d734 --- /dev/null +++ b/server/schema/types/userType.js @@ -0,0 +1,14 @@ +const graphql = require('graphql'); + +const { GraphQLObjectType, GraphQLString } = graphql; + +const UserType = new GraphQLObjectType({ + name: 'UserType', + fields: { + email: { type: GraphQLString }, + firstName: { type: GraphQLString }, + lastNaem: { type: GraphQLString }, + }, +}); + +module.exports = UserType; diff --git a/server/server.js b/server/server.js index c271037..12425b8 100644 --- a/server/server.js +++ b/server/server.js @@ -2,10 +2,12 @@ const express = require('express'); const mongoose = require('mongoose'); const passport = require('passport'); const cookieSession = require('cookie-session'); +const graphqlHTTP = require('express-graphql'); const app = express(); const bodyParser = require('body-parser'); const keys = require('./config/keys'); +const schema = require('./schema/schema'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); @@ -27,13 +29,11 @@ app.use( app.use(passport.initialize()); app.use(passport.session()); +app.use('/graphql', graphqlHTTP({ + schema, + graphiql: true, +})) const PORT = process.env.PORT || 5000; -require('./routes/authRoutes.js')(app); -require('./routes/usersRoutes.js')(app); -require('./routes/postsRoutes.js')(app); -require('./routes/messageRoutes.js')(app); - -// eslint-disable-next-line no-console app.listen(PORT, console.log(`Listening on ${PORT}!`)); From 833bc261d0ea3d8bc879aef9e56819907523eef0 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat <satyadeep.roat@gmail.com> Date: Fri, 14 Sep 2018 15:48:03 +0530 Subject: [PATCH 24/58] Rough Migration of all apis to graphql --- server/routes/authRoutes.js | 24 +++-------- server/routes/messageRoutes.js | 41 +++++++++--------- server/routes/postsRoutes.js | 62 +++++++++++++++++----------- server/routes/usersRoutes.js | 57 ++++++++++++++----------- server/schema/mutations.js | 51 ++++++++++++++++++++--- server/schema/types/messageType.js | 23 +++++++++++ server/schema/types/postType.js | 19 +++++++++ server/schema/types/rootQueryType.js | 25 ++++++++++- server/schema/types/userType.js | 28 ++++++++++++- server/server.js | 16 +++---- 10 files changed, 245 insertions(+), 101 deletions(-) create mode 100644 server/schema/types/messageType.js create mode 100644 server/schema/types/postType.js diff --git a/server/routes/authRoutes.js b/server/routes/authRoutes.js index 0c04a7e..e0cdf58 100644 --- a/server/routes/authRoutes.js +++ b/server/routes/authRoutes.js @@ -1,23 +1,11 @@ const passport = require('passport'); -/* -module.exports = app => { - app.get( - '/auth/google', - passport.authenticate('google', { - scope: ['profile', 'email'], - }) - ); - - app.get('/auth/google/callback', passport.authenticate('google'), (req, res) => - res.redirect('/dashboard') - ); - - app.get('/api/logout', (req, res) => { +const logout = ({ req }) => ( + new Promise(resolve => { req.logOut(); - res.redirect('/'); - }); -*/ + resolve(); + }) +) const login = ({email, password, req}) => ( new Promise((resolve, reject) => { @@ -52,4 +40,4 @@ const signup = ({firstName, lastName, email, password, req}) => ( }) ); -module.exports = {login, signup}; +module.exports = {login, signup, logout}; diff --git a/server/routes/messageRoutes.js b/server/routes/messageRoutes.js index 1cfe1fb..d589f4a 100644 --- a/server/routes/messageRoutes.js +++ b/server/routes/messageRoutes.js @@ -1,28 +1,30 @@ const mongoose = require('mongoose'); -const requireLogin = require('../middlewares/requireLogin'); const Message = mongoose.model('messages'); const User = mongoose.model('users'); -module.exports = app => { - app.get('/api/messages', requireLogin, async (req, res) => { - Message.find({ recipientUserId: req.user._id }, (err, messages) => { +const readMessages = ({req}) => ( + new Promise(async(resolve, reject) => { + try { + const messages = await Message.find({ recipientUserId: req.user._id }); const messageMap = {}; messages.map(message => { messageMap[message._id] = message; - return messageMap; + return messageMap; }); + resolve(messageMap); + } catch(e) { + reject(e); + } + }) +) - res.send(messageMap); - }); - }); - - app.post('/api/add_message', async (req, res) => { - const { values, user, currentUser } = req.body; +const createMessage = ({id, message, req}) => ( + new Promise(async(resolve, reject) => { try { - const author = await User.findOne({ _id: currentUser._id }); - const recipient = await User.findOne({ _id: user._id }); + const author = await User.findOne({ _id: req.user._id }); + const recipient = await User.findOne({ _id: id }); Message.create({ author: { _id: author._id, @@ -31,13 +33,14 @@ module.exports = app => { img: author.profile.img, }, recipient: recipient._id, - body: values.message, + body: message, }); - res.send(); + resolve(); } catch (e) { - /* eslint-disable no-console */ - console.log('Error: ', e); + reject(e); } - }); -}; + }) +) + +module.exports = {readMessages, createMessage}; diff --git a/server/routes/postsRoutes.js b/server/routes/postsRoutes.js index 0bcb9ea..bb71381 100644 --- a/server/routes/postsRoutes.js +++ b/server/routes/postsRoutes.js @@ -1,12 +1,12 @@ const mongoose = require('mongoose'); -const requireLogin = require('../middlewares/requireLogin'); const Post = mongoose.model('posts'); const User = mongoose.model('users'); -module.exports = app => { - app.get('/api/all_posts', requireLogin, (req, res) => { - Post.find({}, (err, posts) => { +const readAllPosts = () => ( + new Promise((resolve, reject) => { + try { + const posts = Post.find({}); const postMap = {}; posts.map(post => { @@ -14,24 +14,38 @@ module.exports = app => { return postMap; }); - res.send(postMap); - }); - }); + resolve(postMap); + } catch (e) { + reject(e); + } + }) +) + +const createPost = ({userId, post}) => ( + new Promise(async(resolve, reject) => { + let user = {}; + try { + user = await User.findOne({ _id: userId }); + } catch(e) { + reject(e); + } + try { + Post.create({ + userId: user.id, + firstName: user.firstName, + lastName: user.lastName, + img: user.profile.img, + post: { + title: post.title, + body: post.body, + }, + }); + resolve(); + } catch(e) { + reject(e); + } + }) +) + +module.exports = {createPost, readAllPosts}; - app.post('/api/all_posts', requireLogin, async (req, res) => { - const user = await User.findOne({ _id: req.body.data.user._id }); - Post.create({ - userId: req.body.data.user._id, - firstName: user.firstName, - lastName: user.lastName, - img: user.profile.img, - post: { - title: req.body.formData.title, - body: req.body.formData.body, - }, - }).then(() => { - // console.log('done'); - res.send(); - }); - }); -}; diff --git a/server/routes/usersRoutes.js b/server/routes/usersRoutes.js index 75e804b..031ded8 100644 --- a/server/routes/usersRoutes.js +++ b/server/routes/usersRoutes.js @@ -1,30 +1,35 @@ const mongoose = require('mongoose'); -const requireLogin = require('../middlewares/requireLogin'); const User = mongoose.model('users'); -module.exports = app => { - app.get('/api/current_user', requireLogin, (req, res) => { - res.send(req.user); - }); +const readCurrentUser = ({req}) => ( + new Promise(resolve => { + resolve(req.user); + }) +) - app.get('/api/all_users', (req, res) => { - User.find({}, (err, users) => { +const readAllUsers = () => ( + new Promise(async(resolve, reject) => { + try { + const users = await User.find({}); const userMap = {}; users.map(user => { userMap[user._id] = user; return userMap; }); + resolve(userMap); + } catch(e) { + reject(e); + } + }) +) - res.send(userMap); - }); - }); - - app.post('/api/update_user', requireLogin, (req, res) => { - const { currentUser, values } = req.body; - const { profile } = currentUser; - User.findOne({ _id: currentUser._id }).then(user => +const updateUser = ({values, req}) => ( + new Promise(async(resolve, reject) => { + try { + const user = User.findOne({ _id: req.user._id }); + const {profile} = user; user.update({ profile: { userName: values.userName || profile.userName, @@ -47,12 +52,16 @@ module.exports = app => { }, ], }, - firstName: values.firstName || currentUser.userName, - lastName: values.lastName || currentUser.lastName, - email: values.email || currentUser.email, - gender: values.gender || currentUser.gender, - }) - ); - res.send(res.json()); - }); -}; + firstName: values.firstName || user.userName, + lastName: values.lastName || user.lastName, + email: values.email || user.email, + gender: values.gender || user.gender, + }); + resolve({}); + } catch(e) { + reject(e); + } + }) +) + +module.exports = {readAllUsers, readCurrentUser, updateUser}; diff --git a/server/schema/mutations.js b/server/schema/mutations.js index 0d2d10d..3929921 100644 --- a/server/schema/mutations.js +++ b/server/schema/mutations.js @@ -3,11 +3,17 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString } = graphql; const UserType = require('./types/userType'); +const MessageType = require('./types/messageType'); +const PostType = require('./types/postType'); const AuthService = require('../routes/authRoutes'); +const MessageService = require('../routes/messageRoutes'); +const PostService = require('../routes/postsRoutes'); +const UserService = require('../routes/usersRoutes'); const mutation = new GraphQLObjectType({ name: 'Mutation', fields: { + login: { type: UserType, args: { @@ -18,16 +24,12 @@ const mutation = new GraphQLObjectType({ return AuthService.login({ email, password, req}); }, }, - logout: { type: UserType, resolve(parentValue, args, req) { - const { user } = req; - req.logout(); - return user; + return AuthService.logout({req}); }, }, - signup: { type: UserType, args: { @@ -40,6 +42,45 @@ const mutation = new GraphQLObjectType({ return AuthService.signup({ firstName, lastName, email, password, req }); }, }, + + updateUser: { + type: UserType, + args: { + email: { type: GraphQLString }, + password: { type: GraphQLString }, + firstName: { type: GraphQLString }, + lastName: { type: GraphQLString }, + gender: { type: GraphQLString }, + }, + resolve(parentValue, { email, gender, firstName, lastName, profile }, req) { + return UserService.updateUser({ email, gender, firstName, lastName, profile, req }); + }, + }, + + createPost: { + type: PostType, + args: { + userId: {type: GraphQLString}, + post: { + title: { type: GraphQLString }, + body: { type: GraphQLString }, + }, + }, + resolve(parentValue, { userId, post }) { + return PostService.createPost({ userId, post }); + }, + }, + + createMessage: { + type: MessageType, + args: { + id: {type: GraphQLString}, + message: {type: GraphQLString}, + }, + resolve(parentValue, { id, message }, req) { + return MessageService.createMessage({ id, message, req }); + }, + }, }, }); diff --git a/server/schema/types/messageType.js b/server/schema/types/messageType.js new file mode 100644 index 0000000..46d292f --- /dev/null +++ b/server/schema/types/messageType.js @@ -0,0 +1,23 @@ +const graphql = require('graphql'); + +const { GraphQLObjectType, GraphQLString } = graphql; + +const AuthorType = new GraphQLObjectType({ + name: 'AuthorType', + fields: { + firstName: {type: GraphQLString}, + lastName: {type: GraphQLString}, + img: {type: GraphQLString}, + }, +}) + +const MessageType = new GraphQLObjectType({ + name: 'MessageType', + fields: { + author: { type: AuthorType}, + recipientUserId: { type: GraphQLString}, + body: {type: GraphQLString}, + }, +}); + +module.exports = {MessageType, AuthorType}; diff --git a/server/schema/types/postType.js b/server/schema/types/postType.js new file mode 100644 index 0000000..f6fa63d --- /dev/null +++ b/server/schema/types/postType.js @@ -0,0 +1,19 @@ +const graphql = require('graphql'); + +const { GraphQLObjectType, GraphQLString } = graphql; + +const PostType = new GraphQLObjectType({ + name: 'PostType', + fields: { + userId: { type: GraphQLString }, + firstName: { type: GraphQLString }, + lastName: { type: GraphQLString }, + img: { type: GraphQLString }, + post: { + title: { type: GraphQLString }, + body: { type: GraphQLString }, + }, + }, +}); + +module.exports = PostType; diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js index a40aab4..6858838 100644 --- a/server/schema/types/rootQueryType.js +++ b/server/schema/types/rootQueryType.js @@ -1,7 +1,12 @@ const graphql = require('graphql'); -const { GraphQLObjectType } = graphql; +const { GraphQLObjectType, GraphQLList } = graphql; const UserType = require('./userType'); +const PostType = require('./postType'); +const MessageType = require('./messageType'); +const UserService = require('../../routes/usersRoutes'); +const MessageService = require('../../routes/messageRoutes'); +const PostService = require('../../routes/postsRoutes'); const RootQueryType = new GraphQLObjectType({ name: 'RootQueryType', @@ -12,6 +17,24 @@ const RootQueryType = new GraphQLObjectType({ return req.user; }, }, + users: { + type: new GraphQLList(UserType), + resolve() { + return UserService.readAllUsers(); + }, + }, + posts: { + type: new GraphQLList(PostType), + resolve(parentValue, args, req) { + return PostService.readAllPosts({ req }); + }, + }, + messages: { + type: new GraphQLList(MessageType), + resolve(parentValue, args, req) { + return MessageService.readMessages({ req }); + }, + }, }, }); diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js index e19d734..d9f22f6 100644 --- a/server/schema/types/userType.js +++ b/server/schema/types/userType.js @@ -1,13 +1,37 @@ const graphql = require('graphql'); -const { GraphQLObjectType, GraphQLString } = graphql; +const { GraphQLObjectType, GraphQLString, GraphQLBoolean } = graphql; +/* +const UserProfileSkillsType = new GraphQLObjectType({ + name: 'UserProfileSkillsType', + fields: { + lang: { type: GraphQLString}, + value: { type: GraphQLString}, + }, +}); + +const UserProfileType = new GraphQLObjectType({ + name: 'UserProfileType', + fields: { + userName: { type: GraphQLString}, + img: { type: GraphQLString}, + title: { type: GraphQLString}, + skills: { type: UserProfileSkillsType }, + level: { type: GraphQLString}, + description: { type: GraphQLString}, + complete: { type: GraphQLBoolean}, + }, +}); +*/ + const UserType = new GraphQLObjectType({ name: 'UserType', fields: { email: { type: GraphQLString }, firstName: { type: GraphQLString }, - lastNaem: { type: GraphQLString }, + lastName: { type: GraphQLString }, + gender: { type: GraphQLString }, }, }); diff --git a/server/server.js b/server/server.js index 12425b8..6f4009f 100644 --- a/server/server.js +++ b/server/server.js @@ -2,22 +2,22 @@ const express = require('express'); const mongoose = require('mongoose'); const passport = require('passport'); const cookieSession = require('cookie-session'); -const graphqlHTTP = require('express-graphql'); +const expressGraphQL = require('express-graphql'); const app = express(); const bodyParser = require('body-parser'); const keys = require('./config/keys'); -const schema = require('./schema/schema'); - -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); require('./models/User'); require('./models/Posts'); require('./models/Message'); - require('./services/passport'); +const schema = require('./schema/schema'); + +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: false })); + mongoose.connect(keys.mongoURI); app.use( @@ -29,10 +29,10 @@ app.use( app.use(passport.initialize()); app.use(passport.session()); -app.use('/graphql', graphqlHTTP({ +app.use('/graphql', expressGraphQL({ schema, graphiql: true, -})) +})); const PORT = process.env.PORT || 5000; From fef0b6d674c9aef74dd0d3f7997b7948a1c09b45 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat <satyadeep.roat@gmail.com> Date: Fri, 14 Sep 2018 17:47:02 +0530 Subject: [PATCH 25/58] all queries are working. mutation still in process --- server/routes/messageRoutes.js | 9 ++---- server/routes/postsRoutes.js | 9 +----- server/routes/usersRoutes.js | 8 +---- server/schema/mutations.js | 9 ++++-- server/schema/types/messageType.js | 2 +- server/schema/types/postType.js | 13 +++++--- server/schema/types/rootQueryType.js | 14 +++++---- server/schema/types/userType.js | 4 +-- server/yarn.lock | 45 +++++++++++++++------------- 9 files changed, 56 insertions(+), 57 deletions(-) diff --git a/server/routes/messageRoutes.js b/server/routes/messageRoutes.js index d589f4a..3667bdb 100644 --- a/server/routes/messageRoutes.js +++ b/server/routes/messageRoutes.js @@ -7,13 +7,8 @@ const readMessages = ({req}) => ( new Promise(async(resolve, reject) => { try { const messages = await Message.find({ recipientUserId: req.user._id }); - const messageMap = {}; - - messages.map(message => { - messageMap[message._id] = message; - return messageMap; - }); - resolve(messageMap); + + resolve(messages); } catch(e) { reject(e); } diff --git a/server/routes/postsRoutes.js b/server/routes/postsRoutes.js index bb71381..c915970 100644 --- a/server/routes/postsRoutes.js +++ b/server/routes/postsRoutes.js @@ -7,14 +7,7 @@ const readAllPosts = () => ( new Promise((resolve, reject) => { try { const posts = Post.find({}); - const postMap = {}; - - posts.map(post => { - postMap[post._id] = post; - return postMap; - }); - - resolve(postMap); + resolve(posts); } catch (e) { reject(e); } diff --git a/server/routes/usersRoutes.js b/server/routes/usersRoutes.js index 031ded8..b6a1002 100644 --- a/server/routes/usersRoutes.js +++ b/server/routes/usersRoutes.js @@ -12,13 +12,7 @@ const readAllUsers = () => ( new Promise(async(resolve, reject) => { try { const users = await User.find({}); - const userMap = {}; - - users.map(user => { - userMap[user._id] = user; - return userMap; - }); - resolve(userMap); + resolve(users); } catch(e) { reject(e); } diff --git a/server/schema/mutations.js b/server/schema/mutations.js index 3929921..19aaae7 100644 --- a/server/schema/mutations.js +++ b/server/schema/mutations.js @@ -3,13 +3,15 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString } = graphql; const UserType = require('./types/userType'); + +const AuthService = require('../routes/authRoutes'); +/* const MessageType = require('./types/messageType'); const PostType = require('./types/postType'); -const AuthService = require('../routes/authRoutes'); const MessageService = require('../routes/messageRoutes'); const PostService = require('../routes/postsRoutes'); const UserService = require('../routes/usersRoutes'); - +*/ const mutation = new GraphQLObjectType({ name: 'Mutation', fields: { @@ -42,7 +44,7 @@ const mutation = new GraphQLObjectType({ return AuthService.signup({ firstName, lastName, email, password, req }); }, }, - +/* updateUser: { type: UserType, args: { @@ -81,6 +83,7 @@ const mutation = new GraphQLObjectType({ return MessageService.createMessage({ id, message, req }); }, }, + */ }, }); diff --git a/server/schema/types/messageType.js b/server/schema/types/messageType.js index 46d292f..c623122 100644 --- a/server/schema/types/messageType.js +++ b/server/schema/types/messageType.js @@ -20,4 +20,4 @@ const MessageType = new GraphQLObjectType({ }, }); -module.exports = {MessageType, AuthorType}; +module.exports = MessageType; diff --git a/server/schema/types/postType.js b/server/schema/types/postType.js index f6fa63d..a563b26 100644 --- a/server/schema/types/postType.js +++ b/server/schema/types/postType.js @@ -2,6 +2,14 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString } = graphql; +const PostValueType = new GraphQLObjectType({ + name: 'PostValueType', + fields: { + title: { type: GraphQLString }, + body: { type: GraphQLString }, + }, +}) + const PostType = new GraphQLObjectType({ name: 'PostType', fields: { @@ -9,10 +17,7 @@ const PostType = new GraphQLObjectType({ firstName: { type: GraphQLString }, lastName: { type: GraphQLString }, img: { type: GraphQLString }, - post: { - title: { type: GraphQLString }, - body: { type: GraphQLString }, - }, + post: { type: PostValueType }, }, }); diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js index 6858838..6b6a32b 100644 --- a/server/schema/types/rootQueryType.js +++ b/server/schema/types/rootQueryType.js @@ -2,11 +2,14 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLList } = graphql; const UserType = require('./userType'); + +const UserService = require('../../routes/usersRoutes'); + const PostType = require('./postType'); + +const PostService = require('../../routes/postsRoutes'); const MessageType = require('./messageType'); -const UserService = require('../../routes/usersRoutes'); const MessageService = require('../../routes/messageRoutes'); -const PostService = require('../../routes/postsRoutes'); const RootQueryType = new GraphQLObjectType({ name: 'RootQueryType', @@ -17,6 +20,7 @@ const RootQueryType = new GraphQLObjectType({ return req.user; }, }, + users: { type: new GraphQLList(UserType), resolve() { @@ -25,14 +29,14 @@ const RootQueryType = new GraphQLObjectType({ }, posts: { type: new GraphQLList(PostType), - resolve(parentValue, args, req) { - return PostService.readAllPosts({ req }); + resolve() { + return PostService.readAllPosts(); }, }, messages: { type: new GraphQLList(MessageType), resolve(parentValue, args, req) { - return MessageService.readMessages({ req }); + return MessageService.readMessages({req}); }, }, }, diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js index d9f22f6..5c2c952 100644 --- a/server/schema/types/userType.js +++ b/server/schema/types/userType.js @@ -1,7 +1,7 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString, GraphQLBoolean } = graphql; -/* + const UserProfileSkillsType = new GraphQLObjectType({ name: 'UserProfileSkillsType', fields: { @@ -22,7 +22,6 @@ const UserProfileType = new GraphQLObjectType({ complete: { type: GraphQLBoolean}, }, }); -*/ const UserType = new GraphQLObjectType({ @@ -32,6 +31,7 @@ const UserType = new GraphQLObjectType({ firstName: { type: GraphQLString }, lastName: { type: GraphQLString }, gender: { type: GraphQLString }, + profile: {type: UserProfileType}, }, }); diff --git a/server/yarn.lock b/server/yarn.lock index ae92ddd..30a2ea4 100644 --- a/server/yarn.lock +++ b/server/yarn.lock @@ -6,7 +6,7 @@ abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" -accepts@~1.3.5: +accepts@^1.3.0, accepts@~1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" dependencies: @@ -298,7 +298,7 @@ content-disposition@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" -content-type@~1.0.4: +content-type@^1.0.4, content-type@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" @@ -487,6 +487,15 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" +express-graphql@^0.6.12: + version "0.6.12" + resolved "http://registry.npmjs.org/express-graphql/-/express-graphql-0.6.12.tgz#dfcb2058ca72ed5190b140830ad8cdbf76a9128a" + dependencies: + accepts "^1.3.0" + content-type "^1.0.4" + http-errors "^1.3.0" + raw-body "^2.3.2" + express@^4.16.3: version "4.16.3" resolved "https://registry.yarnpkg.com/express/-/express-4.16.3.tgz#6af8a502350db3246ecc4becf6b5a34d22f7ed53" @@ -673,6 +682,12 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +graphql@^14.0.2: + version "14.0.2" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.0.2.tgz#7dded337a4c3fd2d075692323384034b357f5650" + dependencies: + iterall "^1.2.2" + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -717,7 +732,7 @@ http-errors@1.6.2: setprototypeof "1.0.3" statuses ">= 1.3.1 < 2" -http-errors@~1.6.2: +http-errors@^1.3.0, http-errors@~1.6.2: version "1.6.3" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" dependencies: @@ -726,16 +741,10 @@ http-errors@~1.6.2: setprototypeof "1.1.0" statuses ">= 1.4.0 < 2" -iconv-lite@0.4.19: +iconv-lite@0.4.19, iconv-lite@^0.4.4: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" -iconv-lite@^0.4.4: - version "0.4.23" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" - dependencies: - safer-buffer ">= 2.1.2 < 3" - ignore-by-default@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" @@ -942,6 +951,10 @@ isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" +iterall@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" + jsonwebtoken@^8.2.0: version "8.2.2" resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-8.2.2.tgz#76d7993fda79660d71bd0f933109e1f133734b20" @@ -1534,7 +1547,7 @@ range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" -raw-body@2.3.2: +raw-body@2.3.2, raw-body@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" dependencies: @@ -1648,10 +1661,6 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -1813,11 +1822,7 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -"statuses@>= 1.3.1 < 2", "statuses@>= 1.4.0 < 2": - version "1.5.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - -statuses@~1.4.0: +"statuses@>= 1.3.1 < 2", "statuses@>= 1.4.0 < 2", statuses@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" From 550b5df2efe636dc58b524ff16e7316f33ad66b0 Mon Sep 17 00:00:00 2001 From: Satyadeep Roat <satyadeep.roat@gmail.com> Date: Fri, 14 Sep 2018 18:03:38 +0530 Subject: [PATCH 26/58] mutations updated for all apis --- server/schema/mutations.js | 19 +++++-------------- server/schema/types/messageType.js | 6 +++--- server/schema/types/postType.js | 2 +- server/schema/types/rootQueryType.js | 6 +++--- server/schema/types/userType.js | 2 +- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/server/schema/mutations.js b/server/schema/mutations.js index 19aaae7..4ab698b 100644 --- a/server/schema/mutations.js +++ b/server/schema/mutations.js @@ -2,16 +2,16 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString } = graphql; -const UserType = require('./types/userType'); +const {UserType} = require('./types/userType'); const AuthService = require('../routes/authRoutes'); -/* -const MessageType = require('./types/messageType'); -const PostType = require('./types/postType'); + +const {MessageType} = require('./types/messageType'); +const {PostType, PostValueType} = require('./types/postType'); const MessageService = require('../routes/messageRoutes'); const PostService = require('../routes/postsRoutes'); const UserService = require('../routes/usersRoutes'); -*/ + const mutation = new GraphQLObjectType({ name: 'Mutation', fields: { @@ -44,7 +44,6 @@ const mutation = new GraphQLObjectType({ return AuthService.signup({ firstName, lastName, email, password, req }); }, }, -/* updateUser: { type: UserType, args: { @@ -61,13 +60,6 @@ const mutation = new GraphQLObjectType({ createPost: { type: PostType, - args: { - userId: {type: GraphQLString}, - post: { - title: { type: GraphQLString }, - body: { type: GraphQLString }, - }, - }, resolve(parentValue, { userId, post }) { return PostService.createPost({ userId, post }); }, @@ -83,7 +75,6 @@ const mutation = new GraphQLObjectType({ return MessageService.createMessage({ id, message, req }); }, }, - */ }, }); diff --git a/server/schema/types/messageType.js b/server/schema/types/messageType.js index c623122..d36d9da 100644 --- a/server/schema/types/messageType.js +++ b/server/schema/types/messageType.js @@ -6,8 +6,8 @@ const AuthorType = new GraphQLObjectType({ name: 'AuthorType', fields: { firstName: {type: GraphQLString}, - lastName: {type: GraphQLString}, - img: {type: GraphQLString}, + lastName: {type: GraphQLString}, + img: {type: GraphQLString}, }, }) @@ -20,4 +20,4 @@ const MessageType = new GraphQLObjectType({ }, }); -module.exports = MessageType; +module.exports = {MessageType, AuthorType}; diff --git a/server/schema/types/postType.js b/server/schema/types/postType.js index a563b26..eff02a3 100644 --- a/server/schema/types/postType.js +++ b/server/schema/types/postType.js @@ -21,4 +21,4 @@ const PostType = new GraphQLObjectType({ }, }); -module.exports = PostType; +module.exports = {PostType, PostValueType}; diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js index 6b6a32b..af2ebdf 100644 --- a/server/schema/types/rootQueryType.js +++ b/server/schema/types/rootQueryType.js @@ -1,14 +1,14 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLList } = graphql; -const UserType = require('./userType'); +const {UserType} = require('./userType'); const UserService = require('../../routes/usersRoutes'); -const PostType = require('./postType'); +const {PostType} = require('./postType'); const PostService = require('../../routes/postsRoutes'); -const MessageType = require('./messageType'); +const {MessageType} = require('./messageType'); const MessageService = require('../../routes/messageRoutes'); const RootQueryType = new GraphQLObjectType({ diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js index 5c2c952..d5be1f9 100644 --- a/server/schema/types/userType.js +++ b/server/schema/types/userType.js @@ -35,4 +35,4 @@ const UserType = new GraphQLObjectType({ }, }); -module.exports = UserType; +module.exports = {UserType, UserProfileType, UserProfileSkillsType}; From 8a2fa6e6db84399c037484574269ae2109ca32fc Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Fri, 14 Sep 2018 18:59:42 +0200 Subject: [PATCH 27/58] Add IDs to types --- server/schema/types/messageType.js | 14 ++++++++------ server/schema/types/postType.js | 9 +++++---- server/schema/types/rootQueryType.js | 6 +++--- server/schema/types/userType.js | 4 +++- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/server/schema/types/messageType.js b/server/schema/types/messageType.js index d36d9da..a9aba82 100644 --- a/server/schema/types/messageType.js +++ b/server/schema/types/messageType.js @@ -1,23 +1,25 @@ const graphql = require('graphql'); -const { GraphQLObjectType, GraphQLString } = graphql; +const { GraphQLObjectType, GraphQLString, GraphQLID } = graphql; const AuthorType = new GraphQLObjectType({ name: 'AuthorType', fields: { - firstName: {type: GraphQLString}, - lastName: {type: GraphQLString}, - img: {type: GraphQLString}, + id: { type: GraphQLID }, + firstName: { type: GraphQLString }, + lastName: { type: GraphQLString }, + img: { type: GraphQLString }, }, }) const MessageType = new GraphQLObjectType({ name: 'MessageType', fields: { + id: { type: GraphQLID }, author: { type: AuthorType}, recipientUserId: { type: GraphQLString}, - body: {type: GraphQLString}, + body: { type: GraphQLString }, }, }); -module.exports = {MessageType, AuthorType}; +module.exports = { MessageType, AuthorType }; diff --git a/server/schema/types/postType.js b/server/schema/types/postType.js index eff02a3..e6dd986 100644 --- a/server/schema/types/postType.js +++ b/server/schema/types/postType.js @@ -1,18 +1,19 @@ const graphql = require('graphql'); -const { GraphQLObjectType, GraphQLString } = graphql; +const { GraphQLObjectType, GraphQLString, GraphQLID } = graphql; const PostValueType = new GraphQLObjectType({ name: 'PostValueType', fields: { - title: { type: GraphQLString }, + title: { type: GraphQLString }, body: { type: GraphQLString }, }, -}) +}); const PostType = new GraphQLObjectType({ name: 'PostType', fields: { + id: { type: GraphQLID }, userId: { type: GraphQLString }, firstName: { type: GraphQLString }, lastName: { type: GraphQLString }, @@ -21,4 +22,4 @@ const PostType = new GraphQLObjectType({ }, }); -module.exports = {PostType, PostValueType}; +module.exports = { PostType, PostValueType }; diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js index af2ebdf..70550f0 100644 --- a/server/schema/types/rootQueryType.js +++ b/server/schema/types/rootQueryType.js @@ -1,14 +1,14 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLList } = graphql; -const {UserType} = require('./userType'); +const { UserType } = require('./userType'); const UserService = require('../../routes/usersRoutes'); -const {PostType} = require('./postType'); +const { PostType } = require('./postType'); const PostService = require('../../routes/postsRoutes'); -const {MessageType} = require('./messageType'); +const { MessageType } = require('./messageType'); const MessageService = require('../../routes/messageRoutes'); const RootQueryType = new GraphQLObjectType({ diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js index d5be1f9..ada085d 100644 --- a/server/schema/types/userType.js +++ b/server/schema/types/userType.js @@ -1,6 +1,6 @@ const graphql = require('graphql'); -const { GraphQLObjectType, GraphQLString, GraphQLBoolean } = graphql; +const { GraphQLObjectType, GraphQLString, GraphQLBoolean, GraphQLID } = graphql; const UserProfileSkillsType = new GraphQLObjectType({ name: 'UserProfileSkillsType', @@ -13,6 +13,7 @@ const UserProfileSkillsType = new GraphQLObjectType({ const UserProfileType = new GraphQLObjectType({ name: 'UserProfileType', fields: { + id: { type: GraphQLID }, userName: { type: GraphQLString}, img: { type: GraphQLString}, title: { type: GraphQLString}, @@ -27,6 +28,7 @@ const UserProfileType = new GraphQLObjectType({ const UserType = new GraphQLObjectType({ name: 'UserType', fields: { + id: { type: GraphQLID }, email: { type: GraphQLString }, firstName: { type: GraphQLString }, lastName: { type: GraphQLString }, From 4edce45b0b2aba1c444a2d2bf94d1099cf9325b6 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Sat, 15 Sep 2018 19:15:28 +0200 Subject: [PATCH 28/58] Indentation fix --- server/schema/types/rootQueryType.js | 3 ++- server/schema/types/userType.js | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js index 70550f0..dc694c8 100644 --- a/server/schema/types/rootQueryType.js +++ b/server/schema/types/rootQueryType.js @@ -2,7 +2,6 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLList } = graphql; const { UserType } = require('./userType'); - const UserService = require('../../routes/usersRoutes'); const { PostType } = require('./postType'); @@ -27,12 +26,14 @@ const RootQueryType = new GraphQLObjectType({ return UserService.readAllUsers(); }, }, + posts: { type: new GraphQLList(PostType), resolve() { return PostService.readAllPosts(); }, }, + messages: { type: new GraphQLList(MessageType), resolve(parentValue, args, req) { diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js index ada085d..4240e8c 100644 --- a/server/schema/types/userType.js +++ b/server/schema/types/userType.js @@ -5,8 +5,8 @@ const { GraphQLObjectType, GraphQLString, GraphQLBoolean, GraphQLID } = graphql; const UserProfileSkillsType = new GraphQLObjectType({ name: 'UserProfileSkillsType', fields: { - lang: { type: GraphQLString}, - value: { type: GraphQLString}, + lang: { type: GraphQLString }, + value: { type: GraphQLString }, }, }); @@ -14,13 +14,13 @@ const UserProfileType = new GraphQLObjectType({ name: 'UserProfileType', fields: { id: { type: GraphQLID }, - userName: { type: GraphQLString}, - img: { type: GraphQLString}, - title: { type: GraphQLString}, + userName: { type: GraphQLString }, + img: { type: GraphQLString }, + title: { type: GraphQLString }, skills: { type: UserProfileSkillsType }, - level: { type: GraphQLString}, - description: { type: GraphQLString}, - complete: { type: GraphQLBoolean}, + level: { type: GraphQLString }, + description: { type: GraphQLString }, + complete: { type: GraphQLBoolean }, }, }); @@ -33,8 +33,8 @@ const UserType = new GraphQLObjectType({ firstName: { type: GraphQLString }, lastName: { type: GraphQLString }, gender: { type: GraphQLString }, - profile: {type: UserProfileType}, + profile: {type: UserProfileType }, }, }); -module.exports = {UserType, UserProfileType, UserProfileSkillsType}; +module.exports = { UserType, UserProfileType, UserProfileSkillsType }; From fbbac3396c2ad2398eaf3d6e1fa32541ce8f341c Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Sat, 15 Sep 2018 19:15:51 +0200 Subject: [PATCH 29/58] Add user auth mutations and user query --- client/src/mutations/userAuth.js | 27 +++++++++++++++++++++++++++ client/src/queries/fetchUser.js | 9 +++++++++ 2 files changed, 36 insertions(+) create mode 100644 client/src/mutations/userAuth.js create mode 100644 client/src/queries/fetchUser.js diff --git a/client/src/mutations/userAuth.js b/client/src/mutations/userAuth.js new file mode 100644 index 0000000..de40d3e --- /dev/null +++ b/client/src/mutations/userAuth.js @@ -0,0 +1,27 @@ +import gql from 'graphql-tag'; + +export const login = gql` + mutation Login($email: String!, $password: String!) { + login(email: $email, password: $password) { + id + } + } +`; + +export const logout = gql` + mutation Logout { + logout { + id + email + } + } +`; + +export const signup = gql` + mutation Login($email: String!, $password: String!, $firstName: String!, $lastName: String!) { + login(email: $email, password: $password, firstName: $firstName, lastName: $lastName) { + id + } + } +`; + diff --git a/client/src/queries/fetchUser.js b/client/src/queries/fetchUser.js new file mode 100644 index 0000000..157efe3 --- /dev/null +++ b/client/src/queries/fetchUser.js @@ -0,0 +1,9 @@ +import gql from 'graphql-tag'; + +export default gql` + { + users { + id + } + } +`; From e632d0a7f65da8dbc865581a867790d50c8f6351 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Sat, 15 Sep 2018 19:16:26 +0200 Subject: [PATCH 30/58] Connect React Apollo --- client/package.json | 4 ++ client/src/index.js | 21 +++++-- client/yarn.lock | 146 +++++++++++++++++++++++++++++++++++++++++++- package.json | 5 +- yarn.lock | 100 ++++++++++++++++++++++++++++-- 5 files changed, 264 insertions(+), 12 deletions(-) diff --git a/client/package.json b/client/package.json index 2fe2ca2..f0a0afe 100644 --- a/client/package.json +++ b/client/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "apollo-boost": "^0.1.16", "autoprefixer": "7.1.6", "axios": "^0.18.0", "babel-core": "6.26.0", @@ -21,6 +22,8 @@ "extract-text-webpack-plugin": "3.0.2", "file-loader": "1.1.5", "fs-extra": "3.0.1", + "graphql": "^14.0.2", + "graphql-tag": "^2.9.2", "html-webpack-plugin": "2.29.0", "jest": "20.0.4", "moment": "^2.22.2", @@ -32,6 +35,7 @@ "prop-types": "^15.6.2", "raf": "3.4.0", "react": "^16.4.0", + "react-apollo": "^2.1.11", "react-chartjs": "^1.2.0", "react-dev-utils": "^5.0.1", "react-dom": "^16.4.0", diff --git a/client/src/index.js b/client/src/index.js index a99d735..c1f608d 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,5 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import ApolloClient from 'apollo-boost'; +import { ApolloProvider } from 'react-apollo'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; @@ -17,15 +19,22 @@ const store = createStore(reducers, composeWithDevTools(applyMiddleware(thunk))) export default store; +const client = new ApolloClient({ + uri: 'http://localhost:5000/graphql', +}); + ReactDOM.render( <Provider store={store}> - <Router> - <Switch> - <Route exact path="/" component={App} /> - <Route path="/dashboard/:name" component={Dashboard} /> - </Switch> - </Router> + <ApolloProvider client={client}> + <Router> + <Switch> + <Route exact path="/" component={App} /> + <Route path="/dashboard/:name" component={Dashboard} /> + </Switch> + </Router> + </ApolloProvider> </Provider>, document.getElementById('root') ); + registerServiceWorker(); diff --git a/client/yarn.lock b/client/yarn.lock index 0984d71..7b8fc72 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2,6 +2,18 @@ # yarn lockfile v1 +"@types/async@2.0.49": + version "2.0.49" + resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.49.tgz#92e33d13f74c895cb9a7f38ba97db8431ed14bc0" + +"@types/graphql@0.12.6": + version "0.12.6" + resolved "http://registry.npmjs.org/@types/graphql/-/graphql-0.12.6.tgz#3d619198585fcabe5f4e1adfb5cf5f3388c66c13" + +"@types/zen-observable@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" + abab@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" @@ -140,6 +152,94 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" +apollo-boost@^0.1.16: + version "0.1.16" + resolved "https://registry.yarnpkg.com/apollo-boost/-/apollo-boost-0.1.16.tgz#77f73a30c49ab6d749ddc3e5683a7e322c15f07d" + dependencies: + apollo-cache "^1.1.17" + apollo-cache-inmemory "^1.2.10" + apollo-client "^2.4.2" + apollo-link "^1.0.6" + apollo-link-error "^1.0.3" + apollo-link-http "^1.3.1" + apollo-link-state "^0.4.0" + graphql-tag "^2.4.2" + +apollo-cache-inmemory@^1.2.10: + version "1.2.10" + resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.2.10.tgz#362d6c36cfd815a309b966f71e5d2b6c770c7989" + dependencies: + apollo-cache "^1.1.17" + apollo-utilities "^1.0.21" + graphql-anywhere "^4.1.19" + +apollo-cache@1.1.17, apollo-cache@^1.1.17: + version "1.1.17" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.17.tgz#1fcca8423125223723b97fd72808be91a1a76490" + dependencies: + apollo-utilities "^1.0.21" + +apollo-client@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.4.2.tgz#d2f044d8740723bf98a6d8d8b9684ee8c36150e6" + dependencies: + "@types/zen-observable" "^0.8.0" + apollo-cache "1.1.17" + apollo-link "^1.0.0" + apollo-link-dedup "^1.0.0" + apollo-utilities "1.0.21" + symbol-observable "^1.0.2" + zen-observable "^0.8.0" + optionalDependencies: + "@types/async" "2.0.49" + +apollo-link-dedup@^1.0.0: + version "1.0.9" + resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.9.tgz#3c4e4af88ef027cbddfdb857c043fd0574051dad" + dependencies: + apollo-link "^1.2.2" + +apollo-link-error@^1.0.3: + version "1.1.0" + resolved "https://registry.yarnpkg.com/apollo-link-error/-/apollo-link-error-1.1.0.tgz#ef8a64411361314364db40c1d4023b987a84860f" + dependencies: + apollo-link "^1.2.2" + +apollo-link-http-common@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.4.tgz#877603f7904dc8f70242cac61808b1f8d034b2c3" + dependencies: + apollo-link "^1.2.2" + +apollo-link-http@^1.3.1: + version "1.5.4" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.4.tgz#b80b7b4b342c655b6a5614624b076a36be368f43" + dependencies: + apollo-link "^1.2.2" + apollo-link-http-common "^0.2.4" + +apollo-link-state@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/apollo-link-state/-/apollo-link-state-0.4.1.tgz#65e9e0e12c67936b8c4b12b8438434f393104579" + dependencies: + apollo-utilities "^1.0.8" + graphql-anywhere "^4.1.0-alpha.0" + +apollo-link@^1.0.0, apollo-link@^1.0.6, apollo-link@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.2.tgz#54c84199b18ac1af8d63553a68ca389c05217a03" + dependencies: + "@types/graphql" "0.12.6" + apollo-utilities "^1.0.0" + zen-observable-ts "^0.8.9" + +apollo-utilities@1.0.21, apollo-utilities@^1.0.0, apollo-utilities@^1.0.21, apollo-utilities@^1.0.8: + version "1.0.21" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.21.tgz#cb8b5779fe275850b16046ff8373f4af2de90765" + dependencies: + fast-json-stable-stringify "^2.0.0" + fclone "^1.0.11" + append-transform@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-1.0.0.tgz#046a52ae582a228bd72f58acfbe2967c678759ab" @@ -2575,6 +2675,10 @@ fbjs@^0.8.16, fbjs@^0.8.5, fbjs@^0.8.9: setimmediate "^1.0.5" ua-parser-js "^0.7.9" +fclone@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/fclone/-/fclone-1.0.11.tgz#10e85da38bfea7fc599341c296ee1d77266ee640" + figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" @@ -2948,6 +3052,22 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +graphql-anywhere@^4.1.0-alpha.0, graphql-anywhere@^4.1.19: + version "4.1.19" + resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.19.tgz#5f6ca3b58218e5449f4798e3c6d942fcd2fef082" + dependencies: + apollo-utilities "^1.0.21" + +graphql-tag@^2.4.2, graphql-tag@^2.9.2: + version "2.9.2" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.9.2.tgz#2f60a5a981375f430bf1e6e95992427dc18af686" + +graphql@^14.0.2: + version "14.0.2" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.0.2.tgz#7dded337a4c3fd2d075692323384034b357f5650" + dependencies: + iterall "^1.2.2" + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" @@ -3767,6 +3887,10 @@ istanbul-reports@^1.3.0: dependencies: handlebars "^4.0.3" +iterall@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" + jest-changed-files@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.3.tgz#9394d5cc65c438406149bef1bf4d52b68e03e3f8" @@ -5627,6 +5751,16 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-apollo@^2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.1.11.tgz#ef4805f07af1d732ec94caebf7ba0728e2d162ca" + dependencies: + fbjs "^0.8.16" + hoist-non-react-statics "^2.5.0" + invariant "^2.2.2" + lodash "^4.17.10" + prop-types "^15.6.0" + react-chartjs@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/react-chartjs/-/react-chartjs-1.2.0.tgz#54d0f90f3e9026666d9fcae447cd090bab65689d" @@ -6739,7 +6873,7 @@ sw-toolbox@^3.4.0: path-to-regexp "^1.0.1" serviceworker-cache-polyfill "^4.0.0" -symbol-observable@^1.2.0: +symbol-observable@^1.0.2, symbol-observable@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -7486,3 +7620,13 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" + +zen-observable-ts@^0.8.9: + version "0.8.9" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.9.tgz#d3c97af08c0afdca37ebcadf7cc3ee96bda9bab1" + dependencies: + zen-observable "^0.8.0" + +zen-observable@^0.8.0: + version "0.8.9" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.9.tgz#0475c760ff0eda046bbdfa4dc3f95d392807ac53" diff --git a/package.json b/package.json index 4a52fe3..1f39471 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,10 @@ "author": "", "license": "ISC", "dependencies": { - "concurrently": "^3.5.1" + "concurrently": "^3.5.1", + "graphql": "^14.0.2", + "graphql-tag": "^2.9.2", + "react-apollo": "^2.1.11" }, "devDependencies": { "babel-eslint": "^9.0.0", diff --git a/yarn.lock b/yarn.lock index be93536..1021e38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -217,6 +217,10 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" @@ -503,6 +507,10 @@ copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" +core-js@^1.0.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -659,6 +667,12 @@ emoji-regex@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" +encoding@^0.1.11: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + dependencies: + iconv-lite "~0.4.13" + error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -965,6 +979,18 @@ fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" +fbjs@^0.8.16: + version "0.8.17" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" + dependencies: + core-js "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.18" + figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -1143,6 +1169,16 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +graphql-tag@^2.9.2: + version "2.9.2" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.9.2.tgz#2f60a5a981375f430bf1e6e95992427dc18af686" + +graphql@^14.0.2: + version "14.0.2" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.0.2.tgz#7dded337a4c3fd2d075692323384034b357f5650" + dependencies: + iterall "^1.2.2" + has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -1198,6 +1234,10 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" +hoist-non-react-statics@^2.5.0: + version "2.5.5" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" + hosted-git-info@^2.1.4: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -1210,7 +1250,7 @@ husky@^0.14.3: normalize-path "^1.0.0" strip-indent "^2.0.0" -iconv-lite@^0.4.24, iconv-lite@^0.4.4: +iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" dependencies: @@ -1279,6 +1319,12 @@ inquirer@^6.1.0: strip-ansi "^4.0.0" through "^2.3.6" +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + dependencies: + loose-envify "^1.0.0" + is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" @@ -1468,7 +1514,7 @@ is-retry-allowed@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" -is-stream@^1.0.0, is-stream@^1.1.0: +is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -1498,6 +1544,17 @@ isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" +isomorphic-fetch@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + +iterall@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" + jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" @@ -1700,7 +1757,7 @@ log-update@^1.0.2: ansi-escapes "^1.0.0" cli-cursor "^1.0.2" -loose-envify@^1.3.1: +loose-envify@^1.0.0, loose-envify@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: @@ -1847,6 +1904,13 @@ nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-pre-gyp@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" @@ -2214,7 +2278,13 @@ progress@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" -prop-types@^15.6.2: +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + dependencies: + asap "~2.0.3" + +prop-types@^15.6.0, prop-types@^15.6.2: version "15.6.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" dependencies: @@ -2250,6 +2320,16 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-apollo@^2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.1.11.tgz#ef4805f07af1d732ec94caebf7ba0728e2d162ca" + dependencies: + fbjs "^0.8.16" + hoist-non-react-statics "^2.5.0" + invariant "^2.2.2" + lodash "^4.17.10" + prop-types "^15.6.0" + read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" @@ -2449,6 +2529,10 @@ set-value@^2.0.0: is-plain-object "^2.0.3" split-string "^3.0.1" +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -2755,6 +2839,10 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +ua-parser-js@^0.7.18: + version "0.7.18" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed" + undefsafe@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.2.tgz#225f6b9e0337663e0d8e7cfd686fc2836ccace76" @@ -2837,6 +2925,10 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +whatwg-fetch@>=0.10.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" + which@^1.2.10, which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" From 063df52ad1c9c8b0e6d69f8a97a5cff343a84737 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Sun, 16 Sep 2018 11:15:56 +0200 Subject: [PATCH 31/58] Add cors middleware in server --- server/server.js | 2 ++ server/yarn.lock | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/server.js b/server/server.js index 6f4009f..d306dcc 100644 --- a/server/server.js +++ b/server/server.js @@ -6,6 +6,7 @@ const expressGraphQL = require('express-graphql'); const app = express(); const bodyParser = require('body-parser'); +const cors = require('cors'); const keys = require('./config/keys'); require('./models/User'); @@ -29,6 +30,7 @@ app.use( app.use(passport.initialize()); app.use(passport.session()); +app.use(cors()); app.use('/graphql', expressGraphQL({ schema, graphiql: true, diff --git a/server/yarn.lock b/server/yarn.lock index 30a2ea4..d914c1c 100644 --- a/server/yarn.lock +++ b/server/yarn.lock @@ -334,6 +334,13 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cors@^2.8.4: + version "2.8.4" + resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.4.tgz#2bd381f2eb201020105cd50ea59da63090694686" + dependencies: + object-assign "^4" + vary "^1" + create-error-class@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" @@ -1355,7 +1362,7 @@ oauth@0.9.x: version "0.9.15" resolved "https://registry.yarnpkg.com/oauth/-/oauth-0.9.15.tgz#bd1fefaf686c96b75475aed5196412ff60cfb9c1" -object-assign@^4.1.0: +object-assign@^4, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -2023,7 +2030,7 @@ utils-merge@1.0.1, utils-merge@1.x.x: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" -vary@~1.1.2: +vary@^1, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" From b2710595a7f0b277e8b6557244039e88d122af94 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Mon, 17 Sep 2018 09:50:30 +0200 Subject: [PATCH 32/58] Create proxy and add http/cache dependencies --- client/package.json | 5 ++++ client/src/index.js | 11 +++++++- client/yarn.lock | 26 +++++++++++++++++++ yarn.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) diff --git a/client/package.json b/client/package.json index f0a0afe..9c941ad 100644 --- a/client/package.json +++ b/client/package.json @@ -4,6 +4,8 @@ "private": true, "dependencies": { "apollo-boost": "^0.1.16", + "apollo-cache-inmemory": "^1.2.10", + "apollo-link-http": "^1.5.5", "autoprefixer": "7.1.6", "axios": "^0.18.0", "babel-core": "6.26.0", @@ -107,6 +109,9 @@ }, "/api/*": { "target": "http://localhost:5000" + }, + "/graphql": { + "target": "http://localhost:5000" } }, "babel": { diff --git a/client/src/index.js b/client/src/index.js index c1f608d..e95739a 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -2,6 +2,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import ApolloClient from 'apollo-boost'; import { ApolloProvider } from 'react-apollo'; +import { HttpLink } from 'apollo-link-http'; +import { InMemoryCache } from 'apollo-cache-inmemory'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; @@ -19,8 +21,15 @@ const store = createStore(reducers, composeWithDevTools(applyMiddleware(thunk))) export default store; -const client = new ApolloClient({ +const httpLink = new HttpLink({ uri: 'http://localhost:5000/graphql', +}) + +const cache = new InMemoryCache(); + +const client = new ApolloClient({ + link: httpLink, + cache, }); ReactDOM.render( diff --git a/client/yarn.lock b/client/yarn.lock index 7b8fc72..4ea3bed 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -211,6 +211,12 @@ apollo-link-http-common@^0.2.4: dependencies: apollo-link "^1.2.2" +apollo-link-http-common@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.5.tgz#d094beb7971523203359bf830bfbfa7b4e7c30ed" + dependencies: + apollo-link "^1.2.3" + apollo-link-http@^1.3.1: version "1.5.4" resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.4.tgz#b80b7b4b342c655b6a5614624b076a36be368f43" @@ -218,6 +224,13 @@ apollo-link-http@^1.3.1: apollo-link "^1.2.2" apollo-link-http-common "^0.2.4" +apollo-link-http@^1.5.5: + version "1.5.5" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.5.tgz#7dbe851821771ad67fa29e3900c57f38cbd80da8" + dependencies: + apollo-link "^1.2.3" + apollo-link-http-common "^0.2.5" + apollo-link-state@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/apollo-link-state/-/apollo-link-state-0.4.1.tgz#65e9e0e12c67936b8c4b12b8438434f393104579" @@ -233,6 +246,13 @@ apollo-link@^1.0.0, apollo-link@^1.0.6, apollo-link@^1.2.2: apollo-utilities "^1.0.0" zen-observable-ts "^0.8.9" +apollo-link@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.3.tgz#9bd8d5fe1d88d31dc91dae9ecc22474d451fb70d" + dependencies: + apollo-utilities "^1.0.0" + zen-observable-ts "^0.8.10" + apollo-utilities@1.0.21, apollo-utilities@^1.0.0, apollo-utilities@^1.0.21, apollo-utilities@^1.0.8: version "1.0.21" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.21.tgz#cb8b5779fe275850b16046ff8373f4af2de90765" @@ -7621,6 +7641,12 @@ yargs@~3.10.0: decamelize "^1.0.0" window-size "0.1.0" +zen-observable-ts@^0.8.10: + version "0.8.10" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.10.tgz#18e2ce1c89fe026e9621fd83cc05168228fce829" + dependencies: + zen-observable "^0.8.0" + zen-observable-ts@^0.8.9: version "0.8.9" resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.9.tgz#d3c97af08c0afdca37ebcadf7cc3ee96bda9bab1" diff --git a/yarn.lock b/yarn.lock index 1021e38..ec65afa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -156,6 +156,47 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" +apollo-cache-inmemory@^1.2.10: + version "1.2.10" + resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.2.10.tgz#362d6c36cfd815a309b966f71e5d2b6c770c7989" + dependencies: + apollo-cache "^1.1.17" + apollo-utilities "^1.0.21" + graphql-anywhere "^4.1.19" + +apollo-cache@^1.1.17: + version "1.1.17" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.17.tgz#1fcca8423125223723b97fd72808be91a1a76490" + dependencies: + apollo-utilities "^1.0.21" + +apollo-link-http-common@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.5.tgz#d094beb7971523203359bf830bfbfa7b4e7c30ed" + dependencies: + apollo-link "^1.2.3" + +apollo-link-http@^1.5.5: + version "1.5.5" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.5.tgz#7dbe851821771ad67fa29e3900c57f38cbd80da8" + dependencies: + apollo-link "^1.2.3" + apollo-link-http-common "^0.2.5" + +apollo-link@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.3.tgz#9bd8d5fe1d88d31dc91dae9ecc22474d451fb70d" + dependencies: + apollo-utilities "^1.0.0" + zen-observable-ts "^0.8.10" + +apollo-utilities@^1.0.0, apollo-utilities@^1.0.21: + version "1.0.21" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.21.tgz#cb8b5779fe275850b16046ff8373f4af2de90765" + dependencies: + fast-json-stable-stringify "^2.0.0" + fclone "^1.0.11" + aproba@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -991,6 +1032,10 @@ fbjs@^0.8.16: setimmediate "^1.0.5" ua-parser-js "^0.7.18" +fclone@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/fclone/-/fclone-1.0.11.tgz#10e85da38bfea7fc599341c296ee1d77266ee640" + figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -1169,6 +1214,12 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +graphql-anywhere@^4.1.19: + version "4.1.19" + resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.19.tgz#5f6ca3b58218e5449f4798e3c6d942fcd2fef082" + dependencies: + apollo-utilities "^1.0.21" + graphql-tag@^2.9.2: version "2.9.2" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.9.2.tgz#2f60a5a981375f430bf1e6e95992427dc18af686" @@ -2980,3 +3031,13 @@ yallist@^2.1.2: yallist@^3.0.0, yallist@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" + +zen-observable-ts@^0.8.10: + version "0.8.10" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.10.tgz#18e2ce1c89fe026e9621fd83cc05168228fce829" + dependencies: + zen-observable "^0.8.0" + +zen-observable@^0.8.0: + version "0.8.9" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.9.tgz#0475c760ff0eda046bbdfa4dc3f95d392807ac53" From a53d5d4a7c469db8e1e0e5ab63978b8c8b8b6ba3 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Tue, 18 Sep 2018 10:22:19 +0200 Subject: [PATCH 33/58] Add messages in card mutation --- .../Dashboard/DashboardView/DashProfile.js | 57 +++++++++-------- client/src/components/Dashboard/Find/Card.js | 30 +++++---- .../components/Dashboard/Find/CardContact.js | 62 ++++++++++++------- .../src/components/Dashboard/Find/mutation.js | 9 +++ server/routes/messageRoutes.js | 2 +- server/schema/types/messageType.js | 16 ++--- 6 files changed, 101 insertions(+), 75 deletions(-) create mode 100644 client/src/components/Dashboard/Find/mutation.js diff --git a/client/src/components/Dashboard/DashboardView/DashProfile.js b/client/src/components/Dashboard/DashboardView/DashProfile.js index 5eda995..b791f74 100644 --- a/client/src/components/Dashboard/DashboardView/DashProfile.js +++ b/client/src/components/Dashboard/DashboardView/DashProfile.js @@ -1,6 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { Query } from 'react-apollo'; import InfoBox from '../styled_components/InfoBox'; +import { profileQuery } from './queries'; // import { Bar } from 'react-chartjs'; // import { CardSkills } from '../Find/Find'; @@ -13,35 +15,36 @@ const StatsInfo = ({ val, name, line }) => ( </React.Fragment> ); -const DashUserProfile = ({ currentUser }) => { - const { profile, firstName, lastName } = currentUser; - return ( - currentUser && - profile !== undefined && ( - <InfoBox none odd margin size={400} height={700}> - <div className="dash-profile"> - <div className="dash-user-info"> - <img src={profile.img} alt="" /> - <div> - <h3> - {firstName} {lastName} - </h3> - <h5>{profile.title}</h5> - <button id="edit-profile">Edit Profile</button> +const DashUserProfile = () => ( + <Query query={profileQuery}> + {({data}) => { + const { user } = data; + return user ? ( + <InfoBox none odd margin size={400} height={700}> + <div className="dash-profile"> + <div className="dash-user-info"> + <img src={user.profile.img} alt="" /> + <div> + <h3> + {user.firstName} {user.lastName} + </h3> + <h5>{user.profile.title}</h5> + <button id="edit-profile">Edit Profile</button> + </div> </div> + <div className="dash-user-row"> + <StatsInfo line val={3} name="projects" /> + <StatsInfo line val={67} name="connections" /> + <StatsInfo val={7} name="posts" /> + </div> + {/* <CardSkills user={currentUser} /> */} + {/* <Bar data={CHART_DATA} width='250' height='300'/> */} </div> - <div className="dash-user-row"> - <StatsInfo line val={3} name="projects" /> - <StatsInfo line val={67} name="connections" /> - <StatsInfo val={7} name="posts" /> - </div> - {/* <CardSkills user={currentUser} /> */} - {/* <Bar data={CHART_DATA} width='250' height='300'/> */} - </div> - </InfoBox> - ) - ); -}; + </InfoBox> + ) : <InfoBox none odd margin size={400} height={700} /> + }} + </Query> +); StatsInfo.propTypes = { val: PropTypes.number.isRequired, diff --git a/client/src/components/Dashboard/Find/Card.js b/client/src/components/Dashboard/Find/Card.js index 941ff27..25ddb4c 100644 --- a/client/src/components/Dashboard/Find/Card.js +++ b/client/src/components/Dashboard/Find/Card.js @@ -17,19 +17,18 @@ const CardAbout = ({ text }) => ( </div> ); -const CardSkills = ({ skills }) => - skills && ( - <div className="card-col-info"> - <div className="card-col-skills"> - {skills.slice(0, 3).map(skill => ( - <div className="skill" id={skill.lang.toLowerCase()}> - <span id="skill-name">{skill.lang}:</span> - <ProgressBar width={skill.value} /> - </div> - ))} - </div> +const CardSkills = ({ skills }) => ( + <div className="card-col-info"> + <div className="card-col-skills"> + {skills.slice(0, 3).map(skill => ( + <div className="skill" id={skill.lang.toLowerCase()}> + <span id="skill-name">{skill.lang}:</span> + <ProgressBar width={skill.value} /> + </div> + ))} </div> - ); + </div> +); class Card extends Component { constructor() { @@ -57,6 +56,7 @@ class Card extends Component { render() { const { user, i } = this.props; const { active } = this.state; + console.log('uuzehhh', user) return ( <InfoBox margin nojustify size={300} height={500} data-style={i} className="user-find-card"> <div className="card-user-info"> @@ -79,7 +79,7 @@ class Card extends Component { <CardAbout text={user.profile.description} /> </div> ) : ( - <CardContact user={user} onSubmit={this.onSubmit} /> + <CardContact user={user} /> )} </InfoBox> ); @@ -95,6 +95,10 @@ CardAbout.propTypes = { text: PropTypes.string.isRequired, }; +CardSkills.propTypes = { + skills: PropTypes.shape.isRequired, +}; + Card.propTypes = { i: PropTypes.number.isRequired, user: PropTypes.shape({ diff --git a/client/src/components/Dashboard/Find/CardContact.js b/client/src/components/Dashboard/Find/CardContact.js index ee2102e..a11cd12 100644 --- a/client/src/components/Dashboard/Find/CardContact.js +++ b/client/src/components/Dashboard/Find/CardContact.js @@ -1,30 +1,48 @@ -import React from 'react'; -import { reduxForm, Field } from 'redux-form'; +import React, { Component } from 'react'; +import { Mutation } from 'react-apollo'; import PropTypes from 'prop-types'; import { ProfileIcon, MessagesIcon, LinkedinIcon, GithubIcon } from '../../../assets/icons'; +import AddMessage from './mutation' const Icons = [<ProfileIcon />, <MessagesIcon />, <LinkedinIcon />, <GithubIcon />]; -const ContactForm = ({ handleSubmit }) => ( - <div className="card-col-info-contact"> - <form onSubmit={handleSubmit}> - <Field component="textarea" name="message" /> - <button type="submit" /> - </form> - <div className="contact-btns"> - {Icons.map((icon, i) => ( - <div className="contact-btn" data-style={i}> - {icon} - </div> - ))} - </div> - </div> -); +export default class ContactForm extends Component { + state = { + message: '', + } -ContactForm.propTypes = { - handleSubmit: PropTypes.func.isRequired, + handleInput = e => { + this.setState({ message: e.target.value }); + } + + render() { + const { message } = this.state; + const { user } = this.props; + return ( + <Mutation mutation={AddMessage}> + {createMessage => ( + <div className="card-col-info-contact"> + <form onSubmit={e => { + e.preventDefault(); + createMessage( { variables: { id: user.id, message } }) + }}> + <input type="text" value={message} onChange={e => this.handleInput(e)} /> + <button type="submit" /> + </form> + <div className="contact-btns"> + {Icons.map((icon, i) => ( + <div className="contact-btn" data-style={i}> + {icon} + </div> + ))} + </div> + </div> + )} + </Mutation> + ); + } }; -export default reduxForm({ - form: 'contactMessage', -})(ContactForm); +ContactForm.propTypes = { + user: PropTypes.shape.isRequired, +} diff --git a/client/src/components/Dashboard/Find/mutation.js b/client/src/components/Dashboard/Find/mutation.js new file mode 100644 index 0000000..0e101c6 --- /dev/null +++ b/client/src/components/Dashboard/Find/mutation.js @@ -0,0 +1,9 @@ +import gql from 'graphql-tag'; + +export default gql` + mutation CreateMessage($id: String, $message: String) { + createMessage(id: $id, message: $message) { + id + } + } +`; diff --git a/server/routes/messageRoutes.js b/server/routes/messageRoutes.js index 3667bdb..73cefd3 100644 --- a/server/routes/messageRoutes.js +++ b/server/routes/messageRoutes.js @@ -36,6 +36,6 @@ const createMessage = ({id, message, req}) => ( reject(e); } }) -) +); module.exports = {readMessages, createMessage}; diff --git a/server/schema/types/messageType.js b/server/schema/types/messageType.js index a9aba82..136ce3f 100644 --- a/server/schema/types/messageType.js +++ b/server/schema/types/messageType.js @@ -2,24 +2,16 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString, GraphQLID } = graphql; -const AuthorType = new GraphQLObjectType({ - name: 'AuthorType', - fields: { - id: { type: GraphQLID }, - firstName: { type: GraphQLString }, - lastName: { type: GraphQLString }, - img: { type: GraphQLString }, - }, -}) +const { UserType } = require('./userType'); const MessageType = new GraphQLObjectType({ name: 'MessageType', fields: { id: { type: GraphQLID }, - author: { type: AuthorType}, - recipientUserId: { type: GraphQLString}, + author: { type: UserType }, + recipientUserId: { type: GraphQLString }, body: { type: GraphQLString }, }, }); -module.exports = { MessageType, AuthorType }; +module.exports = { MessageType }; From 3d009af6634871811344e590f89c0b0484aa9315 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Tue, 18 Sep 2018 15:26:01 +0200 Subject: [PATCH 34/58] Add logout --- .../Dashboard/Messages/MessageReply.js | 79 +++++++++++-------- .../Dashboard/SidePane/Menu/index.js | 25 ++++-- .../Dashboard/SidePane/Menu/mutation.js | 9 +++ 3 files changed, 76 insertions(+), 37 deletions(-) create mode 100644 client/src/components/Dashboard/SidePane/Menu/mutation.js diff --git a/client/src/components/Dashboard/Messages/MessageReply.js b/client/src/components/Dashboard/Messages/MessageReply.js index 3f3a8f0..91b2c2f 100644 --- a/client/src/components/Dashboard/Messages/MessageReply.js +++ b/client/src/components/Dashboard/Messages/MessageReply.js @@ -1,43 +1,58 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { reduxForm, Field } from 'redux-form'; +import React, { Component } from 'react'; +import { Mutation } from 'react-apollo'; +import { PropTypes } from 'prop-types'; import { MessageConsumer } from './Messages'; +import AddMessage from './mutation' -const MessageReply = ({ messages, activeMessage, handleSubmit }) => { - const message = messages.length && messages[activeMessage]; - return ( - messages.length && ( - <div className="message-reply"> - <form onSubmit={handleSubmit}> - <div className="message-reply-author"> - <div className="message-reply-name"> - <span> - {message.author.firstName} {message.author.lastName} - </span> +class MessageReply extends Component { + state = { + messageInput: '', + } + + handleInput = e => { + this.setState({ messageInput: e.target.value }); + } + + render() { + const { messageInput } = this.state; + const { messages, activeMessage } = this.props; + const message = messages.length && messages[activeMessage]; + return ( + <Mutation mutation={AddMessage}> + {createMessage => ( + <div className="message-reply"> + <form onSubmit={e => { + e.preventDefault(); + createMessage({ variables: { id: message.recipientId, message }}) + }}> + <div className="message-reply-author"> + <div className="message-reply-name"> + <span> + {message.author.firstName} {message.author.lastName} + </span> + </div> + <img src={message.author.img} alt="" /> </div> - <img src={message.author.img} alt="" /> - </div> - <div className="message-reply-msg">{message.body}</div> - <Field component="textarea" name="message" type="text" /> - <button type="submit">Send</button> - </form> - </div> - ) - ); + <div className="message-reply-msg">{message.body}</div> + <input value={messageInput} onChange={e => this.handleInput(e)} /> + <button type="submit">Send</button> + </form> + </div> + )} + </Mutation> + ); + } }; -export const MessageReplyInput = ({ handleSubmit }) => ( +export default () => ( <MessageConsumer> {({ activeMessage, messages }) => ( - <MessageReply activeMessage={activeMessage} messages={messages} handleSubmit={handleSubmit} /> + <MessageReply activeMessage={activeMessage} messages={messages} /> )} </MessageConsumer> ); -MessageReplyInput.propTypes = { - handleSubmit: PropTypes.func.isRequired, -}; - -export default reduxForm({ - form: 'messageReply', -})(MessageReplyInput); +MessageReply.propTypes = { + messages: PropTypes.shape.isRequired, + activeMessage: PropTypes.number.isRequired, +} diff --git a/client/src/components/Dashboard/SidePane/Menu/index.js b/client/src/components/Dashboard/SidePane/Menu/index.js index ca6dd3f..3a23dfb 100644 --- a/client/src/components/Dashboard/SidePane/Menu/index.js +++ b/client/src/components/Dashboard/SidePane/Menu/index.js @@ -1,8 +1,10 @@ import React from 'react'; import shortid from 'short-id'; +import { Mutation } from 'react-apollo'; import { NavLink } from 'react-router-dom'; import MENU_CONTENTS from './menuBtns'; import { LogOutIcon } from '../../../../assets/icons'; +import logoutUser from './mutation'; const Menu = () => ( <div className="menu"> @@ -17,12 +19,25 @@ const Menu = () => ( {btn.name} </NavLink> ))} - <a href="/api/logout" className="btn-menu"> - <div className="icon"> - <LogOutIcon /> + <Mutation mutation={logoutUser}> + {logout => ( + <div + onClick={e => { + e.preventDefault(); + logout() + // TODO: Use react router instead. + .then(() => { + window.location.href = 'http://localhost:3000' + }) + }} + className="btn-menu"> + <div className="icon"> + <LogOutIcon /> + </div> + Log Out </div> - Log Out - </a> + )} + </Mutation> </div> ); diff --git a/client/src/components/Dashboard/SidePane/Menu/mutation.js b/client/src/components/Dashboard/SidePane/Menu/mutation.js new file mode 100644 index 0000000..f077c74 --- /dev/null +++ b/client/src/components/Dashboard/SidePane/Menu/mutation.js @@ -0,0 +1,9 @@ +import gql from 'graphql-tag'; + +export default gql` + mutation Logout { + logout { + id + } + } +`; From e07a655f371fac2b56f990eb176b230d20cc8186 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Tue, 18 Sep 2018 15:30:45 +0200 Subject: [PATCH 35/58] Update types --- server/routes/postsRoutes.js | 10 +++------- server/schema/types/postType.js | 8 ++++---- server/schema/types/rootQueryType.js | 2 +- server/schema/types/userType.js | 8 +++----- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/server/routes/postsRoutes.js b/server/routes/postsRoutes.js index c915970..146b9e6 100644 --- a/server/routes/postsRoutes.js +++ b/server/routes/postsRoutes.js @@ -14,20 +14,16 @@ const readAllPosts = () => ( }) ) -const createPost = ({userId, post}) => ( +const createPost = ({user, post}) => ( new Promise(async(resolve, reject) => { - let user = {}; try { - user = await User.findOne({ _id: userId }); + await User.findOne({ _id: user._id }); } catch(e) { reject(e); } try { Post.create({ - userId: user.id, - firstName: user.firstName, - lastName: user.lastName, - img: user.profile.img, + user, post: { title: post.title, body: post.body, diff --git a/server/schema/types/postType.js b/server/schema/types/postType.js index e6dd986..ba21ace 100644 --- a/server/schema/types/postType.js +++ b/server/schema/types/postType.js @@ -2,11 +2,14 @@ const graphql = require('graphql'); const { GraphQLObjectType, GraphQLString, GraphQLID } = graphql; +const { UserType } = require('./userType'); + const PostValueType = new GraphQLObjectType({ name: 'PostValueType', fields: { title: { type: GraphQLString }, body: { type: GraphQLString }, + date: { type: GraphQLString }, }, }); @@ -14,10 +17,7 @@ const PostType = new GraphQLObjectType({ name: 'PostType', fields: { id: { type: GraphQLID }, - userId: { type: GraphQLString }, - firstName: { type: GraphQLString }, - lastName: { type: GraphQLString }, - img: { type: GraphQLString }, + author: { type: UserType }, post: { type: PostValueType }, }, }); diff --git a/server/schema/types/rootQueryType.js b/server/schema/types/rootQueryType.js index dc694c8..63d981f 100644 --- a/server/schema/types/rootQueryType.js +++ b/server/schema/types/rootQueryType.js @@ -33,7 +33,7 @@ const RootQueryType = new GraphQLObjectType({ return PostService.readAllPosts(); }, }, - + messages: { type: new GraphQLList(MessageType), resolve(parentValue, args, req) { diff --git a/server/schema/types/userType.js b/server/schema/types/userType.js index 4240e8c..0193b57 100644 --- a/server/schema/types/userType.js +++ b/server/schema/types/userType.js @@ -1,6 +1,6 @@ const graphql = require('graphql'); -const { GraphQLObjectType, GraphQLString, GraphQLBoolean, GraphQLID } = graphql; +const { GraphQLObjectType, GraphQLString, GraphQLBoolean, GraphQLID, GraphQLList } = graphql; const UserProfileSkillsType = new GraphQLObjectType({ name: 'UserProfileSkillsType', @@ -13,18 +13,16 @@ const UserProfileSkillsType = new GraphQLObjectType({ const UserProfileType = new GraphQLObjectType({ name: 'UserProfileType', fields: { - id: { type: GraphQLID }, userName: { type: GraphQLString }, img: { type: GraphQLString }, title: { type: GraphQLString }, - skills: { type: UserProfileSkillsType }, + skills: { type: GraphQLList(UserProfileSkillsType) }, level: { type: GraphQLString }, description: { type: GraphQLString }, complete: { type: GraphQLBoolean }, }, }); - const UserType = new GraphQLObjectType({ name: 'UserType', fields: { @@ -33,7 +31,7 @@ const UserType = new GraphQLObjectType({ firstName: { type: GraphQLString }, lastName: { type: GraphQLString }, gender: { type: GraphQLString }, - profile: {type: UserProfileType }, + profile: { type: UserProfileType }, }, }); From e82467acb2cd9166480e6f457386ec3ba2012a93 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Tue, 18 Sep 2018 21:00:21 +0200 Subject: [PATCH 36/58] Add mutations and queries for dashboard view --- .../Dashboard/DashboardView/DashProfile.js | 2 +- .../Dashboard/DashboardView/MessageTable.js | 33 +++++++-------- .../Dashboard/DashboardView/mutation.js | 0 .../Dashboard/DashboardView/queries.js | 40 +++++++++++++++++++ 4 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 client/src/components/Dashboard/DashboardView/mutation.js create mode 100644 client/src/components/Dashboard/DashboardView/queries.js diff --git a/client/src/components/Dashboard/DashboardView/DashProfile.js b/client/src/components/Dashboard/DashboardView/DashProfile.js index b791f74..c3feb7e 100644 --- a/client/src/components/Dashboard/DashboardView/DashProfile.js +++ b/client/src/components/Dashboard/DashboardView/DashProfile.js @@ -19,7 +19,7 @@ const DashUserProfile = () => ( <Query query={profileQuery}> {({data}) => { const { user } = data; - return user ? ( + return user ? ( <InfoBox none odd margin size={400} height={700}> <div className="dash-profile"> <div className="dash-user-info"> diff --git a/client/src/components/Dashboard/DashboardView/MessageTable.js b/client/src/components/Dashboard/DashboardView/MessageTable.js index b7a8621..cf73d71 100644 --- a/client/src/components/Dashboard/DashboardView/MessageTable.js +++ b/client/src/components/Dashboard/DashboardView/MessageTable.js @@ -1,8 +1,9 @@ import React, { Component } from 'react'; -import axios from 'axios'; +import { Query } from 'react-apollo'; import moment from 'moment'; import shortid from 'short-id'; import PropTypes from 'prop-types'; +import { postsQuery } from './queries'; import InfoBox from '../styled_components/InfoBox'; import TextInput from './TextInput'; @@ -23,30 +24,30 @@ const Message = ({ msg }) => </div> ); + class MessagesTable extends Component { state = { body: '' }; onPostChange = (key, e) => this.setState({ [key]: e.target.value }); - addPost = () => { - const formData = this.state; - const data = this.props; - axios.post('/api/all_posts', { data, formData }); - }; - render() { // eslint-disable-next-line react/destructuring-assignment - const posts = Object.values(this.props.posts); const { body } = this.state; return ( - <InfoBox size={400} height={300}> - <TextInput onPostChange={this.onPostChange} body={body} /> - <div className="dash-messages"> - {posts.reverse().map(msg => ( - <Message msg={msg} key={shortid.generate()} /> - ))} - </div> - </InfoBox> + <Query query={postsQuery}> + {({data}) => ( + data ? ( + <InfoBox size={400} height={300}> + <TextInput onPostChange={this.onPostChange} body={body} /> + <div className="dash-messages"> + {data.posts && data.posts.reverse().map(msg => ( + <Message msg={msg} key={shortid.generate()} /> + ))} + </div> + </InfoBox> + ) : <InfoBox size={400} height={300} /> + )} + </Query> ); } } diff --git a/client/src/components/Dashboard/DashboardView/mutation.js b/client/src/components/Dashboard/DashboardView/mutation.js new file mode 100644 index 0000000..e69de29 diff --git a/client/src/components/Dashboard/DashboardView/queries.js b/client/src/components/Dashboard/DashboardView/queries.js new file mode 100644 index 0000000..97c9686 --- /dev/null +++ b/client/src/components/Dashboard/DashboardView/queries.js @@ -0,0 +1,40 @@ +import gql from 'graphql-tag'; + +export const profileQuery = gql` + { + user { + id + firstName + lastName + profile { + title + img + } + } + } +`; + +export const messagesQuery = gql` + { + messages { + id + } + } +`; + +export const postsQuery = gql` + { + posts { + id + author { + id + firstName + } + post { + title + body + date + } + } + } +`; From 64769fd5a1581c85fb8e8d517742eca313318599 Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Tue, 18 Sep 2018 21:41:18 +0200 Subject: [PATCH 37/58] Update routes --- server/routes/messageRoutes.js | 1 + server/routes/postsRoutes.js | 10 +++------- server/routes/usersRoutes.js | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/server/routes/messageRoutes.js b/server/routes/messageRoutes.js index 73cefd3..b861c6a 100644 --- a/server/routes/messageRoutes.js +++ b/server/routes/messageRoutes.js @@ -20,6 +20,7 @@ const createMessage = ({id, message, req}) => ( try { const author = await User.findOne({ _id: req.user._id }); const recipient = await User.findOne({ _id: id }); + Message.create({ author: { _id: author._id, diff --git a/server/routes/postsRoutes.js b/server/routes/postsRoutes.js index 146b9e6..48a4399 100644 --- a/server/routes/postsRoutes.js +++ b/server/routes/postsRoutes.js @@ -14,16 +14,12 @@ const readAllPosts = () => ( }) ) -const createPost = ({user, post}) => ( +const createPost = ({author, date, post}) => ( new Promise(async(resolve, reject) => { - try { - await User.findOne({ _id: user._id }); - } catch(e) { - reject(e); - } try { Post.create({ - user, + author, + date, post: { title: post.title, body: post.body, diff --git a/server/routes/usersRoutes.js b/server/routes/usersRoutes.js index b6a1002..267463f 100644 --- a/server/routes/usersRoutes.js +++ b/server/routes/usersRoutes.js @@ -17,7 +17,7 @@ const readAllUsers = () => ( reject(e); } }) -) +); const updateUser = ({values, req}) => ( new Promise(async(resolve, reject) => { From 61ba68907baa32d2ebd1d94664b9f0c08f22bd8a Mon Sep 17 00:00:00 2001 From: Lydia Hallie <lydiajuliettehallie@gmail.com> Date: Tue, 18 Sep 2018 21:43:36 +0200 Subject: [PATCH 38/58] Remove all REST functionality from Dashboard views --- .../Dashboard/DashboardView/DashProfile.js | 2 +- .../Dashboard/DashboardView/Dashboard.js | 6 +- .../Dashboard/DashboardView/InfoBoxes.js | 57 +++---- .../Dashboard/DashboardView/MessageTable.js | 2 +- .../Dashboard/DashboardView/TextInput.js | 2 +- .../Dashboard/DashboardView/mutation.js | 0 .../DashboardView/{queries.js => query.js} | 2 +- client/src/components/Dashboard/Find/Card.js | 13 -- client/src/components/Dashboard/Find/Find.js | 36 +++-- client/src/components/Dashboard/Find/query.js | 22 +++ .../Dashboard/Messages/MessageReply.js | 2 +- .../components/Dashboard/Messages/Messages.js | 48 +++--- .../components/Dashboard/Messages/mutation.js | 10 ++ .../components/Dashboard/Messages/query.js | 18 +++ .../components/Dashboard/Profile/Profile.js | 49 +++--- .../Dashboard/Profile/ProfileInfo.js | 106 ++++++++----- .../components/Dashboard/Profile/Skills.js | 8 +- .../components/Dashboard/Profile/formInfo.js | 4 +- .../components/Dashboard/Profile/mutation.js | 9 ++ .../src/components/Dashboard/Profile/query.js | 26 ++++ .../Dashboard/SidePane/Header/index.js | 32 ++-- .../Dashboard/SidePane/Header/query.js | 14 ++ client/src/components/Dashboard/index.js | 27 +--- .../Dashboard/query.js} | 4 +- .../src/components/LandingPage/Form/index.js | 11 +- .../components/LandingPage/Form/inputField.js | 140 ++++++++++++++---- .../components/LandingPage/Form/mutation.js | 26 ++++ client/src/mutations/userAuth.js | 27 ---- 28 files changed, 440 insertions(+), 263 deletions(-) delete mode 100644 client/src/components/Dashboard/DashboardView/mutation.js rename client/src/components/Dashboard/DashboardView/{queries.js => query.js} (92%) create mode 100644 client/src/components/Dashboard/Find/query.js create mode 100644 client/src/components/Dashboard/Messages/mutation.js create mode 100644 client/src/components/Dashboard/Messages/query.js create mode 100644 client/src/components/Dashboard/Profile/mutation.js create mode 100644 client/src/components/Dashboard/Profile/query.js create mode 100644 client/src/components/Dashboard/SidePane/Header/query.js rename client/src/{queries/fetchUser.js => components/Dashboard/query.js} (64%) create mode 100644 client/src/components/LandingPage/Form/mutation.js delete mode 100644 client/src/mutations/userAuth.js diff --git a/client/src/components/Dashboard/DashboardView/DashProfile.js b/client/src/components/Dashboard/DashboardView/DashProfile.js index c3feb7e..80096dd 100644 --- a/client/src/components/Dashboard/DashboardView/DashProfile.js +++ b/client/src/components/Dashboard/DashboardView/DashProfile.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Query } from 'react-apollo'; import InfoBox from '../styled_components/InfoBox'; -import { profileQuery } from './queries'; +import { profileQuery } from './query'; // import { Bar } from 'react-chartjs'; // import { CardSkills } from '../Find/Find'; diff --git a/client/src/components/Dashboard/DashboardView/Dashboard.js b/client/src/components/Dashboard/DashboardView/Dashboard.js index b3a79a6..426972e 100644 --- a/client/src/components/Dashboard/DashboardView/Dashboard.js +++ b/client/src/components/Dashboard/DashboardView/Dashboard.js @@ -1,8 +1,8 @@ import React from 'react'; import ActivityGraph from './ActivityGraph'; -import MessagesTable from '../../../containers/MessageTable'; -import InfoBoxes from '../../../containers/InfoBoxes'; -import DashProfile from '../../../containers/DashProfile'; +import MessagesTable from './MessageTable'; +import InfoBoxes from './InfoBoxes'; +import DashProfile from './DashProfile'; const StatsBoxes = () => ( <div className="stats-boxes"> diff --git a/client/src/components/Dashboard/DashboardView/InfoBoxes.js b/client/src/components/Dashboard/DashboardView/InfoBoxes.js index 782b48a..7fcfca2 100644 --- a/client/src/components/Dashboard/DashboardView/InfoBoxes.js +++ b/client/src/components/Dashboard/DashboardView/InfoBoxes.js @@ -1,6 +1,8 @@ import React from 'react'; import shortid from 'short-id'; +import { Query } from 'react-apollo'; import PropTypes from 'prop-types'; +import { getMessages } from './query'; import InfoBox from '../styled_components/InfoBox'; import Title from '../styled_components/Title'; import Bar from '../styled_components/Bar'; @@ -13,44 +15,33 @@ export const ProgressBar = ({ width }) => ( </div> ); -const InfoBoxes = ({ messages }) => ( - <div className="info-boxes"> - {BOX_INFO.map(box => ( - <InfoBox size={400} key={shortid.generate()}> - <div id="box-icon">{box.icon}</div> - <Title title>{box.value} - {box.name} - +const InfoBoxes = () => ( + + {({data}) => ( + data.messages ?
+ {BOX_INFO.map(box => ( + +
{box.icon}
+ {box.value} + {box.name} + +
+ ))} + +
+ +
+ {data.messages.length} + Unread Messages +
- ))} - -
- -
- {Object.keys(messages).length} - Unread Messages - -
-
+
:
+ )} + ); ProgressBar.propTypes = { width: PropTypes.number.isRequired, }; -InfoBoxes.propTypes = { - messages: PropTypes.arrayOf( - PropTypes.shape({ - author: PropTypes.shape({ - firstName: PropTypes.string.isRequired, - lastName: PropTypes.string.isRequired, - img: PropTypes.string.isRequired, - date: PropTypes.string.isRequired, - }), - body: PropTypes.string.isRequired, - __v: PropTypes.number, - }) - ).isRequired, -}; - export default InfoBoxes; diff --git a/client/src/components/Dashboard/DashboardView/MessageTable.js b/client/src/components/Dashboard/DashboardView/MessageTable.js index cf73d71..609183c 100644 --- a/client/src/components/Dashboard/DashboardView/MessageTable.js +++ b/client/src/components/Dashboard/DashboardView/MessageTable.js @@ -3,7 +3,7 @@ import { Query } from 'react-apollo'; import moment from 'moment'; import shortid from 'short-id'; import PropTypes from 'prop-types'; -import { postsQuery } from './queries'; +import { postsQuery } from './query'; import InfoBox from '../styled_components/InfoBox'; import TextInput from './TextInput'; diff --git a/client/src/components/Dashboard/DashboardView/TextInput.js b/client/src/components/Dashboard/DashboardView/TextInput.js index 821add8..1f2b715 100644 --- a/client/src/components/Dashboard/DashboardView/TextInput.js +++ b/client/src/components/Dashboard/DashboardView/TextInput.js @@ -27,7 +27,7 @@ class TextInput extends Component { onChange={e => onPostChange('body', e)} value={body} /> - + )}
diff --git a/client/src/components/Dashboard/DashboardView/mutation.js b/client/src/components/Dashboard/DashboardView/mutation.js deleted file mode 100644 index e69de29..0000000 diff --git a/client/src/components/Dashboard/DashboardView/queries.js b/client/src/components/Dashboard/DashboardView/query.js similarity index 92% rename from client/src/components/Dashboard/DashboardView/queries.js rename to client/src/components/Dashboard/DashboardView/query.js index 97c9686..8e360cd 100644 --- a/client/src/components/Dashboard/DashboardView/queries.js +++ b/client/src/components/Dashboard/DashboardView/query.js @@ -14,7 +14,7 @@ export const profileQuery = gql` } `; -export const messagesQuery = gql` +export const getMessages = gql` { messages { id diff --git a/client/src/components/Dashboard/Find/Card.js b/client/src/components/Dashboard/Find/Card.js index 25ddb4c..feb6f6a 100644 --- a/client/src/components/Dashboard/Find/Card.js +++ b/client/src/components/Dashboard/Find/Card.js @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import axios from 'axios'; import PropTypes from 'prop-types'; import InfoBox from '../styled_components/InfoBox'; import { ProgressBar } from '../DashboardView/InfoBoxes'; @@ -47,16 +46,9 @@ class Card extends Component { this.setState({ active: view }); }; - onSubmit = values => { - const { user, currentUser, fetchMessages } = this.props; - axios.post('/api/add_message', { values, user, currentUser }); - fetchMessages(); - }; - render() { const { user, i } = this.props; const { active } = this.state; - console.log('uuzehhh', user) return (
@@ -139,11 +131,6 @@ Card.propTypes = { lastName: PropTypes.string, __v: PropTypes.number, }).isRequired, - fetchMessages: PropTypes.func, -}; - -Card.defaultProps = { - fetchMessages: undefined, }; export default Card; diff --git a/client/src/components/Dashboard/Find/Find.js b/client/src/components/Dashboard/Find/Find.js index 65ba510..942e8c8 100644 --- a/client/src/components/Dashboard/Find/Find.js +++ b/client/src/components/Dashboard/Find/Find.js @@ -1,5 +1,7 @@ import React, { Component } from 'react'; +import { Query } from 'react-apollo'; import PropTypes from 'prop-types'; +import getAllUsers from './query'; import { Spinner } from '../../../assets/spinners'; import { ALL_USERS } from '../../../fake_backend/users'; import Card from './Card'; @@ -87,22 +89,28 @@ class Find extends Component { }; render() { - const { activeUsers, loaded } = this.state; + + + const { loaded } = this.state; const { currentUser } = this.props; return ( -
- {/* */} -
- {!loaded ? ( - - ) : ( - Object.values(activeUsers).map( - // eslint-disable-next-line comma-dangle - (user, i) => - ) - )} -
-
+ + {({data}) => ( +
+ {/* */} +
+ {!loaded ? ( + + ) : ( + data.users.map( + // eslint-disable-next-line comma-dangle + (user, i) => + ) + )} +
+
+ )} +
); } } diff --git a/client/src/components/Dashboard/Find/query.js b/client/src/components/Dashboard/Find/query.js new file mode 100644 index 0000000..35eca87 --- /dev/null +++ b/client/src/components/Dashboard/Find/query.js @@ -0,0 +1,22 @@ +import gql from 'graphql-tag'; + +export default gql` + { + users { + id + email + firstName + lastName + profile { + img + title + skills { + lang + value + } + level + description + } + } + } +`; diff --git a/client/src/components/Dashboard/Messages/MessageReply.js b/client/src/components/Dashboard/Messages/MessageReply.js index 91b2c2f..0dade54 100644 --- a/client/src/components/Dashboard/Messages/MessageReply.js +++ b/client/src/components/Dashboard/Messages/MessageReply.js @@ -23,7 +23,7 @@ class MessageReply extends Component {
{ e.preventDefault(); - createMessage({ variables: { id: message.recipientId, message }}) + createMessage({ variables: { id: message.recipientUserId, message: messageInput }}) }}>
diff --git a/client/src/components/Dashboard/Messages/Messages.js b/client/src/components/Dashboard/Messages/Messages.js index 4f87475..5f70a20 100644 --- a/client/src/components/Dashboard/Messages/Messages.js +++ b/client/src/components/Dashboard/Messages/Messages.js @@ -1,7 +1,8 @@ import React, { Component } from 'react'; -import axios from 'axios'; +import { Query } from 'react-apollo'; import moment from 'moment'; import PropTypes from 'prop-types'; +import getMessages from './query'; import MessageReply from './MessageReply'; const MessageContext = React.createContext('no default'); @@ -19,9 +20,6 @@ export const MessageConsumer = props => ( ); -// TODO: Seems like this is part of a bigger issue not yet resolved: -// https://github.com/eslint/eslint/issues/9259 -// eslint-disable-next-line const Message = ({ msg, toggle, i, activeMessage }) => (
toggle(i)} className={`message active-${i === activeMessage}`}>
@@ -66,41 +64,29 @@ class AllMessages extends Component { this.setState({ activeMessage: val }); }; - onSubmit = values => { - const { messages, currentUser } = this.props; - const { activeMessage } = this.state; - const user = Object.values(messages)[activeMessage].author; - axios.post('/api/add_message', { values, user, currentUser }); - }; - render() { - const { messages } = this.props; const { activeMessage } = this.state; return ( -
- - - {messages.length && } - -
+ + {({data}) => { + const { messages } = data; + return messages ? ( +
+ + + {messages.length && } + +
+ ) : null + }} +
); } } AllMessages.propTypes = { - messages: PropTypes.arrayOf( - PropTypes.shape({ - author: PropTypes.shape({ - firstName: PropTypes.string.isRequired, - lastName: PropTypes.string.isRequired, - img: PropTypes.string.isRequired, - }).isRequired, - body: PropTypes.string.isRequired, - // eslint-disable-next-line comma-dangle - }) - ).isRequired, currentUser: PropTypes.shape({ profile: PropTypes.shape({ userName: PropTypes.string.isRequired, diff --git a/client/src/components/Dashboard/Messages/mutation.js b/client/src/components/Dashboard/Messages/mutation.js new file mode 100644 index 0000000..f4dac4d --- /dev/null +++ b/client/src/components/Dashboard/Messages/mutation.js @@ -0,0 +1,10 @@ +import gql from 'graphql-tag'; + +export default gql` + mutation CreateMessage($id: String, $message: String) { + createMessage(id: $id, message: $message) { + id + } + } +`; + diff --git a/client/src/components/Dashboard/Messages/query.js b/client/src/components/Dashboard/Messages/query.js new file mode 100644 index 0000000..b721698 --- /dev/null +++ b/client/src/components/Dashboard/Messages/query.js @@ -0,0 +1,18 @@ +import gql from 'graphql-tag'; + +export default gql` + { + messages { + author { + id + firstName + lastName + profile { + img + } + } + recipientUserId + body + } + } +`; diff --git a/client/src/components/Dashboard/Profile/Profile.js b/client/src/components/Dashboard/Profile/Profile.js index 54eef1f..c57b50a 100644 --- a/client/src/components/Dashboard/Profile/Profile.js +++ b/client/src/components/Dashboard/Profile/Profile.js @@ -1,7 +1,8 @@ import React from 'react'; -import axios from 'axios'; +import { Query } from 'react-apollo'; import PropTypes from 'prop-types'; import ProfileInfo from './ProfileInfo'; +import getUserProfile from './query'; class UserProfile extends React.Component { constructor() { @@ -13,34 +14,34 @@ class UserProfile extends React.Component { }; } - handleSubmit = async values => { - this.setState({ request: true }); - const { currentUser } = this.props; - const res = await axios.post('/api/update_user', { currentUser, values }); - this.setState({ - success: res.status === 200, - loaded: true, - }); - }; + // handleSubmit = async values => { + // this.setState({ request: true }); + // const { currentUser } = this.props; + // const res = await axios.post('/api/update_user', { currentUser, values }); + // this.setState({ + // success: res.status === 200, + // loaded: true, + // }); + // }; render() { const reqData = { ...this.state }; - const { currentUser } = this.props; + // const { currentUser } = this.props; return ( - currentUser && ( -
-
- + + {({data}) => ( + data.user ? ( +
+
+ +
-
- ) + ) :
+ )} + ); } } diff --git a/client/src/components/Dashboard/Profile/ProfileInfo.js b/client/src/components/Dashboard/Profile/ProfileInfo.js index 97998f9..7890f3f 100644 --- a/client/src/components/Dashboard/Profile/ProfileInfo.js +++ b/client/src/components/Dashboard/Profile/ProfileInfo.js @@ -1,10 +1,11 @@ /* eslint-disable no-nested-ternary */ -import React from 'react'; -import { reduxForm, Field } from 'redux-form'; +import React, { Component } from 'react'; +import { Mutation } from 'react-apollo'; import shortid from 'short-id'; import PropTypes from 'prop-types'; import Skills from './Skills'; import { Spinner, Success } from '../../../assets/spinners'; +import UpdateUser from './mutation'; const selectOpts = ['Male', 'Female', 'Other']; const lower = x => x.toLowerCase(); @@ -44,9 +45,9 @@ const ProfileInputField = ({ field, currentUser }) => ( {field}
{field === 'description' ? ( - + ) : field === 'gender' ? ( - + ) : ( - + )}
@@ -73,31 +74,70 @@ const ProfileInputFields = ({ currentUser, profile = false }) => { ); }; -const ProfileInfoForm = ({ info, handleSubmit, reqData }) => - // console.log('profile info form props', props); - info && ( - -
-
- {info.firstName} - image URL - -
-
-
- - -
-
-
- -
- -
- - ); +export default class ProfileInfo extends Component { + state = { + // eslint-disable-next-line react/no-unused-state + email: '', + // eslint-disable-next-line react/no-unused-state + password: '', + // eslint-disable-next-line react/no-unused-state + firstName: '', + // eslint-disable-next-line react/no-unused-state + lastName: '', + // eslint-disable-next-line react/no-unused-state + gender: null, + } + + handleInput = (key, e) => this.setState({ [key]: e.target.value }); + + render() { + const { reqData, user } = this.props; + // eslint-disable-next-line no-unused-vars + const { email, password, firstName, lastName, gender } = this.state; + return user ? ( + + {updateUser => ( +
{ + e.preventDefault(); + updateUser({ variables: this.state }); + }} + className="profile-user-info-wrapper" + > +
+
+ {user.firstName} + image URL + +
+
+
+ + +
+
+
+ +
+ +
+ + )} +
+ ) : null; + } +} + +ProfileInfo.propTypes = { + reqData: PropTypes.bool.isRequired, + user: PropTypes.shape.isRequired, +} RequestMessage.propTypes = { req: PropTypes.bool.isRequired, @@ -109,7 +149,3 @@ ProfileInputField.propTypes = { field: PropTypes.string.isRequired, currentUser: PropTypes.string.isRequired, }; - -export default reduxForm({ - form: 'userUpdate', -})(ProfileInfoForm); diff --git a/client/src/components/Dashboard/Profile/Skills.js b/client/src/components/Dashboard/Profile/Skills.js index f11a613..55d61fc 100644 --- a/client/src/components/Dashboard/Profile/Skills.js +++ b/client/src/components/Dashboard/Profile/Skills.js @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import { Field } from 'redux-form'; import shortid from 'short-id'; import PropTypes from 'prop-types'; @@ -21,7 +20,7 @@ class Skill extends Component { const { width } = this.state; return (
- + - this.updateWidth(e)} placeholder={skill.value} type="number" diff --git a/client/src/components/Dashboard/Profile/formInfo.js b/client/src/components/Dashboard/Profile/formInfo.js index 588071a..9afd02f 100644 --- a/client/src/components/Dashboard/Profile/formInfo.js +++ b/client/src/components/Dashboard/Profile/formInfo.js @@ -1,3 +1 @@ -const USED_LANGUAGES = ['HTML', 'CSS', 'JavaScript', 'Ruby', 'Java', 'Python', 'C', 'C++', 'C#']; - -export default USED_LANGUAGES; +export default ['HTML', 'CSS', 'JavaScript', 'Ruby', 'Java', 'Python', 'C', 'C++', 'C#']; diff --git a/client/src/components/Dashboard/Profile/mutation.js b/client/src/components/Dashboard/Profile/mutation.js new file mode 100644 index 0000000..fa8ca4e --- /dev/null +++ b/client/src/components/Dashboard/Profile/mutation.js @@ -0,0 +1,9 @@ +import gql from 'graphql-tag'; + +export default gql` + mutation UpdateUser($email: String, $password: String, $firstName: String, $lastName: String) { + updateUser(email: $email, password: $password, firstName: $firstName, lastName: $lastName) { + id + } + } +`; diff --git a/client/src/components/Dashboard/Profile/query.js b/client/src/components/Dashboard/Profile/query.js new file mode 100644 index 0000000..0b3676c --- /dev/null +++ b/client/src/components/Dashboard/Profile/query.js @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +export default gql` + { + user { + id + email + firstName + lastName + gender + profile { + userName + img + title + skills { + lang + value + } + level + description + complete + } + } + } +`; + diff --git a/client/src/components/Dashboard/SidePane/Header/index.js b/client/src/components/Dashboard/SidePane/Header/index.js index b921ad0..a35d76a 100644 --- a/client/src/components/Dashboard/SidePane/Header/index.js +++ b/client/src/components/Dashboard/SidePane/Header/index.js @@ -1,16 +1,22 @@ import React from 'react'; +import { Query } from 'react-apollo'; +import getUser from './query'; -const DashHeaderContent = ({ currentUser }) => - currentUser !== undefined && ( -
-

CodeBuddy

-
-
- +export default () => ( + + {({data}) => { + const { user } = data; + return data ? ( +
+

CodeBuddy

+
+
+ +
+ +
- -
-
- ); - -export default DashHeaderContent; + ) :
+ }} + +); diff --git a/client/src/components/Dashboard/SidePane/Header/query.js b/client/src/components/Dashboard/SidePane/Header/query.js new file mode 100644 index 0000000..9af6ee1 --- /dev/null +++ b/client/src/components/Dashboard/SidePane/Header/query.js @@ -0,0 +1,14 @@ +import gql from 'graphql-tag'; + +export default gql` + { + user { + id + firstName + profile { + img + } + } + } +`; + diff --git a/client/src/components/Dashboard/index.js b/client/src/components/Dashboard/index.js index e150882..a8a313f 100644 --- a/client/src/components/Dashboard/index.js +++ b/client/src/components/Dashboard/index.js @@ -2,12 +2,11 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import SidePane from './SidePane'; -import DashHeader from '../../containers/DashHeader'; -import Find from '../../containers/Find'; -import Profile from '../../containers/Profile'; +import DashHeader from './SidePane/Header'; +import Find from './Find/Find'; +import Profile from './Profile/Profile'; import DashboardView from './DashboardView/Dashboard'; -import Messages from '../../containers/Messages'; -// import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; +import Messages from './Messages/Messages'; const View = ({ children }) => ( // console.log('children', children); @@ -22,14 +21,6 @@ class Dashboard extends Component { }; } - componentDidMount() { - const { fetchUser, fetchPosts, fetchMessages, currentUser } = this.props; - // console.log('=====>', currentUser); - fetchUser(); - fetchPosts(); - fetchMessages(currentUser); - } - // eslint-disable-next-line consistent-return blockComponent = block => { switch (block) { @@ -51,6 +42,8 @@ class Dashboard extends Component { }; render() { + + // eslint-disable-next-line react/destructuring-assignment const { name } = this.props.match.params; return ( @@ -59,18 +52,14 @@ class Dashboard extends Component {
{this.blockComponent(name)} -
-
+
+
); } } Dashboard.propTypes = { match: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types - fetchUser: PropTypes.func.isRequired, - fetchPosts: PropTypes.func.isRequired, - fetchMessages: PropTypes.func.isRequired, - currentUser: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types }; View.propTypes = { diff --git a/client/src/queries/fetchUser.js b/client/src/components/Dashboard/query.js similarity index 64% rename from client/src/queries/fetchUser.js rename to client/src/components/Dashboard/query.js index 157efe3..28c0505 100644 --- a/client/src/queries/fetchUser.js +++ b/client/src/components/Dashboard/query.js @@ -2,8 +2,10 @@ import gql from 'graphql-tag'; export default gql` { - users { + user { id + firstName + lastName } } `; diff --git a/client/src/components/LandingPage/Form/index.js b/client/src/components/LandingPage/Form/index.js index c852cfd..a6f3a14 100644 --- a/client/src/components/LandingPage/Form/index.js +++ b/client/src/components/LandingPage/Form/index.js @@ -1,7 +1,6 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import axios from 'axios'; import ParticleWrapper from '../Particles'; import Title from '../App/title'; import InputFields from './inputField'; @@ -23,14 +22,6 @@ class AuthForm extends Component { changeActiveBtn = value => this.setState({ activeBtn: value }); - handleSubmit = values => { - const { activeBtn } = this.state; - const userauth = activeBtn === 'login' ? 'login' : 'signup'; - axios - .post(`/api/${userauth}`, values) - .then(() => this.props.history.push('/dashboard/dashboard')); //eslint-disable-line - }; - render() { const { activeBtn } = this.state; return ( @@ -38,7 +29,7 @@ class AuthForm extends Component {
- +
diff --git a/client/src/components/LandingPage/Form/inputField.js b/client/src/components/LandingPage/Form/inputField.js index 3252354..e976d8d 100644 --- a/client/src/components/LandingPage/Form/inputField.js +++ b/client/src/components/LandingPage/Form/inputField.js @@ -1,48 +1,134 @@ import React, { Component } from 'react'; -import shortid from 'short-id'; +// import shortid from 'short-id'; +import { Mutation } from 'react-apollo'; import PropTypes from 'prop-types'; -import { reduxForm, Field } from 'redux-form'; +// import { reduxForm, Field } from 'redux-form'; import { LOGIN_FIELDS, SIGNUP_FIELDS } from './formFields'; +import { loginMutation, signupMutation } from './mutation'; + +const LoginFields = ({ animate, handleChange, ...props }) => { + const { password, email } = props; + + return ( + + {(login, { error })=> ( +
{ + e.preventDefault(); + login({ variables: { email, password } }) + .then(() => { + window.location.href = 'http://localhost:3000/dashboard/dashboard' + }); + }}> + {LOGIN_FIELDS.map((field, index) => ( + handleChange(field.placeholder.toLowerCase(), e)} + // eslint-disable-next-line react/no-array-index-key + key={`${field.type}-${index}`} + // eslint-disable-next-line react/destructuring-assignment + value={props[field.placeholder.toLowerCase()]} + type={field.type} + component="input" + placeholder={field.placeholder} + className={`input-lg-${index + 1} animate-${animate}`} + /> + ))} + + {error && {error}} +
+ )} +
+ ); +}; + +const SignupFields = ({ animate, handleChange, ...props }) => { + const { password, email, firstName, lastName } = props; + return ( + + {(signup, { error })=> ( +
{ + e.preventDefault(); + signup({ variables: { email, password, firstName, lastName } }) + .then(() => this.props.history.push('/dashboard/dashboard')) + }}> + {SIGNUP_FIELDS.map((field, index) => ( + handleChange(field.placeholder.toLowerCase(), e)} + // eslint-disable-next-line react/no-array-index-key + key={`${field.type}-${index}`} + // eslint-disable-next-line react/destructuring-assignment + value={props[field.placeholder.toLowerCase()]} + type={field.type} + component="input" + placeholder={field.placeholder} + className={`input-su-${index + 1} animate-${animate}`} + /> + ))} + + {error && {error}} +
+ )} +
+ ); +}; class InputFields extends Component { - state = { animate: false }; + state = { + // eslint-disable-next-line react/no-unused-state + email: '', + // eslint-disable-next-line react/no-unused-state + password: '', + firstName: '', + lastName: '', + animate: false, + }; componentDidMount() { this.setState({ animate: true }); setTimeout(() => this.setState({ animate: false }), 2000); } - render() { - const { handleSubmit, activeBtn } = this.props; - const { animate } = this.state; - const fieldInfo = - activeBtn === 'login' - ? { type: LOGIN_FIELDS, class: 'lg' } - : { type: SIGNUP_FIELDS, class: 'su' }; + handleChange = ( key, e) => { + this.setState({ [key]: e.target.value }); + } + render() { + const { activeBtn } = this.props; + // eslint-disable-next-line no-unused-vars + const { animate, email, password, firstName, lastName } = this.state; + const ActiveField = activeBtn === 'login' ? LoginFields : SignupFields; return ( -
- {fieldInfo.type.map((field, index) => ( - - ))} - - + ); } } +LoginFields.propTypes = { + animate: PropTypes.bool.isRequired, + handleChange: PropTypes.func.isRequired, + email: PropTypes.string.isRequired, + password: PropTypes.string.isRequired, +} + +SignupFields.propTypes = { + animate: PropTypes.bool.isRequired, + handleChange: PropTypes.func.isRequired, + email: PropTypes.string.isRequired, + password: PropTypes.string.isRequired, + firstName: PropTypes.string.isRequired, + lastName: PropTypes.string.isRequired, +} + + InputFields.propTypes = { - handleSubmit: PropTypes.func.isRequired, + // handleSubmit: PropTypes.func.isRequired, activeBtn: PropTypes.string.isRequired, }; -export default reduxForm({ - form: 'userAuth', -})(InputFields); +export default InputFields; diff --git a/client/src/components/LandingPage/Form/mutation.js b/client/src/components/LandingPage/Form/mutation.js new file mode 100644 index 0000000..3ca2f06 --- /dev/null +++ b/client/src/components/LandingPage/Form/mutation.js @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +export const loginMutation = gql` + mutation Login($email: String!, $password: String!) { + login(email: $email, password: $password) { + id + } + } +`; + +export const logoutMutation = gql` + mutation Logout { + logout { + id + email + } + } +`; + +export const signupMutation = gql` + mutation Signup($email: String!, $password: String!, $firstName: String!, $lastName: String!) { + signup(email: $email, password: $password, firstName: $firstName, lastName: $lastName) { + id + } + } +`; diff --git a/client/src/mutations/userAuth.js b/client/src/mutations/userAuth.js deleted file mode 100644 index de40d3e..0000000 --- a/client/src/mutations/userAuth.js +++ /dev/null @@ -1,27 +0,0 @@ -import gql from 'graphql-tag'; - -export const login = gql` - mutation Login($email: String!, $password: String!) { - login(email: $email, password: $password) { - id - } - } -`; - -export const logout = gql` - mutation Logout { - logout { - id - email - } - } -`; - -export const signup = gql` - mutation Login($email: String!, $password: String!, $firstName: String!, $lastName: String!) { - login(email: $email, password: $password, firstName: $firstName, lastName: $lastName) { - id - } - } -`; - From 1811056ef53305d68694004c4717daefeef79294 Mon Sep 17 00:00:00 2001 From: Lydia Hallie Date: Tue, 18 Sep 2018 21:43:58 +0200 Subject: [PATCH 39/58] Remove Redux --- client/src/actions/index.js | 34 --------------------------- client/src/containers/DashHeader.js | 8 ------- client/src/containers/DashProfile.js | 9 ------- client/src/containers/Dashboard.js | 18 -------------- client/src/containers/Find.js | 16 ------------- client/src/containers/InfoBoxes.js | 8 ------- client/src/containers/MessageTable.js | 9 ------- client/src/containers/Messages.js | 9 ------- client/src/containers/Profile.js | 16 ------------- client/src/index.js | 31 +++++++++--------------- client/src/reducers/auth.js | 16 ------------- client/src/reducers/index.js | 12 ---------- client/src/reducers/messages.js | 21 ----------------- client/src/reducers/posts.js | 12 ---------- 14 files changed, 11 insertions(+), 208 deletions(-) delete mode 100644 client/src/actions/index.js delete mode 100644 client/src/containers/DashHeader.js delete mode 100644 client/src/containers/DashProfile.js delete mode 100644 client/src/containers/Dashboard.js delete mode 100644 client/src/containers/Find.js delete mode 100644 client/src/containers/InfoBoxes.js delete mode 100644 client/src/containers/MessageTable.js delete mode 100644 client/src/containers/Messages.js delete mode 100644 client/src/containers/Profile.js delete mode 100644 client/src/reducers/auth.js delete mode 100644 client/src/reducers/index.js delete mode 100644 client/src/reducers/messages.js delete mode 100644 client/src/reducers/posts.js diff --git a/client/src/actions/index.js b/client/src/actions/index.js deleted file mode 100644 index 655263f..0000000 --- a/client/src/actions/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import axios from 'axios'; -import { FETCH_USER, FETCH_POSTS, FETCH_MESSAGES } from '../constants/actionTypes'; -// import { POSTS } from '../fake_backend/posts'; -// import { CURRENT_USER } from '../fake_backend/users'; -// import { MESSAGES } from '../fake_backend/messages'; - -// // Using fake backend. -// export const fetchUser = async dispatch => { -// dispatch({ type: FETCH_USER, payload: CURRENT_USER }); -// } - -// export const fetchPosts = async dispatch => { -// dispatch({ type: FETCH_POSTS, payload: POSTS }); -// } - -// export const fetchMessages = async (dispatch, user) => { -// dispatch({ type: FETCH_MESSAGES, payload: MESSAGES }); -// } - -// Using real backend. -export const fetchUser = async dispatch => { - const res = await axios.get('/api/current_user'); - dispatch({ type: FETCH_USER, payload: res.data }); -}; - -export const fetchPosts = async dispatch => { - const res = await axios.get('/api/all_posts'); - dispatch({ type: FETCH_POSTS, payload: res.data }); -}; - -export const fetchMessages = async (dispatch, user) => { - const res = await axios.get('/api/messages', user); - dispatch({ type: FETCH_MESSAGES, payload: res.data }); -}; diff --git a/client/src/containers/DashHeader.js b/client/src/containers/DashHeader.js deleted file mode 100644 index 9ddfd54..0000000 --- a/client/src/containers/DashHeader.js +++ /dev/null @@ -1,8 +0,0 @@ -import { connect } from 'react-redux'; -import DashHeaderContent from '../components/Dashboard/SidePane/Header'; - -const mapStateToProps = state => ({ - currentUser: state.user, -}); - -export default connect(mapStateToProps)(DashHeaderContent); diff --git a/client/src/containers/DashProfile.js b/client/src/containers/DashProfile.js deleted file mode 100644 index 739acd7..0000000 --- a/client/src/containers/DashProfile.js +++ /dev/null @@ -1,9 +0,0 @@ -import { connect } from 'react-redux'; -import DashUserProfile from '../components/Dashboard/DashboardView/DashProfile'; - -const mapStateToProps = state => ({ - currentUser: state.user, - messages: state.messages, -}); - -export default connect(mapStateToProps)(DashUserProfile); diff --git a/client/src/containers/Dashboard.js b/client/src/containers/Dashboard.js deleted file mode 100644 index 56da6d6..0000000 --- a/client/src/containers/Dashboard.js +++ /dev/null @@ -1,18 +0,0 @@ -import { connect } from 'react-redux'; -import { fetchUser, fetchPosts, fetchMessages } from '../actions'; -import Dashboard from '../components/Dashboard'; - -const mapStateToProps = state => ({ - currentUser: state.user, -}); - -const mapDispatchToProps = dispatch => ({ - fetchUser: () => dispatch(fetchUser), - fetchPosts: () => dispatch(fetchPosts), - fetchMessages: () => dispatch(fetchMessages), -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(Dashboard); diff --git a/client/src/containers/Find.js b/client/src/containers/Find.js deleted file mode 100644 index 1cfc7ef..0000000 --- a/client/src/containers/Find.js +++ /dev/null @@ -1,16 +0,0 @@ -import { connect } from 'react-redux'; -import { fetchMessages } from '../actions'; -import Find from '../components/Dashboard/Find/Find'; - -const mapStateToProps = state => ({ - currentUser: state.user, -}); - -const mapDispatchToProps = dispatch => ({ - fetchMessages: () => dispatch(fetchMessages), -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(Find); diff --git a/client/src/containers/InfoBoxes.js b/client/src/containers/InfoBoxes.js deleted file mode 100644 index 37c74a3..0000000 --- a/client/src/containers/InfoBoxes.js +++ /dev/null @@ -1,8 +0,0 @@ -import { connect } from 'react-redux'; -import InfoBoxes from '../components/Dashboard/DashboardView/InfoBoxes'; - -const mapStateToProps = state => ({ - messages: state.messages, -}); - -export default connect(mapStateToProps)(InfoBoxes); diff --git a/client/src/containers/MessageTable.js b/client/src/containers/MessageTable.js deleted file mode 100644 index e92cd50..0000000 --- a/client/src/containers/MessageTable.js +++ /dev/null @@ -1,9 +0,0 @@ -import { connect } from 'react-redux'; -import MessagesTable from '../components/Dashboard/DashboardView/MessageTable'; - -const mapStateToProps = state => ({ - user: state.user, - posts: state.posts, -}); - -export default connect(mapStateToProps)(MessagesTable); diff --git a/client/src/containers/Messages.js b/client/src/containers/Messages.js deleted file mode 100644 index 160f0e9..0000000 --- a/client/src/containers/Messages.js +++ /dev/null @@ -1,9 +0,0 @@ -import { connect } from 'react-redux'; -import AllMessages from '../components/Dashboard/Messages/Messages'; - -const mapStateToProps = state => ({ - currentUser: state.user, - messages: state.messages, -}); - -export default connect(mapStateToProps)(AllMessages); diff --git a/client/src/containers/Profile.js b/client/src/containers/Profile.js deleted file mode 100644 index 842559b..0000000 --- a/client/src/containers/Profile.js +++ /dev/null @@ -1,16 +0,0 @@ -import { connect } from 'react-redux'; -import { fetchUser } from '../actions'; -import UserProfile from '../components/Dashboard/Profile/Profile'; - -const mapStateToProps = state => ({ - currentUser: state.user, -}); - -const mapDispatchToProps = dispatch => ({ - fetchUser: () => dispatch(fetchUser), -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(UserProfile); diff --git a/client/src/index.js b/client/src/index.js index e95739a..c73bc70 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -5,22 +5,15 @@ import { ApolloProvider } from 'react-apollo'; import { HttpLink } from 'apollo-link-http'; import { InMemoryCache } from 'apollo-cache-inmemory'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; -import { Provider } from 'react-redux'; -import { createStore, applyMiddleware } from 'redux'; -import thunk from 'redux-thunk'; -import { composeWithDevTools } from 'redux-devtools-extension'; -import reducers from './reducers'; + + import registerServiceWorker from './registerServiceWorker'; import App from './components/LandingPage/App'; -import Dashboard from './containers/Dashboard'; +import Dashboard from './components/Dashboard'; import './styles/main.sass'; -const store = createStore(reducers, composeWithDevTools(applyMiddleware(thunk))); - -export default store; - const httpLink = new HttpLink({ uri: 'http://localhost:5000/graphql', }) @@ -33,16 +26,14 @@ const client = new ApolloClient({ }); ReactDOM.render( - - - - - - - - - - , + + + + + + + + , document.getElementById('root') ); diff --git a/client/src/reducers/auth.js b/client/src/reducers/auth.js deleted file mode 100644 index e612e72..0000000 --- a/client/src/reducers/auth.js +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable */ - -import { LOGIN, REGISTER, LOGOUT, FETCH_USER } from '../constants/actionTypes.js'; - -export const authReducer = (state = {}, action) => { - console.log('payload', action.payload); - switch (action.type) { - case LOGIN: - case LOGOUT: - case REGISTER: - case FETCH_USER: - return (state.user = action.payload || false); - default: - return state; - } -}; diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js deleted file mode 100644 index 558948e..0000000 --- a/client/src/reducers/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import { combineReducers } from 'redux'; -import { reducer as formReducer } from 'redux-form'; -import { authReducer } from './auth'; -import { postsReducer } from './posts'; -import { messagesReducer } from './messages'; - -export default combineReducers({ - user: authReducer, - form: formReducer, - posts: postsReducer, - messages: messagesReducer, -}); diff --git a/client/src/reducers/messages.js b/client/src/reducers/messages.js deleted file mode 100644 index b5147d9..0000000 --- a/client/src/reducers/messages.js +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ - -import { - EXPAND_MESSAGE, - FETCH_MESSAGES, - SEND_MESSAGE, - DELETE_MESSAGE, -} from '../constants/actionTypes.js'; - -export const messagesReducer = (state = [], action) => { - switch (action.type) { - case EXPAND_MESSAGE: - case SEND_MESSAGE: - case DELETE_MESSAGE: - case FETCH_MESSAGES: - console.log('yepppp definitely messages!!!', action.payload); - return (state.messages = action.payload || false); - default: - return state; - } -}; diff --git a/client/src/reducers/posts.js b/client/src/reducers/posts.js deleted file mode 100644 index 66d3029..0000000 --- a/client/src/reducers/posts.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ - -import { FETCH_POSTS } from '../constants/actionTypes.js'; - -export const postsReducer = (state = {}, action) => { - switch (action.type) { - case FETCH_POSTS: - return (state.posts = action.payload || false); - default: - return state; - } -}; From 2d4abd44c22eb2efcd3f560b6b25377fe0aa7ebf Mon Sep 17 00:00:00 2001 From: Lydia Hallie Date: Thu, 20 Sep 2018 07:31:25 +0200 Subject: [PATCH 40/58] Add cors dependency --- package.json | 3 +++ server/package.json | 1 + 2 files changed, 4 insertions(+) diff --git a/package.json b/package.json index 1f39471..fa06da0 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "description": "", "main": "client/index.js", + "proxy": "http://localhost:5000", "scripts": { "start": "node index.js", "server": "nodemon server/server.js", @@ -16,6 +17,8 @@ "author": "", "license": "ISC", "dependencies": { + "apollo-cache-inmemory": "^1.2.10", + "apollo-link-http": "^1.5.5", "concurrently": "^3.5.1", "graphql": "^14.0.2", "graphql-tag": "^2.9.2", diff --git a/server/package.json b/server/package.json index a699b5c..ac7cfa8 100644 --- a/server/package.json +++ b/server/package.json @@ -3,6 +3,7 @@ "bcrypt": "^2.0.1", "body-parser": "1.18.2", "cookie-session": "^2.0.0-beta.3", + "cors": "^2.8.4", "express": "^4.16.3", "express-graphql": "^0.6.12", "graphql": "^14.0.2", From 800aca458480b88120ba1a16598c1429524baf62 Mon Sep 17 00:00:00 2001 From: Jay Evans Date: Thu, 20 Sep 2018 17:45:06 +0100 Subject: [PATCH 41/58] Fixed issue with header links moving around weirdly - by changing the hover from border to outline --- client/src/styles/LandingPage/_header.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/styles/LandingPage/_header.sass b/client/src/styles/LandingPage/_header.sass index 1c098b5..b973d77 100644 --- a/client/src/styles/LandingPage/_header.sass +++ b/client/src/styles/LandingPage/_header.sass @@ -28,7 +28,7 @@ $font1: 'Oxygen', sans-serif font-family: $font1 &:hover - border: 1px solid #00b496 + outline: 1px solid #00b496 background: none @media screen and (max-width: 700px) From 4ac9d4415fb95648938b5dea6e708e581ecff0aa Mon Sep 17 00:00:00 2001 From: Jay Evans Date: Thu, 20 Sep 2018 19:12:11 +0100 Subject: [PATCH 42/58] Fixed made the preview images responsive, and added zindex to the header so it does not appear behind other elements on the page --- client/src/styles/LandingPage/_header.sass | 1 + client/src/styles/LandingPage/_preview.sass | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client/src/styles/LandingPage/_header.sass b/client/src/styles/LandingPage/_header.sass index b973d77..a60784d 100644 --- a/client/src/styles/LandingPage/_header.sass +++ b/client/src/styles/LandingPage/_header.sass @@ -7,6 +7,7 @@ $font1: 'Oxygen', sans-serif padding: 1em background-color: #2a2a2a border-bottom: 2px solid #262626 + z-index: 999; h1 font-size: 25px diff --git a/client/src/styles/LandingPage/_preview.sass b/client/src/styles/LandingPage/_preview.sass index 86c55bd..6163bd1 100644 --- a/client/src/styles/LandingPage/_preview.sass +++ b/client/src/styles/LandingPage/_preview.sass @@ -1,15 +1,26 @@ -.preview-images +.preview-images +flex-justify(space-around) +@media only screen and (max-width: 900px) + .preview-images + width: 100%; + flex-direction: column; + + .image-wrapper + width: 100%; + + img + max-width: 400px; + .image-wrapper - padding: 30px + padding: 30px + flex-grow: 1; +flex-align(center) flex-direction: column transition: .3s ease-in-out - width: 25% img - width: 280px + width: 100% height: auto box-shadow: #211d1d 0px 0px 30px From b735b683f11f742d133a60ef02535f421dc74e51 Mon Sep 17 00:00:00 2001 From: Lydia Hallie Date: Sat, 3 Nov 2018 12:34:51 +0100 Subject: [PATCH 43/58] Fix signup --- client/package.json | 1 + .../src/components/LandingPage/Form/inputField.js | 15 ++++++++++----- client/yarn.lock | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/client/package.json b/client/package.json index 3e3bb62..6287de1 100644 --- a/client/package.json +++ b/client/package.json @@ -14,6 +14,7 @@ "babel-loader": "7.1.2", "babel-preset-react-app": "^3.1.1", "babel-runtime": "6.26.0", + "camelcase": "^5.0.0", "case-sensitive-paths-webpack-plugin": "2.1.1", "chalk": "1.1.3", "chart.js": "^1.1.1", diff --git a/client/src/components/LandingPage/Form/inputField.js b/client/src/components/LandingPage/Form/inputField.js index e976d8d..01c073c 100644 --- a/client/src/components/LandingPage/Form/inputField.js +++ b/client/src/components/LandingPage/Form/inputField.js @@ -2,6 +2,8 @@ import React, { Component } from 'react'; // import shortid from 'short-id'; import { Mutation } from 'react-apollo'; import PropTypes from 'prop-types'; +import camelCase from 'camelcase' +import { withRouter } from 'react-router-dom'; // import { reduxForm, Field } from 'redux-form'; import { LOGIN_FIELDS, SIGNUP_FIELDS } from './formFields'; import { loginMutation, signupMutation } from './mutation'; @@ -41,22 +43,22 @@ const LoginFields = ({ animate, handleChange, ...props }) => { }; const SignupFields = ({ animate, handleChange, ...props }) => { - const { password, email, firstName, lastName } = props; + const { password, email, firstName, lastName, history } = props; return ( {(signup, { error })=> (
{ e.preventDefault(); signup({ variables: { email, password, firstName, lastName } }) - .then(() => this.props.history.push('/dashboard/dashboard')) + .then(() => history.push('/dashboard/dashboard')) }}> {SIGNUP_FIELDS.map((field, index) => ( handleChange(field.placeholder.toLowerCase(), e)} + onChange={e => handleChange(camelCase(field.placeholder), e)} // eslint-disable-next-line react/no-array-index-key key={`${field.type}-${index}`} // eslint-disable-next-line react/destructuring-assignment - value={props[field.placeholder.toLowerCase()]} + value={props[camelCase(field.placeholder)]} type={field.type} component="input" placeholder={field.placeholder} @@ -71,6 +73,8 @@ const SignupFields = ({ animate, handleChange, ...props }) => { ); }; +const SignupFieldsWrapper = withRouter(SignupFields) + class InputFields extends Component { state = { // eslint-disable-next-line react/no-unused-state @@ -95,7 +99,7 @@ class InputFields extends Component { const { activeBtn } = this.props; // eslint-disable-next-line no-unused-vars const { animate, email, password, firstName, lastName } = this.state; - const ActiveField = activeBtn === 'login' ? LoginFields : SignupFields; + const ActiveField = activeBtn === 'login' ? LoginFields : SignupFieldsWrapper; return ( Date: Sun, 4 Nov 2018 14:53:14 +0100 Subject: [PATCH 44/58] Add Typescript client --- .../Dashboard/DashboardView/ActivityGraph.js | 14 - .../Dashboard/DashboardView/ActivityGraph.tsx | 27 + .../{DashProfile.js => DashProfile.tsx} | 25 +- .../{Dashboard.js => Dashboard.tsx} | 8 +- .../Dashboard/DashboardView/InfoBoxes.js | 47 -- .../Dashboard/DashboardView/InfoBoxes.tsx | 46 ++ .../{MessageTable.js => MessageTable.tsx} | 37 +- .../{TextInput.js => TextInput.tsx} | 25 +- .../DashboardView/{query.js => query.ts} | 0 .../Dashboard/DashboardView/types.d.ts | 2 + .../Dashboard/Find/{Card.js => Card.tsx} | 101 ++-- .../Find/{CardContact.js => CardContact.tsx} | 25 +- client/src/components/Dashboard/Find/Find.js | 140 ----- client/src/components/Dashboard/Find/Find.tsx | 86 +++ .../Find/{mutation.js => mutation.ts} | 0 .../Dashboard/Find/{query.js => query.ts} | 0 .../src/components/Dashboard/Find/types.d.ts | 20 + .../{MessageReply.js => MessageReply.tsx} | 40 +- .../Messages/{Messages.js => Messages.tsx} | 92 ++- .../Messages/{mutation.js => mutation.ts} | 0 .../Dashboard/Messages/{query.js => query.ts} | 0 .../components/Dashboard/Messages/types.d.ts | 8 + .../Profile/{Profile.js => Profile.tsx} | 42 +- .../{ProfileInfo.js => ProfileInfo.tsx} | 58 +- .../Profile/{Skills.js => Skills.ts} | 0 .../Profile/{formInfo.js => formInfo.ts} | 2 +- .../Profile/{mutation.js => mutation.ts} | 0 .../Dashboard/Profile/{query.js => query.ts} | 0 .../SidePane/Header/{index.js => index.tsx} | 17 +- .../SidePane/Header/{query.js => query.ts} | 0 .../SidePane/Menu/{index.js => index.tsx} | 21 +- .../Dashboard/SidePane/Menu/menuBtns.js | 11 - .../Dashboard/SidePane/Menu/menuBtns.tsx | 20 + .../Menu/{mutation.js => mutation.ts} | 0 .../SidePane/{index.js => index.tsx} | 5 +- .../Dashboard/{index.js => index.tsx} | 43 +- .../Dashboard/{query.js => query.ts} | 0 .../styled_components/{Bar.js => Bar.ts} | 0 .../Dashboard/styled_components/InfoBox.js | 16 - .../Dashboard/styled_components/InfoBox.tsx | 22 + .../Dashboard/styled_components/Title.js | 12 - .../Dashboard/styled_components/Title.tsx | 13 + .../styled_components/styled_components.tsx | 21 + .../Dashboard/styled_components/theme.ts | 69 +++ .../LandingPage/App/{index.js => index.tsx} | 14 +- .../LandingPage/App/{title.js => title.tsx} | 11 +- .../{footerContent.js => footerContent.ts} | 12 +- .../Footer/{index.js => index.tsx} | 6 +- .../Form/{formFields.js => formFields.tsx} | 16 +- .../LandingPage/Form/{index.js => index.tsx} | 40 +- .../Form/{inputField.js => inputField.tsx} | 65 +-- .../Form/{mutation.js => mutation.ts} | 0 .../Header/{index.js => index.tsx} | 27 +- .../LandingPage/Info/{index.js => index.tsx} | 0 .../Particles/{cubics.js => cubics.ts} | 0 .../Particles/{index.js => index.ts} | 1 - .../Preview/{index.js => index.tsx} | 8 +- .../{previewData.js => previewData.ts} | 11 +- client/src/constants/actionTypes.js | 24 - .../{dashboard_data.js => dashboard_data.tsx} | 39 +- client/src/index.js | 4 +- package-lock.json | 30 + package.json | 10 +- tsconfig.json | 31 + tsconfig.prod.json | 3 + tsconfig.test.json | 6 + tslint.json | 10 + yarn.lock | 548 ++++++++++-------- 68 files changed, 1167 insertions(+), 864 deletions(-) delete mode 100644 client/src/components/Dashboard/DashboardView/ActivityGraph.js create mode 100644 client/src/components/Dashboard/DashboardView/ActivityGraph.tsx rename client/src/components/Dashboard/DashboardView/{DashProfile.js => DashProfile.tsx} (79%) rename client/src/components/Dashboard/DashboardView/{Dashboard.js => Dashboard.tsx} (77%) delete mode 100644 client/src/components/Dashboard/DashboardView/InfoBoxes.js create mode 100644 client/src/components/Dashboard/DashboardView/InfoBoxes.tsx rename client/src/components/Dashboard/DashboardView/{MessageTable.js => MessageTable.tsx} (70%) rename client/src/components/Dashboard/DashboardView/{TextInput.js => TextInput.tsx} (75%) rename client/src/components/Dashboard/DashboardView/{query.js => query.ts} (100%) create mode 100644 client/src/components/Dashboard/DashboardView/types.d.ts rename client/src/components/Dashboard/Find/{Card.js => Card.tsx} (51%) rename client/src/components/Dashboard/Find/{CardContact.js => CardContact.tsx} (72%) delete mode 100644 client/src/components/Dashboard/Find/Find.js create mode 100644 client/src/components/Dashboard/Find/Find.tsx rename client/src/components/Dashboard/Find/{mutation.js => mutation.ts} (100%) rename client/src/components/Dashboard/Find/{query.js => query.ts} (100%) create mode 100644 client/src/components/Dashboard/Find/types.d.ts rename client/src/components/Dashboard/Messages/{MessageReply.js => MessageReply.tsx} (65%) rename client/src/components/Dashboard/Messages/{Messages.js => Messages.tsx} (51%) rename client/src/components/Dashboard/Messages/{mutation.js => mutation.ts} (100%) rename client/src/components/Dashboard/Messages/{query.js => query.ts} (100%) create mode 100644 client/src/components/Dashboard/Messages/types.d.ts rename client/src/components/Dashboard/Profile/{Profile.js => Profile.tsx} (56%) rename client/src/components/Dashboard/Profile/{ProfileInfo.js => ProfileInfo.tsx} (77%) rename client/src/components/Dashboard/Profile/{Skills.js => Skills.ts} (100%) rename client/src/components/Dashboard/Profile/{formInfo.js => formInfo.ts} (62%) rename client/src/components/Dashboard/Profile/{mutation.js => mutation.ts} (100%) rename client/src/components/Dashboard/Profile/{query.js => query.ts} (100%) rename client/src/components/Dashboard/SidePane/Header/{index.js => index.tsx} (67%) rename client/src/components/Dashboard/SidePane/Header/{query.js => query.ts} (100%) rename client/src/components/Dashboard/SidePane/Menu/{index.js => index.tsx} (72%) delete mode 100644 client/src/components/Dashboard/SidePane/Menu/menuBtns.js create mode 100644 client/src/components/Dashboard/SidePane/Menu/menuBtns.tsx rename client/src/components/Dashboard/SidePane/Menu/{mutation.js => mutation.ts} (100%) rename client/src/components/Dashboard/SidePane/{index.js => index.tsx} (51%) rename client/src/components/Dashboard/{index.js => index.tsx} (66%) rename client/src/components/Dashboard/{query.js => query.ts} (100%) rename client/src/components/Dashboard/styled_components/{Bar.js => Bar.ts} (100%) delete mode 100644 client/src/components/Dashboard/styled_components/InfoBox.js create mode 100644 client/src/components/Dashboard/styled_components/InfoBox.tsx delete mode 100644 client/src/components/Dashboard/styled_components/Title.js create mode 100644 client/src/components/Dashboard/styled_components/Title.tsx create mode 100644 client/src/components/Dashboard/styled_components/styled_components.tsx create mode 100644 client/src/components/Dashboard/styled_components/theme.ts rename client/src/components/LandingPage/App/{index.js => index.tsx} (64%) rename client/src/components/LandingPage/App/{title.js => title.tsx} (66%) rename client/src/components/LandingPage/Footer/{footerContent.js => footerContent.ts} (71%) rename client/src/components/LandingPage/Footer/{index.js => index.tsx} (77%) rename client/src/components/LandingPage/Form/{formFields.js => formFields.tsx} (67%) rename client/src/components/LandingPage/Form/{index.js => index.tsx} (61%) rename client/src/components/LandingPage/Form/{inputField.js => inputField.tsx} (76%) rename client/src/components/LandingPage/Form/{mutation.js => mutation.ts} (100%) rename client/src/components/LandingPage/Header/{index.js => index.tsx} (76%) rename client/src/components/LandingPage/Info/{index.js => index.tsx} (100%) rename client/src/components/LandingPage/Particles/{cubics.js => cubics.ts} (100%) rename client/src/components/LandingPage/Particles/{index.js => index.ts} (98%) rename client/src/components/LandingPage/Preview/{index.js => index.tsx} (68%) rename client/src/components/LandingPage/Preview/{previewData.js => previewData.ts} (83%) delete mode 100644 client/src/constants/actionTypes.js rename client/src/data/{dashboard_data.js => dashboard_data.tsx} (82%) create mode 100644 package-lock.json create mode 100644 tsconfig.json create mode 100644 tsconfig.prod.json create mode 100644 tsconfig.test.json create mode 100644 tslint.json diff --git a/client/src/components/Dashboard/DashboardView/ActivityGraph.js b/client/src/components/Dashboard/DashboardView/ActivityGraph.js deleted file mode 100644 index f12f2ad..0000000 --- a/client/src/components/Dashboard/DashboardView/ActivityGraph.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import { Line } from 'react-chartjs'; -import InfoBox from '../styled_components/InfoBox'; -import { CHART_DATA } from '../../../data/dashboard_data'; - -const ActivityGraph = () => ( - -

Activity

-
- - -); - -export default ActivityGraph; diff --git a/client/src/components/Dashboard/DashboardView/ActivityGraph.tsx b/client/src/components/Dashboard/DashboardView/ActivityGraph.tsx new file mode 100644 index 0000000..1d24745 --- /dev/null +++ b/client/src/components/Dashboard/DashboardView/ActivityGraph.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import styled from 'styled-components'; +import { Line } from 'react-chartjs'; +import { CHART_DATA } from '../../../data/dashboard_data'; + +export default () => ( + +

Activity

+
+ + +) as JSX.Element + +const InfoBox = (styled.div as any)` + display: ${props => (props.none ? 'block' : 'flex')}; + justify-content: ${props => (props.nojustify ? 'none' : 'center')}; + flex-direction: column; + + height: ${props => (props.height ? props.height : props.size * 0.45)}px; + width: ${props => props.size}px; + margin: ${props => (props.margin ? '20px 20px' : '0px 20px')}; + padding: 20px; + + color: white; + background: linear-gradient(#464646, #3e3e3e); + border: 1px solid rgba(255, 255, 255, 0.1); +`; diff --git a/client/src/components/Dashboard/DashboardView/DashProfile.js b/client/src/components/Dashboard/DashboardView/DashProfile.tsx similarity index 79% rename from client/src/components/Dashboard/DashboardView/DashProfile.js rename to client/src/components/Dashboard/DashboardView/DashProfile.tsx index 80096dd..6872f35 100644 --- a/client/src/components/Dashboard/DashboardView/DashProfile.js +++ b/client/src/components/Dashboard/DashboardView/DashProfile.tsx @@ -1,12 +1,17 @@ -import React from 'react'; -import PropTypes from 'prop-types'; +import * as React from 'react'; import { Query } from 'react-apollo'; -import InfoBox from '../styled_components/InfoBox'; import { profileQuery } from './query'; +import InfoBox from '../styled_components/InfoBox' // import { Bar } from 'react-chartjs'; // import { CardSkills } from '../Find/Find'; -const StatsInfo = ({ val, name, line }) => ( +interface StatsInfoProps { + val: number + name: string + line: boolean +} + +const StatsInfo = ({ val, name, line }: StatsInfoProps): JSX.Element => (
{val} {name} @@ -15,7 +20,7 @@ const StatsInfo = ({ val, name, line }) => ( ); -const DashUserProfile = () => ( +const DashUserProfile = (): JSX.Element => ( {({data}) => { const { user } = data; @@ -46,14 +51,4 @@ const DashUserProfile = () => ( ); -StatsInfo.propTypes = { - val: PropTypes.number.isRequired, - name: PropTypes.string.isRequired, - line: PropTypes.bool, -}; - -StatsInfo.defaultProps = { - line: false, -}; - export default DashUserProfile; diff --git a/client/src/components/Dashboard/DashboardView/Dashboard.js b/client/src/components/Dashboard/DashboardView/Dashboard.tsx similarity index 77% rename from client/src/components/Dashboard/DashboardView/Dashboard.js rename to client/src/components/Dashboard/DashboardView/Dashboard.tsx index 426972e..131af28 100644 --- a/client/src/components/Dashboard/DashboardView/Dashboard.js +++ b/client/src/components/Dashboard/DashboardView/Dashboard.tsx @@ -1,10 +1,10 @@ -import React from 'react'; +import * as React from 'react'; import ActivityGraph from './ActivityGraph'; import MessagesTable from './MessageTable'; import InfoBoxes from './InfoBoxes'; import DashProfile from './DashProfile'; -const StatsBoxes = () => ( +const StatsBoxes = (): JSX.Element => (
@@ -14,11 +14,9 @@ const StatsBoxes = () => (
); -const DashboardView = () => ( +export default (): JSX.Element => (
); - -export default DashboardView; diff --git a/client/src/components/Dashboard/DashboardView/InfoBoxes.js b/client/src/components/Dashboard/DashboardView/InfoBoxes.js deleted file mode 100644 index 7fcfca2..0000000 --- a/client/src/components/Dashboard/DashboardView/InfoBoxes.js +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import shortid from 'short-id'; -import { Query } from 'react-apollo'; -import PropTypes from 'prop-types'; -import { getMessages } from './query'; -import InfoBox from '../styled_components/InfoBox'; -import Title from '../styled_components/Title'; -import Bar from '../styled_components/Bar'; -import { BOX_INFO } from '../../../data/dashboard_data'; -import { MessagesIcon } from '../../../assets/icons'; - -export const ProgressBar = ({ width }) => ( -
- -
-); - -const InfoBoxes = () => ( - - {({data}) => ( - data.messages ?
- {BOX_INFO.map(box => ( - -
{box.icon}
- {box.value} - {box.name} - -
- ))} - -
- -
- {data.messages.length} - Unread Messages - -
-
:
- )} - -); - -ProgressBar.propTypes = { - width: PropTypes.number.isRequired, -}; - -export default InfoBoxes; diff --git a/client/src/components/Dashboard/DashboardView/InfoBoxes.tsx b/client/src/components/Dashboard/DashboardView/InfoBoxes.tsx new file mode 100644 index 0000000..c756e69 --- /dev/null +++ b/client/src/components/Dashboard/DashboardView/InfoBoxes.tsx @@ -0,0 +1,46 @@ +import * as React from 'react'; +import shortid from 'short-id'; +import { Query } from 'react-apollo'; +import { getMessages } from './query'; +import InfoBox from '../styled_components/InfoBox'; +import Title from '../styled_components/Title'; +import Bar from '../styled_components/Bar'; +import { BOX_INFO } from '../../../data/dashboard_data'; +import { MessagesIcon } from '../../../assets/icons'; + +interface ProgessBarProps { + width: number +} + +export const ProgressBar = ({ width }: ProgessBarProps) => ( +
+ +
+); + +export default () => ( + + {({data}) => ( + data.messages ? ( +
+ {BOX_INFO.map(box => ( + +
{box.icon}
+ {box.value} + {box.name} + +
+ ))} + +
+ +
+ {data.messages.length} + Unread Messages + +
+
+ ) :
+ )} + +); diff --git a/client/src/components/Dashboard/DashboardView/MessageTable.js b/client/src/components/Dashboard/DashboardView/MessageTable.tsx similarity index 70% rename from client/src/components/Dashboard/DashboardView/MessageTable.js rename to client/src/components/Dashboard/DashboardView/MessageTable.tsx index 609183c..8dd7a93 100644 --- a/client/src/components/Dashboard/DashboardView/MessageTable.js +++ b/client/src/components/Dashboard/DashboardView/MessageTable.tsx @@ -1,13 +1,29 @@ -import React, { Component } from 'react'; +import * as React from 'react'; +import { Component } from 'react'; import { Query } from 'react-apollo'; -import moment from 'moment'; +import * as moment from 'moment'; import shortid from 'short-id'; -import PropTypes from 'prop-types'; import { postsQuery } from './query'; import InfoBox from '../styled_components/InfoBox'; import TextInput from './TextInput'; -const Message = ({ msg }) => +interface Post { + date: string + body: string +} + +interface Message { + img: string + firstName: string + lastName: string + post: Post +} + +interface MessageProps { + msg: Message +} + +const Message = ({ msg }: MessageProps) => msg.post && (
@@ -24,11 +40,12 @@ const Message = ({ msg }) =>
); - -class MessagesTable extends Component { +class MessagesTable extends Component<{}, { + body: string +}> { state = { body: '' }; - onPostChange = (key, e) => this.setState({ [key]: e.target.value }); + onPostChange = (e: any) => this.setState({ body: e.target.value }); render() { // eslint-disable-next-line react/destructuring-assignment @@ -40,7 +57,7 @@ class MessagesTable extends Component {
- {data.posts && data.posts.reverse().map(msg => ( + {data.posts && data.posts.reverse().map((msg: string) => ( ))}
@@ -52,8 +69,4 @@ class MessagesTable extends Component { } } -MessagesTable.propTypes = { - posts: PropTypes.object.isRequired, //eslint-disable-line -}; - export default MessagesTable; diff --git a/client/src/components/Dashboard/DashboardView/TextInput.js b/client/src/components/Dashboard/DashboardView/TextInput.tsx similarity index 75% rename from client/src/components/Dashboard/DashboardView/TextInput.js rename to client/src/components/Dashboard/DashboardView/TextInput.tsx index 3cb52f0..14218b6 100644 --- a/client/src/components/Dashboard/DashboardView/TextInput.js +++ b/client/src/components/Dashboard/DashboardView/TextInput.tsx @@ -1,8 +1,18 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; +import * as React from 'react'; +import { Component } from 'react'; import { CrossIcon } from '../../../assets/icons'; -class TextInput extends Component { + +interface Props { + body: string + onPostChange: (x: string, y: any) => void +} + +interface State { + expanded: boolean +} + +class TextInput extends Component { state = { expanded: false }; toggleMessage = () => { @@ -15,9 +25,7 @@ class TextInput extends Component { return (
-
- -
+ {expanded && ( ( +interface CardButtonProps { + btn: string + changeView: (x: string) => void + active?: string +} + +const CardButton = ({ btn, changeView }: CardButtonProps) => (
changeView(btn.toLowerCase())}> {btn}
); -const CardAbout = ({ text }) => ( +interface CardAboutProps { + text: string +} + +const CardAbout = ({ text }: CardAboutProps) => (

{text}

); -const CardSkills = ({ skills }) => ( +interface CardSkillProps { + skills: Skill[] +}; + +const CardSkills = ({ skills }: CardSkillProps) => (
{skills.slice(0, 3).map(skill => ( @@ -29,11 +44,24 @@ const CardSkills = ({ skills }) => (
); -class Card extends Component { - constructor() { - super(); + +interface CardProps { + i: number + user: User + currentUser: User +} + +interface CardState { + active: string + expanded: boolean +} + +export default class Card extends Component { + constructor(props) { + super(props); this.state = { active: 'about', + expanded: false, }; } @@ -76,61 +104,4 @@ class Card extends Component { ); } -} - -CardButton.propTypes = { - btn: PropTypes.string.isRequired, - changeView: PropTypes.func.isRequired, -}; - -CardAbout.propTypes = { - text: PropTypes.string.isRequired, }; - -CardSkills.propTypes = { - skills: PropTypes.shape.isRequired, -}; - -Card.propTypes = { - i: PropTypes.number.isRequired, - user: PropTypes.shape({ - profile: PropTypes.shape({ - userName: PropTypes.string.isRequired, - img: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - skills: PropTypes.arrayOf( - PropTypes.shape({ - lang: PropTypes.string.isRequired, - value: PropTypes.number.isRequired, - // eslint-disable-next-line comma-dangle - }) - ).isRequired, - level: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, - }), - firstName: PropTypes.string.isRequired, - lastName: PropTypes.string.isRequired, - __v: PropTypes.number, - }).isRequired, - currentUser: PropTypes.shape({ - profile: PropTypes.shape({ - userName: PropTypes.string.isRequired, - img: PropTypes.string.isRequired, - title: PropTypes.bool.isRequired, - skills: PropTypes.arrayOf( - PropTypes.shape({ - lang: PropTypes.string.isRequired, - value: PropTypes.number.isRequired, - // eslint-disable-next-line comma-dangle - }) - ).isRequired, - level: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, - }), - firstName: PropTypes.string, - lastName: PropTypes.string, - __v: PropTypes.number, - }).isRequired, -}; - -export default Card; diff --git a/client/src/components/Dashboard/Find/CardContact.js b/client/src/components/Dashboard/Find/CardContact.tsx similarity index 72% rename from client/src/components/Dashboard/Find/CardContact.js rename to client/src/components/Dashboard/Find/CardContact.tsx index a11cd12..3332d00 100644 --- a/client/src/components/Dashboard/Find/CardContact.js +++ b/client/src/components/Dashboard/Find/CardContact.tsx @@ -1,12 +1,21 @@ -import React, { Component } from 'react'; +import * as React from 'react'; +import { Component } from 'react'; import { Mutation } from 'react-apollo'; -import PropTypes from 'prop-types'; import { ProfileIcon, MessagesIcon, LinkedinIcon, GithubIcon } from '../../../assets/icons'; import AddMessage from './mutation' +import { User } from './types' -const Icons = [, , , ]; +const icons: JSX.Element[] = [, , , ]; -export default class ContactForm extends Component { +interface Props { + user: User +} + +interface State { + message: string +} + +export default class ContactForm extends Component { state = { message: '', } @@ -30,7 +39,7 @@ export default class ContactForm extends Component {