From 6391d8b0c6ef0b73248d73010da3abffd28185ce Mon Sep 17 00:00:00 2001 From: shrimbly Date: Wed, 14 Jan 2026 22:15:38 +1300 Subject: [PATCH] feat: add copy button to toast notifications Allows users to copy error messages and details to clipboard for easier debugging and sharing. Co-Authored-By: Claude Opus 4.5 --- src/components/Toast.tsx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index 527e755f..105c364b 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -54,12 +54,23 @@ const typeIcons = { export function Toast() { const { message, type, persistent, details, hide } = useToast(); const [isExpanded, setIsExpanded] = useState(false); + const [copied, setCopied] = useState(false); useEffect(() => { // Reset expanded state when toast changes setIsExpanded(false); + setCopied(false); }, [message]); + const handleCopy = async () => { + const textToCopy = details ? `${message}\n\n${details}` : message; + if (textToCopy) { + await navigator.clipboard.writeText(textToCopy); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } + }; + useEffect(() => { if (message && !persistent) { const timer = setTimeout(() => { @@ -79,9 +90,25 @@ export function Toast() {
{typeIcons[type]} {message} +