Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/app/components/Resume/ResumeControlBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "@heroicons/react/24/outline";
import { usePDF } from "@react-pdf/renderer";
import dynamic from "next/dynamic";
import {clearStateFromLocalStorage} from "lib/redux/local-storage";

const ResumeControlBar = ({
scale,
Expand All @@ -33,6 +34,17 @@ const ResumeControlBar = ({
update();
}, [update, document]);

//reset handler
const handleReset = () => {
const confirmed = window.confirm(
"Are you sure you want to reset the resume?"
);
if(!confirmed) return;

clearStateFromLocalStorage();
window.location.reload();
};

return (
<div className="sticky bottom-0 left-0 right-0 flex h-[var(--resume-control-bar-height)] items-center justify-center px-[var(--resume-padding)] text-gray-600 lg:justify-between">
<div className="flex items-center gap-2">
Expand Down Expand Up @@ -67,6 +79,12 @@ const ResumeControlBar = ({
<ArrowDownTrayIcon className="h-4 w-4" />
<span className="whitespace-nowrap">Download Resume</span>
</a>
<button
onClick = {handleReset}
className = "ml-1 flex items-center gap-1 rounded-md border border-gray-300 px--3 py-0.5 text-gray-600 hover:bg-gray-50 lg:ml-2"
>
Reset Resume
</button>
</div>
);
};
Expand Down
4 changes: 4 additions & 0 deletions src/app/lib/redux/local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ export const saveStateToLocalStorage = (state: RootState) => {
};

export const getHasUsedAppBefore = () => Boolean(loadStateFromLocalStorage());

export const clearStateFromLocalStorage = () => {
localStorage.removeItem(LOCAL_STORAGE_KEY);
};