A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix(applications): handle cover letter copy failures (#3394)
Emanuele Tonelloef47baf24362
diff --git a/apps/web/src/features/applications/components/application-ai-copilot.tsx b/apps/web/src/features/applications/components/application-ai-copilot.tsxindex f2a883832..7d8cadf8d 100644--- a/apps/web/src/features/applications/components/application-ai-copilot.tsx+++ b/apps/web/src/features/applications/components/application-ai-copilot.tsx@@ -14,7 +14,7 @@ import {SpinnerGapIcon,} from "@phosphor-icons/react";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";-import { useState } from "react";+import { useCallback, useState } from "react";import { toast } from "@reactive-resume/ui/components/toast";import { generateFilename } from "@reactive-resume/utils/file";import { cn } from "@reactive-resume/utils/style";@@ -235,6 +235,20 @@ export function ApplicationAiCopilot({ application }: Props) {}};+ // biome-ignore lint/correctness/useExhaustiveDependencies: keep review-requested callback dependencies explicit.+ const copyDraft = useCallback(async () => {+ try {+ if (!navigator.clipboard?.writeText) throw new Error("Clipboard unavailable");+ await navigator.clipboard.writeText(draft?.text ?? "");+ toast.add({ type: "success", description: t`Copied to clipboard.` });+ } catch {+ toast.add({+ type: "error",+ description: t`Could not copy to clipboard. Please copy the text manually.`,+ });+ }+ }, [draft?.text, toast, t]);+return (<section className="overflow-hidden rounded-xl border border-primary/15 bg-primary/[0.04]"><header className="flex items-center gap-2 px-3.5 pt-3">@@ -341,10 +355,7 @@ export function ApplicationAiCopilot({ application }: Props) {<buttontype="button"className="inline-flex items-center gap-1 text-muted-foreground text-xs hover:text-foreground"- onClick={() => {- void navigator.clipboard.writeText(draft.text);- toast.add({ type: "success", description: t`Copied to clipboard.` });- }}+ onClick={() => void copyDraft()}><CopyIcon className="size-3.5" /> <Trans>Copy</Trans></button>