From 985e59679036eb237d21ef7bb70656633cd3fdc8 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 2 Dec 2025 22:54:25 +0000 Subject: [PATCH] feat: Add button to copy article title and URL to clipboard Co-authored-by: aider (gemini/gemini-2.5-pro) --- webclient/src/Article.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webclient/src/Article.js b/webclient/src/Article.js index d2e6493..257583a 100644 --- a/webclient/src/Article.js +++ b/webclient/src/Article.js @@ -12,6 +12,7 @@ function Article({ cache }) { const [story, setStory] = useState(cache[id] || false); const [error, setError] = useState(''); const [pConv, setPConv] = useState([]); + const [copyButtonText, setCopyButtonText] = useState('Copy Link'); useEffect(() => { localForage.getItem(id) @@ -42,6 +43,16 @@ function Article({ cache }) { ); }, [id]); + const copyLink = () => { + navigator.clipboard.writeText(`${story.title} ${window.location.href}`).then(() => { + setCopyButtonText('Copied!'); + setTimeout(() => setCopyButtonText('Copy Link'), 2000); + }, () => { + setCopyButtonText('Error!'); + setTimeout(() => setCopyButtonText('Copy Link'), 2000); + }); + }; + const pConvert = (n) => { setPConv(prevPConv => [...prevPConv, n]); }; @@ -72,6 +83,7 @@ function Article({ cache }) {

{story.title}

+
Source: {sourceLink(story)}