Skip to content

Commit

Permalink
collapse empty sections when importing resume
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikalov authored and xitanggg committed Jul 11, 2023
1 parent b959132 commit 4e7ad59
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
18 changes: 14 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
"@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",
"@vercel/analytics": "^1.0.1",
"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",
Expand Down
14 changes: 13 additions & 1 deletion src/app/components/ResumeDropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand Down Expand Up @@ -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");
};

Expand Down

0 comments on commit 4e7ad59

Please sign in to comment.