Skip to content

Commit

Permalink
Merge branch 'main' of github.com:AmruthPillai/Reactive-Resume
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Nov 23, 2023
2 parents d36fc1b + 1bf66e5 commit 563abc0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
21 changes: 20 additions & 1 deletion apps/client/src/pages/builder/_components/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import {
import { Button, Separator, Toggle, Tooltip } from "@reactive-resume/ui";
import { motion } from "framer-motion";

import { useToast } from "@/client/hooks/use-toast";
import { usePrintResume } from "@/client/services/resume";
import { useBuilderStore } from "@/client/stores/builder";
import { useResumeStore, useTemporalResumeStore } from "@/client/stores/resume";

export const BuilderToolbar = () => {
const { toast } = useToast();
const setValue = useResumeStore((state) => state.setValue);
const undo = useTemporalResumeStore((state) => state.undo);
const redo = useTemporalResumeStore((state) => state.redo);
Expand All @@ -42,6 +44,17 @@ export const BuilderToolbar = () => {
openInNewTab(url);
};

const onCopy = async () => {
const { url } = await printResume({ id });
await navigator.clipboard.writeText(url);

toast({
variant: "success",
title: t`A link has been copied to your clipboard.`,
description: t`Anyone with this link can view and download the resume. Share it on your profile or with recruiters.`,
});
};

const onZoomIn = () => frameRef?.contentWindow?.postMessage({ type: "ZOOM_IN" }, "*");
const onZoomOut = () => frameRef?.contentWindow?.postMessage({ type: "ZOOM_OUT" }, "*");
const onResetView = () => frameRef?.contentWindow?.postMessage({ type: "RESET_VIEW" }, "*");
Expand Down Expand Up @@ -117,7 +130,13 @@ export const BuilderToolbar = () => {
<Separator orientation="vertical" className="h-9" />

<Tooltip content={t`Copy Link to Resume`}>
<Button size="icon" variant="ghost" className="rounded-none" disabled={!isPublic}>
<Button
size="icon"
variant="ghost"
className="rounded-none"
onClick={onCopy}
disabled={!isPublic}
>
<LinkSimple />
</Button>
</Tooltip>
Expand Down
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 @@ -94,6 +101,27 @@ export const ResumeListItem = ({ resume }: Props) => {
<CopySimple size={14} className="mr-2" />
{t`Duplicate`}
</DropdownMenuItem>
{resume.locked ? (
<DropdownMenuItem
onClick={(event) => {
event.stopPropagation();
onLockChange();
}}
>
<LockOpen size={14} className="mr-2" />
{t`Unlock`}
</DropdownMenuItem>
) : (
<DropdownMenuItem
onClick={(event) => {
event.stopPropagation();
onLockChange();
}}
>
<Lock size={14} className="mr-2" />
{t`Lock`}
</DropdownMenuItem>
)}
<ContextMenuSeparator />
<DropdownMenuItem
className="text-error"
Expand Down Expand Up @@ -153,6 +181,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
2 changes: 1 addition & 1 deletion libs/parser/src/json-resume/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class JsonResumeParser implements Parser<Json, JsonResume> {
result.sections.certifications.items.push({
...defaultCertification,
id: createId(),
name: certificate.title ?? "",
name: certificate.name ?? "",
date: certificate.date ?? "",
issuer: certificate.issuer ?? "",
summary: certificate.summary ?? "",
Expand Down
2 changes: 1 addition & 1 deletion libs/parser/src/json-resume/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const awardsSchema = z.object({
});

const certificatesSchema = z.object({
title: z.string().optional(),
name: z.string().optional(),
date: iso8601.optional(),
issuer: z.string().optional(),
summary: z.string().optional(),
Expand Down

0 comments on commit 563abc0

Please sign in to comment.