diff --git a/apps/web/src/features/applications/components/application-ai-copilot.tsx b/apps/web/src/features/applications/components/application-ai-copilot.tsx index 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 (
@@ -341,10 +355,7 @@ export function ApplicationAiCopilot({ application }: Props) {