From a9f3d37343353ce8450b5983a711403140b886c7 Mon Sep 17 00:00:00 2001 From: jackiettran <41605212+jackiettran@users.noreply.github.com> Date: Fri, 21 Nov 2025 22:20:07 -0500 Subject: [PATCH] copy link buttons for item detail and forum post --- frontend/src/pages/ForumPostDetail.tsx | 22 +++++++++++++++++++++- frontend/src/pages/ItemDetail.tsx | 22 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/ForumPostDetail.tsx b/frontend/src/pages/ForumPostDetail.tsx index ae5b1c5..3970c66 100644 --- a/frontend/src/pages/ForumPostDetail.tsx +++ b/frontend/src/pages/ForumPostDetail.tsx @@ -222,6 +222,16 @@ const ForumPostDetail: React.FC = () => { setDeletionReason(''); }; + const handleCopyLink = async () => { + const shareUrl = `${window.location.origin}/forum/${post?.id}`; + + try { + await navigator.clipboard.writeText(shareUrl); + } catch (err) { + console.error("Copy to clipboard failed:", err); + } + }; + const formatDate = (dateString: string) => { const date = new Date(dateString); return date.toLocaleString(undefined, { @@ -292,7 +302,17 @@ const ForumPostDetail: React.FC = () => { Pinned )} -