Skip to content

Commit

Permalink
BUG-1569 - Add Lock Option for List View
Browse files Browse the repository at this point in the history
  • Loading branch information
Anubhav Singh committed Nov 23, 2023
1 parent 0984f11 commit 482c0b4
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
CopySimple,
DotsThreeVertical,
FolderOpen,
Lock,
LockOpen,
PencilSimple,
TrashSimple,
} from "@phosphor-icons/react";
Expand Down Expand Up @@ -38,6 +40,7 @@ type Props = {
export const ResumeListItem = ({ resume }: Props) => {
const navigate = useNavigate();
const { open } = useDialog<ResumeDto>("resume");
const { open: lockOpen } = useDialog<ResumeDto>("lock");

const { url } = useResumePreview(resume.id);

Expand All @@ -55,6 +58,10 @@ export const ResumeListItem = ({ resume }: Props) => {
open("duplicate", { id: "resume", item: resume });
};

const onLockChange = () => {
lockOpen(resume.locked ? "update" : "create", { id: "lock", item: resume });
};

const onDelete = () => {
open("delete", { id: "resume", item: resume });
};
Expand Down Expand Up @@ -153,6 +160,17 @@ export const ResumeListItem = ({ resume }: Props) => {
<CopySimple size={14} className="mr-2" />
{t`Duplicate`}
</ContextMenuItem>
{resume.locked ? (
<ContextMenuItem onClick={onLockChange}>
<LockOpen size={14} className="mr-2" />
{t`Unlock`}
</ContextMenuItem>
) : (
<ContextMenuItem onClick={onLockChange}>
<Lock size={14} className="mr-2" />
{t`Lock`}
</ContextMenuItem>
)}
<ContextMenuSeparator />
<ContextMenuItem onClick={onDelete} className="text-error">
<TrashSimple size={14} className="mr-2" />
Expand Down

0 comments on commit 482c0b4

Please sign in to comment.