mirror of
https://github.com/xitanggg/open-resume
synced 2024-11-03 09:19:21 +01:00
collapse empty sections when importing resume
This commit is contained in:
parent
b9591328ba
commit
4e7ad5980f
18
package-lock.json
generated
18
package-lock.json
generated
@ -11,6 +11,7 @@
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@react-pdf/renderer": "^3.1.10",
|
||||
"@reduxjs/toolkit": "^1.9.5",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/node": "20.2.5",
|
||||
"@types/react": "18.2.7",
|
||||
"@types/react-dom": "18.2.4",
|
||||
@ -18,6 +19,7 @@
|
||||
"autoprefixer": "10.4.14",
|
||||
"eslint": "8.41.0",
|
||||
"eslint-config-next": "13.4.4",
|
||||
"lodash": "^4.17.21",
|
||||
"next": "13.4.4",
|
||||
"pdfjs": "^2.5.0",
|
||||
"pdfjs-dist": "^3.7.107",
|
||||
@ -1954,6 +1956,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.14.195",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz",
|
||||
"integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
|
||||
@ -6484,8 +6491,7 @@
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
@ -10778,6 +10784,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.195",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz",
|
||||
"integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "20.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
|
||||
@ -14101,8 +14112,7 @@
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
|
@ -14,6 +14,7 @@
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@react-pdf/renderer": "^3.1.10",
|
||||
"@reduxjs/toolkit": "^1.9.5",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/node": "20.2.5",
|
||||
"@types/react": "18.2.7",
|
||||
"@types/react-dom": "18.2.4",
|
||||
@ -21,6 +22,7 @@
|
||||
"autoprefixer": "10.4.14",
|
||||
"eslint": "8.41.0",
|
||||
"eslint-config-next": "13.4.4",
|
||||
"lodash": "^4.17.21",
|
||||
"next": "13.4.4",
|
||||
"pdfjs": "^2.5.0",
|
||||
"pdfjs-dist": "^3.7.107",
|
||||
|
@ -8,6 +8,8 @@ import { useRouter } from "next/navigation";
|
||||
import addPdfSrc from "public/assets/add-pdf.svg";
|
||||
import Image from "next/image";
|
||||
import { cx } from "lib/cx";
|
||||
import isEmpty from "lodash/isEmpty";
|
||||
import cloneDeep from "lodash/cloneDeep";
|
||||
|
||||
const defaultFileState = {
|
||||
name: "",
|
||||
@ -69,7 +71,17 @@ export const ResumeDropzone = ({
|
||||
|
||||
const onImportClick = async () => {
|
||||
const resume = await parseResumeFromPdf(file.fileUrl);
|
||||
saveStateToLocalStorage({ resume, settings: initialSettings });
|
||||
let settings = cloneDeep(initialSettings);
|
||||
const sections = Object.keys(
|
||||
settings.formToShow
|
||||
) as (keyof typeof settings.formToShow)[];
|
||||
for (const section of sections) {
|
||||
if (isEmpty(resume[section])) {
|
||||
settings.formToShow[section] = false;
|
||||
}
|
||||
}
|
||||
|
||||
saveStateToLocalStorage({ resume, settings });
|
||||
router.push("/resume-builder");
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user