summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-12 15:22:05 -0500
committerBen Sima <ben@bsima.me>2025-11-12 15:22:05 -0500
commit8c05cb04366b9b5d3c6867e432dd4a18714796cd (patch)
treeecbd085c1c9f7dcdea32b8498d345d8deea788bc
parente9f7c7d3b6f8927470d86d95e14064d18dbb7505 (diff)
Make RSS subscribe link inline with copy-to-clipboard
Subscribe link now appears inline next to label. Click copies URL to clipboard and shows 'Copied!' feedback for 2 seconds. Link truncates if too long to fit in bounding box.
-rw-r--r--Biz/PodcastItLater/Web.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py
index 6c4d250..c4df33d 100644
--- a/Biz/PodcastItLater/Web.py
+++ b/Biz/PodcastItLater/Web.py
@@ -611,19 +611,31 @@ class EpisodeList(Component[AnyChildren, EpisodeListAttrs]):
"Recent Episodes",
classes=["mb-3"],
),
- # RSS feed link
+ # RSS feed link with copy-to-clipboard
html.div(
html.div(
html.i(classes=["bi", "bi-rss-fill", "me-2"]),
- html.strong("Subscribe in your podcast app:"),
- classes=["mb-2"],
- ),
- html.div(
- html.code(
+ html.strong("Subscribe in your podcast app: "),
+ html.a(
rss_url or "",
- classes=["text-break", "user-select-all"],
+ href="#",
+ id="rss-link",
+ on_click=f"navigator.clipboard.writeText('{rss_url}'); "
+ "document.getElementById('copy-feedback').classList.remove('d-none'); " # noqa: E501
+ "setTimeout(() => document.getElementById('copy-feedback').classList.add('d-none'), 2000); " # noqa: E501
+ "return false;",
+ classes=[
+ "text-decoration-none",
+ "text-truncate",
+ "d-inline-block",
+ ],
),
- classes=["mb-3", "p-2", "bg-light", "rounded"],
+ html.span(
+ " ✓ Copied!",
+ id="copy-feedback",
+ classes=["text-success", "small", "d-none"],
+ ),
+ classes=["mb-3"],
),
)
if rss_url