Compare commits

...

7 Commits

Author SHA1 Message Date
482753e96a Add a copy button to the article title 2025-12-02 23:19:31 +00:00
169a84faa1 fix: Align article title and copy button, correct icon font
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-02 23:19:31 +00:00
6fa929fb1f style: Update copy link button font 2025-12-02 23:19:31 +00:00
5f02a95cf3 fix: Improve copy button icon display and alignment
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-02 23:19:31 +00:00
1789f88d4d style: Style copy button icon 2025-12-02 23:19:31 +00:00
f5eab47496 feat: Use icons for copy link button feedback
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-02 23:19:31 +00:00
985e596790 feat: Add button to copy article title and URL to clipboard
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
2025-12-02 23:19:31 +00:00
5 changed files with 33 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ function Article({ cache }) {
const [story, setStory] = useState(cache[id] || false); const [story, setStory] = useState(cache[id] || false);
const [error, setError] = useState(''); const [error, setError] = useState('');
const [pConv, setPConv] = useState([]); const [pConv, setPConv] = useState([]);
const [copyButtonText, setCopyButtonText] = useState('\ue92c');
useEffect(() => { useEffect(() => {
localForage.getItem(id) localForage.getItem(id)
@@ -42,6 +43,16 @@ function Article({ cache }) {
); );
}, [id]); }, [id]);
const copyLink = () => {
navigator.clipboard.writeText(`${story.title}:\n${window.location.href}`).then(() => {
setCopyButtonText('\uea10');
setTimeout(() => setCopyButtonText('\ue92c'), 2000);
}, () => {
setCopyButtonText('\uea0f');
setTimeout(() => setCopyButtonText('\ue92c'), 2000);
});
};
const pConvert = (n) => { const pConvert = (n) => {
setPConv(prevPConv => [...prevPConv, n]); setPConv(prevPConv => [...prevPConv, n]);
}; };
@@ -71,7 +82,7 @@ function Article({ cache }) {
<meta name="robots" content="noindex" /> <meta name="robots" content="noindex" />
</Helmet> </Helmet>
<h1>{story.title}</h1> <h1>{story.title} <button className='copy-button' onClick={copyLink}>{copyButtonText}</button></h1>
<div className='info'> <div className='info'>
Source: {sourceLink(story)} Source: {sourceLink(story)}

View File

@@ -101,7 +101,7 @@ function Feed({ updateCache }) {
<title>QotNews</title> <title>QotNews</title>
<meta name="robots" content="index" /> <meta name="robots" content="index" />
</Helmet> </Helmet>
{loadingStatus && <p>Fetching stories {loadingStatus.current} / {loadingStatus.total}...</p>} {loadingStatus && <p>Preloading stories {loadingStatus.current} / {loadingStatus.total}...</p>}
{error && {error &&
<details style={{marginBottom: '1rem'}}> <details style={{marginBottom: '1rem'}}>
<summary>Connection error? Click to expand.</summary> <summary>Connection error? Click to expand.</summary>

View File

@@ -121,6 +121,13 @@ span.source {
border-bottom: 1px solid #222222; border-bottom: 1px solid #222222;
} }
.article-title {
display: flex;
align-items: center;
margin-top: 0.67em;
margin-bottom: 0.67em;
}
.article h1 { .article h1 {
font-size: 1.6rem; font-size: 1.6rem;
} }
@@ -260,3 +267,11 @@ span.source {
.search form { .search form {
display: inline; display: inline;
} }
.copy-button {
font: 1.5rem/1 'icomoon2';
background: transparent;
border: none;
cursor: pointer;
vertical-align: middle;
}

View File

@@ -26,3 +26,8 @@
font-family: 'Icomoon'; font-family: 'Icomoon';
src: url('icomoon.ttf') format('truetype'); src: url('icomoon.ttf') format('truetype');
} }
@font-face {
font-family: 'Icomoon2';
src: url('icomoon2.ttf') format('truetype');
}

Binary file not shown.