Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

- fix issue with firebase-hooks - implement custom useAuthState

Amruth Pillai4e064dba96ac
diff --git a/gatsby-config.js b/gatsby-config.js
index 40ae4f30b..1fd56f8c7 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -17,6 +17,12 @@ module.exports = {
resolve: `gatsby-plugin-create-client-paths`,
options: { prefixes: [`/app/*`] },
},
+ {
+ resolve: `gatsby-plugin-offline`,
+ options: {
+ precachePages: [`/`, `/app/*`],
+ },
+ },
`gatsby-plugin-lodash`,
`gatsby-plugin-react-helmet`,
{
diff --git a/gatsby-ssr.js b/gatsby-ssr.js
index 2fe122214..d6039e77b 100644
--- a/gatsby-ssr.js
+++ b/gatsby-ssr.js
@@ -1,3 +1,3 @@
-import "firebase/auth";
import "firebase/analytics";
-import "firebase/firestore";
+import "firebase/auth";
+import "firebase/database";
diff --git a/package-lock.json b/package-lock.json
index 13ca913c4..5d57aec0a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3807,6 +3807,14 @@
"resolve": "^1.12.0"
}
},
+ "babel-extract-comments": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz",
+ "integrity": "sha512-qWWzi4TlddohA91bFwgt6zO/J0X+io7Qp184Fw0m2JYRSTZnJbFR8+07KmzudHCZgOiKRCrjhylwv9Xd8gfhVQ==",
+ "requires": {
+ "babylon": "^6.18.0"
+ }
+ },
"babel-loader": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.1.0.tgz",
@@ -3921,6 +3929,20 @@
"resolved": "https://registry.npmjs.org/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-2.9.12.tgz",
"integrity": "sha512-CJjsW331GuuU+h3SpKcrtMfzq3+Ypq6Oth8UQCBO3SP2gJw0EUGPVpmQwEXIT94sotUfVLWCasGQK7rRaeYb1A=="
},
+ "babel-plugin-syntax-object-rest-spread": {
+ "version": "6.13.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz",
+ "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U="
+ },
+ "babel-plugin-transform-object-rest-spread": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz",
+ "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=",
+ "requires": {
+ "babel-plugin-syntax-object-rest-spread": "^6.8.0",
+ "babel-runtime": "^6.26.0"
+ }
+ },
"babel-plugin-transform-react-remove-prop-types": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz",
@@ -3962,6 +3984,11 @@
}
}
},
+ "babylon": {
+ "version": "6.18.0",
+ "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
+ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ=="
+ },
"backo2": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
@@ -5010,6 +5037,43 @@
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
},
+ "cheerio": {
+ "version": "1.0.0-rc.3",
+ "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz",
+ "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==",
+ "requires": {
+ "css-select": "~1.2.0",
+ "dom-serializer": "~0.1.1",
+ "entities": "~1.1.1",
+ "htmlparser2": "^3.9.1",
+ "lodash": "^4.15.0",
+ "parse5": "^3.0.1"
+ },
+ "dependencies": {
+ "dom-serializer": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
+ "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==",
+ "requires": {
+ "domelementtype": "^1.3.0",
+ "entities": "^1.1.1"
+ }
+ },
+ "entities": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
+ "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
+ },
+ "parse5": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz",
+ "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==",
+ "requires": {
+ "@types/node": "*"
+ }
+ }
+ }
+ },
"chokidar": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz",
@@ -6124,16 +6188,6 @@
"array-find-index": "^1.0.1"
}
},
- "cwebp-bin": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/cwebp-bin/-/cwebp-bin-5.1.0.tgz",
- "integrity": "sha512-BsPKStaNr98zfxwejWWLIGELbPERULJoD2v5ijvpeutSAGsegX7gmABgnkRK7MUucCPROXXfaPqkLAwI509JzA==",
- "requires": {
- "bin-build": "^3.0.0",
- "bin-wrapper": "^4.0.1",
- "logalot": "^2.1.0"
- }
- },
"cyclist": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz",
@@ -6166,9 +6220,12 @@
}
},
"decamelize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-3.2.0.tgz",
+ "integrity": "sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==",
+ "requires": {
+ "xregexp": "^4.2.4"
+ }
},
"decode-uri-component": {
"version": "0.2.0",
@@ -7625,71 +7682,6 @@
"safe-buffer": "^5.1.1"
}
},
- "exec-buffer": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/exec-buffer/-/exec-buffer-3.2.0.tgz",
- "integrity": "sha512-wsiD+2Tp6BWHoVv3B+5Dcx6E7u5zky+hUwOHjuH2hKSLR3dvRmX8fk8UD8uqQixHs4Wk6eDmiegVrMPjKj7wpA==",
- "requires": {
- "execa": "^0.7.0",
- "p-finally": "^1.0.0",
- "pify": "^3.0.0",
- "rimraf": "^2.5.4",
- "tempfile": "^2.0.0"
- },
- "dependencies": {
- "cross-spawn": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
- "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
- "requires": {
- "lru-cache": "^4.0.1",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "execa": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
- "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
- "requires": {
- "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"
- }
- },
- "get-stream": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
- "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
- },
- "lru-cache": {
- "version": "4.1.5",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
- "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
- "requires": {
- "pseudomap": "^1.0.2",
- "yallist": "^2.1.2"
- }
- },
- "pify": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
- "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
- },
- "rimraf": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
- "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
- "requires": {
- "glob": "^7.1.3"
- }
- }
- }
- },
"execa": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz",
@@ -8571,9 +8563,9 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
},
"gatsby": {
- "version": "2.23.20",
- "resolved": "https://registry.npmjs.org/gatsby/-/gatsby-2.23.20.tgz",
- "integrity": "sha512-ur5VkBVz3kXkS2lkfufTOuSvOaXdb6qs1WmyafMahwLVm3VlHvZQwhk5AV4yXZ8+zqGphHJcKtRBeCwIe6efsw==",
+ "version": "2.23.21",
+ "resolved": "https://registry.npmjs.org/gatsby/-/gatsby-2.23.21.tgz",
+ "integrity": "sha512-oR4E+v3ilih+hQ1KyDI9N9c5OUqpNyiw93vO2YCGnpIY+q2/ldUnjWQc9FLGgMxupNs9nnTtYT/UrpePHFQvzQ==",
"requires": {
"@babel/code-frame": "^7.10.3",
"@babel/core": "^7.10.3",
@@ -8713,6 +8705,7 @@
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.2",
"webpack-stats-plugin": "^0.3.1",
+ "webpack-virtual-modules": "^0.2.2",
"xstate": "^4.11.0",
"yaml-loader": "^0.6.0"
},
@@ -8927,6 +8920,20 @@
}
}
},
+ "gatsby-plugin-offline": {
+ "version": "3.2.16",
+ "resolved": "https://registry.npmjs.org/gatsby-plugin-offline/-/gatsby-plugin-offline-3.2.16.tgz",
+ "integrity": "sha512-eEKBd+rjhXYt2tBO268saGuW1v5vIDoQiBRCwjg49ADcNppbdf4HQy/tq+ZR1CJ4gko7JLM+5c+fi23DF8Kzkg==",
+ "requires": {
+ "@babel/runtime": "^7.10.3",
+ "cheerio": "^1.0.0-rc.3",
+ "gatsby-core-utils": "^1.3.11",
+ "glob": "^7.1.6",
+ "idb-keyval": "^3.2.0",
+ "lodash": "^4.17.15",
+ "workbox-build": "^4.3.1"
+ }
+ },
"gatsby-plugin-page-creator": {
"version": "2.3.15",
"resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-2.3.15.tgz",
@@ -9108,9 +9115,9 @@
}
},
"gatsby-plugin-sharp": {
- "version": "2.6.17",
- "resolved": "https://registry.npmjs.org/gatsby-plugin-sharp/-/gatsby-plugin-sharp-2.6.17.tgz",
- "integrity": "sha512-ZnRBu3XhgQo4KsOmFBEO4QVmU2OFofPbQ/1xRkIL2exDcVBX/HF6Qh4edwiUQRvYEOgdidCOk3fSYrH+94OsWg==",
+ "version": "2.6.18",
+ "resolved": "https://registry.npmjs.org/gatsby-plugin-sharp/-/gatsby-plugin-sharp-2.6.18.tgz",
+ "integrity": "sha512-DeSPCdwxCsBeJcPxbNtptvn0ta3y/3ABkZm00EtEOeasIjPWDqLDDXi39Q+xGOJVcxsWPs5zinQurJMTV62b8w==",
"requires": {
"@babel/runtime": "^7.10.3",
"async": "^2.6.3",
@@ -9121,7 +9128,6 @@
"imagemin": "^6.1.0",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-pngquant": "^6.0.1",
- "imagemin-webp": "^5.1.0",
"lodash": "^4.17.15",
"mini-svg-data-uri": "^1.2.3",
"potrace": "^2.1.6",
@@ -9141,19 +9147,6 @@
"lodash": "^4.17.14"
}
},
- "gatsby-core-utils": {
- "version": "1.3.11",
- "resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-1.3.11.tgz",
- "integrity": "sha512-eaplfOveXLl1RCWja7QIke560jUKLprvCXZ446YgQ8vAYB0fXVz3u6AOf7XUmEV9F9PIkNjmfevd1oUPy9qISw==",
- "requires": {
- "ci-info": "2.0.0",
- "configstore": "^5.0.1",
- "fs-extra": "^8.1.0",
- "node-object-hash": "^2.0.0",
- "proper-lockfile": "^4.1.1",
- "xdg-basedir": "^4.0.0"
- }
- },
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
@@ -9558,6 +9551,11 @@
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
},
+ "get-own-enumerable-property-symbols": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz",
+ "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g=="
+ },
"get-port": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz",
@@ -10461,6 +10459,11 @@
"resolved": "https://registry.npmjs.org/idb/-/idb-3.0.2.tgz",
"integrity": "sha512-+FLa/0sTXqyux0o6C+i2lOR0VoS60LU/jzUo5xjfY6+7sEEgy4Gz1O7yFBXvjd7N0NyIGWIRg8DcQSLEG+VSPw=="
},
+ "idb-keyval": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-3.2.0.tgz",
+ "integrity": "sha512-slx8Q6oywCCSfKgPgL0sEsXtPVnSbTLWpyiDcu6msHOyKOLari1TD1qocXVCft80umnkk3/Qqh3lwoFt8T/BPQ=="
+ },
"ieee754": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
@@ -10655,16 +10658,6 @@
}
}
},
- "imagemin-webp": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/imagemin-webp/-/imagemin-webp-5.1.0.tgz",
- "integrity": "sha512-BsPTpobgbDPFBBsI3UflnU/cpIVa15qInEDBcYBw16qI/6XiB4vDF/dGp9l4aM3pfFDDYqR0mANMcKpBD7wbCw==",
- "requires": {
- "cwebp-bin": "^5.0.0",
- "exec-buffer": "^3.0.0",
- "is-cwebp-readable": "^2.0.1"
- }
- },
"import-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz",
@@ -11323,21 +11316,6 @@
"rgba-regex": "^1.0.0"
}
},
- "is-cwebp-readable": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-cwebp-readable/-/is-cwebp-readable-2.0.1.tgz",
- "integrity": "sha1-r7k7DAq9CiUQEBauM66ort+SbSY=",
- "requires": {
- "file-type": "^4.3.0"
- },
- "dependencies": {
- "file-type": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz",
- "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU="
- }
- }
- },
"is-data-descriptor": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
@@ -11575,6 +11553,11 @@
"has-symbols": "^1.0.1"
}
},
+ "is-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz",
+ "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk="
+ },
"is-relative": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
@@ -12276,6 +12259,11 @@
"lodash": "^4.17.4"
}
},
+ "lodash._reinterpolate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
+ "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0="
+ },
"lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
@@ -12326,6 +12314,23 @@
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4="
},
+ "lodash.template": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz",
+ "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==",
+ "requires": {
+ "lodash._reinterpolate": "^3.0.0",
+ "lodash.templatesettings": "^4.0.0"
+ }
+ },
+ "lodash.templatesettings": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz",
+ "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==",
+ "requires": {
+ "lodash._reinterpolate": "^3.0.0"
+ }
+ },
"lodash.throttle": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
@@ -12680,6 +12685,11 @@
"trim-newlines": "^1.0.0"
},
"dependencies": {
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
+ },
"find-up": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
@@ -15633,11 +15643,6 @@
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz",
"integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA=="
},
- "react-firebase-hooks": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/react-firebase-hooks/-/react-firebase-hooks-2.2.0.tgz",
- "integrity": "sha512-bwBaCYa8M+bpTqD0masAPGDTzxiTkGbyxv363hyR+NeNH1HbezPll6G7aMIGl+7OOYRPzfdmpkk72zc3VgXfEw=="
- },
"react-helmet": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz",
@@ -17667,6 +17672,23 @@
"is-hexadecimal": "^1.0.0"
}
},
+ "stringify-object": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz",
+ "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==",
+ "requires": {
+ "get-own-enumerable-property-symbols": "^3.0.0",
+ "is-obj": "^1.0.1",
+ "is-regexp": "^1.0.0"
+ },
+ "dependencies": {
+ "is-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
+ "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8="
+ }
+ }
+ },
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
@@ -17687,6 +17709,15 @@
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
},
+ "strip-comments": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/strip-comments/-/strip-comments-1.0.2.tgz",
+ "integrity": "sha512-kL97alc47hoyIQSV165tTt9rG5dn4w1dNnBhOQ3bOU1Nc1hel09jnXANaHJ7vzHLd4Ju8kseDGzlev96pghLFw==",
+ "requires": {
+ "babel-extract-comments": "^1.0.0",
+ "babel-plugin-transform-object-rest-spread": "^6.26.0"
+ }
+ },
"strip-dirs": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz",
@@ -19444,6 +19475,11 @@
"ms": "^2.1.1"
}
},
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
+ },
"del": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz",
@@ -19699,6 +19735,14 @@
"resolved": "https://registry.npmjs.org/webpack-stats-plugin/-/webpack-stats-plugin-0.3.2.tgz",
"integrity": "sha512-kxEtPQ6lBBik2qtJlsZkiaDMI6rGXe9w1kLH9ZCdt0wgCGVnbwwPlP60cMqG6tILNFYqXDxNt4+c4OIIuE+Fnw=="
},
+ "webpack-virtual-modules": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.2.2.tgz",
+ "integrity": "sha512-kDUmfm3BZrei0y+1NTHJInejzxfhtU8eDj2M7OKb2IWrPFAeO1SOH2KuQ68MSZu9IGEHcxbkKKR1v18FrUSOmA==",
+ "requires": {
+ "debug": "^3.0.0"
+ }
+ },
"websocket-driver": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz",
@@ -19803,6 +19847,157 @@
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ=="
},
+ "workbox-background-sync": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-background-sync/-/workbox-background-sync-4.3.1.tgz",
+ "integrity": "sha512-1uFkvU8JXi7L7fCHVBEEnc3asPpiAL33kO495UMcD5+arew9IbKW2rV5lpzhoWcm/qhGB89YfO4PmB/0hQwPRg==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-broadcast-update": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-broadcast-update/-/workbox-broadcast-update-4.3.1.tgz",
+ "integrity": "sha512-MTSfgzIljpKLTBPROo4IpKjESD86pPFlZwlvVG32Kb70hW+aob4Jxpblud8EhNb1/L5m43DUM4q7C+W6eQMMbA==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-build": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-build/-/workbox-build-4.3.1.tgz",
+ "integrity": "sha512-UHdwrN3FrDvicM3AqJS/J07X0KXj67R8Cg0waq1MKEOqzo89ap6zh6LmaLnRAjpB+bDIz+7OlPye9iii9KBnxw==",
+ "requires": {
+ "@babel/runtime": "^7.3.4",
+ "@hapi/joi": "^15.0.0",
+ "common-tags": "^1.8.0",
+ "fs-extra": "^4.0.2",
+ "glob": "^7.1.3",
+ "lodash.template": "^4.4.0",
+ "pretty-bytes": "^5.1.0",
+ "stringify-object": "^3.3.0",
+ "strip-comments": "^1.0.2",
+ "workbox-background-sync": "^4.3.1",
+ "workbox-broadcast-update": "^4.3.1",
+ "workbox-cacheable-response": "^4.3.1",
+ "workbox-core": "^4.3.1",
+ "workbox-expiration": "^4.3.1",
+ "workbox-google-analytics": "^4.3.1",
+ "workbox-navigation-preload": "^4.3.1",
+ "workbox-precaching": "^4.3.1",
+ "workbox-range-requests": "^4.3.1",
+ "workbox-routing": "^4.3.1",
+ "workbox-strategies": "^4.3.1",
+ "workbox-streams": "^4.3.1",
+ "workbox-sw": "^4.3.1",
+ "workbox-window": "^4.3.1"
+ },
+ "dependencies": {
+ "fs-extra": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz",
+ "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==",
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ }
+ }
+ }
+ },
+ "workbox-cacheable-response": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-cacheable-response/-/workbox-cacheable-response-4.3.1.tgz",
+ "integrity": "sha512-Rp5qlzm6z8IOvnQNkCdO9qrDgDpoPNguovs0H8C+wswLuPgSzSp9p2afb5maUt9R1uTIwOXrVQMmPfPypv+npw==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-core": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-core/-/workbox-core-4.3.1.tgz",
+ "integrity": "sha512-I3C9jlLmMKPxAC1t0ExCq+QoAMd0vAAHULEgRZ7kieCdUd919n53WC0AfvokHNwqRhGn+tIIj7vcb5duCjs2Kg=="
+ },
+ "workbox-expiration": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-expiration/-/workbox-expiration-4.3.1.tgz",
+ "integrity": "sha512-vsJLhgQsQouv9m0rpbXubT5jw0jMQdjpkum0uT+d9tTwhXcEZks7qLfQ9dGSaufTD2eimxbUOJfWLbNQpIDMPw==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-google-analytics": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-google-analytics/-/workbox-google-analytics-4.3.1.tgz",
+ "integrity": "sha512-xzCjAoKuOb55CBSwQrbyWBKqp35yg1vw9ohIlU2wTy06ZrYfJ8rKochb1MSGlnoBfXGWss3UPzxR5QL5guIFdg==",
+ "requires": {
+ "workbox-background-sync": "^4.3.1",
+ "workbox-core": "^4.3.1",
+ "workbox-routing": "^4.3.1",
+ "workbox-strategies": "^4.3.1"
+ }
+ },
+ "workbox-navigation-preload": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-navigation-preload/-/workbox-navigation-preload-4.3.1.tgz",
+ "integrity": "sha512-K076n3oFHYp16/C+F8CwrRqD25GitA6Rkd6+qAmLmMv1QHPI2jfDwYqrytOfKfYq42bYtW8Pr21ejZX7GvALOw==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-precaching": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-precaching/-/workbox-precaching-4.3.1.tgz",
+ "integrity": "sha512-piSg/2csPoIi/vPpp48t1q5JLYjMkmg5gsXBQkh/QYapCdVwwmKlU9mHdmy52KsDGIjVaqEUMFvEzn2LRaigqQ==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-range-requests": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-range-requests/-/workbox-range-requests-4.3.1.tgz",
+ "integrity": "sha512-S+HhL9+iTFypJZ/yQSl/x2Bf5pWnbXdd3j57xnb0V60FW1LVn9LRZkPtneODklzYuFZv7qK6riZ5BNyc0R0jZA==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-routing": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-routing/-/workbox-routing-4.3.1.tgz",
+ "integrity": "sha512-FkbtrODA4Imsi0p7TW9u9MXuQ5P4pVs1sWHK4dJMMChVROsbEltuE79fBoIk/BCztvOJ7yUpErMKa4z3uQLX+g==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-strategies": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-strategies/-/workbox-strategies-4.3.1.tgz",
+ "integrity": "sha512-F/+E57BmVG8dX6dCCopBlkDvvhg/zj6VDs0PigYwSN23L8hseSRwljrceU2WzTvk/+BSYICsWmRq5qHS2UYzhw==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-streams": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-streams/-/workbox-streams-4.3.1.tgz",
+ "integrity": "sha512-4Kisis1f/y0ihf4l3u/+ndMkJkIT4/6UOacU3A4BwZSAC9pQ9vSvJpIi/WFGQRH/uPXvuVjF5c2RfIPQFSS2uA==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
+ "workbox-sw": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-sw/-/workbox-sw-4.3.1.tgz",
+ "integrity": "sha512-0jXdusCL2uC5gM3yYFT6QMBzKfBr2XTk0g5TPAV4y8IZDyVNDyj1a8uSXy3/XrvkVTmQvLN4O5k3JawGReXr9w=="
+ },
+ "workbox-window": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/workbox-window/-/workbox-window-4.3.1.tgz",
+ "integrity": "sha512-C5gWKh6I58w3GeSc0wp2Ne+rqVw8qwcmZnQGpjiek8A2wpbxSJb1FdCoQVO+jDJs35bFgo/WETgl1fqgsxN0Hg==",
+ "requires": {
+ "workbox-core": "^4.3.1"
+ }
+ },
"worker-farm": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz",
@@ -20037,14 +20232,6 @@
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
},
- "decamelize": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-3.2.0.tgz",
- "integrity": "sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==",
- "requires": {
- "xregexp": "^4.2.4"
- }
- },
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
@@ -20107,6 +20294,13 @@
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
+ },
+ "dependencies": {
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
+ }
}
},
"yauzl": {
diff --git a/package.json b/package.json
index 57756a755..8a0bb08d4 100644
--- a/package.json
+++ b/package.json
@@ -18,16 +18,17 @@
"classnames": "^2.2.6",
"firebase": "^7.15.5",
"formik": "^2.1.4",
- "gatsby": "^2.23.20",
+ "gatsby": "^2.23.21",
"gatsby-image": "^2.4.12",
"gatsby-plugin-create-client-paths": "^2.3.9",
"gatsby-plugin-firebase": "^0.2.0-beta.4",
"gatsby-plugin-lodash": "^3.3.9",
"gatsby-plugin-manifest": "^2.4.17",
+ "gatsby-plugin-offline": "^3.2.16",
"gatsby-plugin-postcss": "^2.3.9",
"gatsby-plugin-prefetch-google-fonts": "^1.4.3",
"gatsby-plugin-react-helmet": "^3.3.9",
- "gatsby-plugin-sharp": "^2.6.17",
+ "gatsby-plugin-sharp": "^2.6.18",
"gatsby-source-filesystem": "^2.3.18",
"gatsby-transformer-sharp": "^2.5.10",
"lodash": "^4.17.15",
@@ -36,7 +37,6 @@
"react": "^16.13.1",
"react-beautiful-dnd": "^13.0.0",
"react-dom": "^16.13.1",
- "react-firebase-hooks": "^2.2.0",
"react-helmet": "^6.1.0",
"react-icons": "^3.10.0",
"react-toastify": "^6.0.8",
diff --git a/src/components/builder/right/RightNavbar.js b/src/components/builder/right/RightNavbar.js
index 2305d7569..f4d9e850f 100644
--- a/src/components/builder/right/RightNavbar.js
+++ b/src/components/builder/right/RightNavbar.js
@@ -1,11 +1,11 @@
import cx from "classnames";
import React, { useContext } from "react";
-import { MdPerson, MdSync } from "react-icons/md";
+import { MdPerson, MdSync, MdSyncDisabled } from "react-icons/md";
import DatabaseContext from "../../../contexts/DatabaseContext";
import styles from "./RightNavbar.module.css";
const RightNavbar = () => {
- const { isUpdating } = useContext(DatabaseContext);
+ const { isOffline, isUpdating } = useContext(DatabaseContext);
return (
<div className={styles.container}>
@@ -16,7 +16,13 @@ const RightNavbar = () => {
/>
</div>
- <MdSync size="24px" className={cx("mt-auto", { spin: isUpdating })} />
+ <div className="text-4xl mt-auto">
+ {isOffline ? (
+ <MdSyncDisabled className="text-red-600" />
+ ) : (
+ <MdSync className={cx({ spin: isUpdating })} />
+ )}
+ </div>
</div>
);
};
diff --git a/src/contexts/DatabaseContext.js b/src/contexts/DatabaseContext.js
index 9eddb549c..57347a5f8 100644
--- a/src/contexts/DatabaseContext.js
+++ b/src/contexts/DatabaseContext.js
@@ -1,23 +1,34 @@
import firebase from "gatsby-plugin-firebase";
import { debounce } from "lodash";
-import React, { createContext, useContext, useState } from "react";
+import React, { createContext, useContext, useEffect, useState } from "react";
import { v4 as uuidv4 } from "uuid";
import UserContext from "./UserContext";
const defaultState = {
+ isOffline: false,
isUpdating: false,
getResume: async () => {},
+ getResumes: async () => {},
createResume: () => {},
updateResume: async () => {},
+ debouncedUpdate: async () => {},
deleteResume: () => {},
};
const DatabaseContext = createContext(defaultState);
const DatabaseProvider = ({ children }) => {
+ const [isOffline, setOffline] = useState(false);
const [isUpdating, setUpdating] = useState(false);
const { user } = useContext(UserContext);
+ useEffect(() => {
+ const connectedRef = firebase.database().ref(".info/connected");
+ connectedRef.on("value", (snapshot) => {
+ snapshot.val() === true ? setOffline(false) : setOffline(true);
+ });
+ }, []);
+
const getResume = async (id) => {
const snapshot = await firebase
.database()
@@ -30,11 +41,25 @@ const DatabaseProvider = ({ children }) => {
const id = uuidv4();
const createdAt = firebase.database.ServerValue.TIMESTAMP;
+ let firstName = "",
+ lastName = "",
+ photograph = "";
+
+ if (!user.isAnonymous) {
+ [firstName, lastName] = user.displayName.split(" ");
+ photograph = user.photoURL;
+ }
+
firebase
.database()
.ref(`users/${user.uid}/resumes/${id}`)
.set({
id,
+ profile: {
+ firstName,
+ lastName,
+ photograph,
+ },
...resume,
createdAt,
updatedAt: createdAt,
@@ -66,10 +91,12 @@ const DatabaseProvider = ({ children }) => {
return (
<DatabaseContext.Provider
value={{
+ isOffline,
isUpdating,
getResume,
createResume,
- updateResume: debouncedUpdate,
+ updateResume,
+ debouncedUpdate,
deleteResume,
}}
>
diff --git a/src/contexts/ResumeContext.js b/src/contexts/ResumeContext.js
index ff364041a..a953f8291 100644
--- a/src/contexts/ResumeContext.js
+++ b/src/contexts/ResumeContext.js
@@ -5,7 +5,7 @@ import DatabaseContext from "./DatabaseContext";
const ResumeContext = createContext({});
const ResumeProvider = ({ children }) => {
- const { updateResume } = useContext(DatabaseContext);
+ const { debouncedUpdate } = useContext(DatabaseContext);
const [state, dispatch] = useReducer((state, { type, payload }) => {
let newState;
@@ -13,7 +13,7 @@ const ResumeProvider = ({ children }) => {
switch (type) {
case "on_input":
newState = set({ ...state }, payload.path, payload.value);
- updateResume(newState);
+ debouncedUpdate(newState);
return newState;
case "set_data":
return payload;
diff --git a/src/contexts/UserContext.js b/src/contexts/UserContext.js
index 8c5d6a961..dbae2ef1b 100644
--- a/src/contexts/UserContext.js
+++ b/src/contexts/UserContext.js
@@ -1,14 +1,15 @@
import firebase from "gatsby-plugin-firebase";
import { pick } from "lodash";
import React, { createContext, useEffect, useState } from "react";
-import { useAuthState } from "react-firebase-hooks/auth";
import { toast } from "react-toastify";
+import useAuthState from "../hooks/useAuthState";
const defaultUser = {
uid: null,
displayName: null,
email: null,
photoURL: null,
+ isAnonymous: false,
};
const defaultState = {
@@ -20,7 +21,7 @@ const defaultState = {
const UserContext = createContext(defaultState);
const UserProvider = ({ children }) => {
- const [firebaseUser, loading] = useAuthState(firebase.auth());
+ const [firebaseUser, loading] = useAuthState(firebase);
const [user, setUser] = useState(null);
useEffect(() => {
diff --git a/src/hooks/useAuthState.js b/src/hooks/useAuthState.js
new file mode 100644
index 000000000..49814a789
--- /dev/null
+++ b/src/hooks/useAuthState.js
@@ -0,0 +1,54 @@
+import { useEffect, useReducer, useState } from "react";
+
+export default function useAuthState(firebase) {
+ const [auth, setAuth] = useState(undefined);
+
+ const [state, dispatch] = useReducer(
+ (state, action) => {
+ switch (action.type) {
+ case "auth_state_changed":
+ return {
+ ...state,
+ user: action.user,
+ loading: false,
+ };
+ case "error":
+ return {
+ ...state,
+ error: action.error,
+ loading: false,
+ };
+ default:
+ return state;
+ }
+ },
+ {
+ user: undefined,
+ loading: true,
+ error: undefined,
+ }
+ );
+
+ useEffect(() => {
+ setAuth(firebase.auth());
+ }, [firebase]);
+
+ useEffect(() => {
+ if (auth === undefined) return;
+
+ const unsubscribe = auth.onAuthStateChanged(
+ (user) => {
+ dispatch({ type: "auth_state_changed", user });
+ },
+ (error) => {
+ dispatch({ type: "error", error });
+ }
+ );
+
+ return () => {
+ unsubscribe();
+ };
+ }, [auth]);
+
+ return [state.user, state.loading, state.error];
+}
diff --git a/src/modals/CreateResumeModal.js b/src/modals/CreateResumeModal.js
index fb2519d35..eba8089de 100644
--- a/src/modals/CreateResumeModal.js
+++ b/src/modals/CreateResumeModal.js
@@ -38,8 +38,15 @@ const CreateResumeModal = () => {
name: "",
},
validationSchema: CreateResumeSchema,
- onSubmit: (data) => {
- isEditMode ? updateResume(data) : createResume(data);
+ onSubmit: (newData) => {
+ if (isEditMode) {
+ if (data !== newData) {
+ updateResume(newData);
+ }
+ } else {
+ createResume(newData);
+ }
+
modalRef.current.handleClose();
},
});
diff --git a/src/pages/app/dashboard.js b/src/pages/app/dashboard.js
index 91f751ccf..6c214cc65 100644
--- a/src/pages/app/dashboard.js
+++ b/src/pages/app/dashboard.js
@@ -1,15 +1,28 @@
import firebase from "gatsby-plugin-firebase";
-import React from "react";
-import { useListVals } from "react-firebase-hooks/database";
+import React, { useEffect, useState } from "react";
import CreateResume from "../../components/dashboard/CreateResume";
import ResumePreview from "../../components/dashboard/ResumePreview";
import TopNavbar from "../../components/dashboard/TopNavbar";
import LoadingScreen from "../../components/router/LoadingScreen";
const Dashboard = ({ user }) => {
- const [resumes, loading] = useListVals(
- firebase.database().ref(`users/${user.uid}/resumes`)
- );
+ const [resumes, setResumes] = useState([]);
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ firebase
+ .database()
+ .ref(`users/${user.uid}/resumes`)
+ .on("value", (snapshot) => {
+ if (snapshot.val()) {
+ const resumes = [];
+ const data = snapshot.val();
+ Object.keys(data).forEach((key) => resumes.push(data[key]));
+ setResumes(resumes);
+ setLoading(false);
+ }
+ });
+ }, [user]);
if (loading) {
return <LoadingScreen message="Connecting to database..." />;