diff --git a/assets/js/alpine_helpers.js b/assets/js/alpine_helpers.js
index eaf5cc0..56a7d93 100644
--- a/assets/js/alpine_helpers.js
+++ b/assets/js/alpine_helpers.js
@@ -22,6 +22,12 @@ window.copyTextToClipboard = async (text) => {
}
}
+window.copyWithCallbacks = async (text, onCopy, onAfterDelay, delay = 4000) => {
+ await window.copyTextToClipboard(text)
+ onCopy()
+ setTimeout(onAfterDelay, delay)
+}
+
window.markVersionAsSeen = (versionString) => {
localStorage.setItem('seenVersion', versionString)
}
diff --git a/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex b/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex
index 964395c..1783ea6 100644
--- a/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex
+++ b/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex
@@ -3,15 +3,29 @@
copied = false, 4000)
- "}
+ copyWithCallbacks(
+ '#{rss_feed_url(@conn, @source)}',
+ () => copied = true,
+ () => copied = false
+ )
+ "}
>
Copy RSS Feed
<.icon name="hero-check" class="ml-2 h-4 w-4" />
+ <:option>
+ copied = true,
+ () => copied = false
+ )
+ "}>
+ Copy JSON
+ <.icon name="hero-check" class="ml-2 h-4 w-4" />
+
+
<:option :if={@source.download_media}>
<.link
href={~p"/sources/#{@source}/force_download"}