Skip to content

Commit

Permalink
Update rss feed copy to clipboard to show checkmark instead of toast
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Jan 21, 2025
1 parent 66b90e0 commit c3c846f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions client/components/modals/rssfeed/OpenCloseModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="w-full relative">
<ui-text-input :value="feedUrl" readonly />

<span class="material-symbols absolute right-2 bottom-2 p-0.5 text-base transition-transform duration-100 text-gray-300 hover:text-white transform hover:scale-125 cursor-pointer" @click="copyToClipboard(feedUrl)">content_copy</span>
<span class="material-symbols absolute right-2 bottom-2 p-0.5 text-base transition-transform duration-100 transform hover:scale-125 cursor-pointer" :class="copiedToClipboard ? 'text-success' : 'text-gray-300 hover:text-white'" @click="copyToClipboard(feedUrl)">{{ copiedToClipboard ? 'check' : 'content_copy' }}</span>
</div>

<div v-if="currentFeed.meta" class="mt-5">
Expand Down Expand Up @@ -68,7 +68,8 @@ export default {
preventIndexing: true,
ownerName: '',
ownerEmail: ''
}
},
copiedToClipboard: false
}
},
watch: {
Expand Down Expand Up @@ -160,8 +161,11 @@ export default {
this.processing = false
})
},
copyToClipboard(str) {
this.$copyToClipboard(str, this)
async copyToClipboard(str) {
this.copiedToClipboard = await this.$copyToClipboard(str)
setTimeout(() => {
this.copiedToClipboard = false
}, 2000)
},
closeFeed() {
this.processing = true
Expand Down
12 changes: 8 additions & 4 deletions client/components/modals/rssfeed/ViewFeedModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="w-full relative">
<ui-text-input :value="feedUrl" readonly />
<span class="material-symbols absolute right-2 bottom-2 p-0.5 text-base transition-transform duration-100 text-gray-300 hover:text-white transform hover:scale-125 cursor-pointer" @click="copyToClipboard(feedUrl)">content_copy</span>
<span class="material-symbols absolute right-2 bottom-2 p-0.5 text-base transition-transform duration-100 transform hover:scale-125 cursor-pointer" :class="copiedToClipboard ? 'text-success' : 'text-gray-300 hover:text-white'" @click="copyToClipboard(feedUrl)">{{ copiedToClipboard ? 'check' : 'content_copy' }}</span>
</div>

<div v-if="feed.meta" class="mt-5">
Expand Down Expand Up @@ -56,7 +56,8 @@ export default {
},
data() {
return {
processing: false
processing: false,
copiedToClipboard: false
}
},
computed: {
Expand All @@ -76,8 +77,11 @@ export default {
}
},
methods: {
copyToClipboard(str) {
this.$copyToClipboard(str, this)
async copyToClipboard(str) {
this.copiedToClipboard = await this.$copyToClipboard(str)
setTimeout(() => {
this.copiedToClipboard = false
}, 2000)
}
},
mounted() {}
Expand Down

0 comments on commit c3c846f

Please sign in to comment.