From 52b8d87d02e14812fd49cd70f574fa81bc437eb4 Mon Sep 17 00:00:00 2001
From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>
Date: Thu, 3 Aug 2023 13:26:14 +0200
Subject: feat: Copy release notes to clipboard (#464)

* feat: Add button to copy release note to clipboard

Adds a button to dev view to copy the generated release notes to clip
board

* feat: Copy to clipboard after generating
release notes

This saves an extra step when doing releases
---
 src-vue/src/views/DeveloperView.vue | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'src-vue/src/views/DeveloperView.vue')

diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue
index f60d47b1..de83c9a8 100644
--- a/src-vue/src/views/DeveloperView.vue
+++ b/src-vue/src/views/DeveloperView.vue
@@ -123,6 +123,10 @@
                 Compare Tags
             </el-button>
 
+            <el-button type="primary" @click="copyReleaseNotesToClipboard">
+                Copy to clipboard
+            </el-button>
+
             <el-input
                 v-model="release_notes_text"
                 type="textarea"
@@ -262,6 +266,7 @@ export default defineComponent({
                 .then((message) => {
                     this.release_notes_text = message;
                     showNotification("Done", "Generated release notes");
+                    this.copyReleaseNotesToClipboard();
                 })
                 .catch((error) => {
                     showErrorNotification(error);
@@ -336,6 +341,15 @@ export default defineComponent({
                 .then((message) => { showNotification(`NSProton Version`, message as string); })
                 .catch((error) => { showNotification(`Error`, error, "error"); })
         },
+        async copyReleaseNotesToClipboard() {
+            navigator.clipboard.writeText(this.release_notes_text)
+                .then(() => {
+                    showNotification("Copied to clipboard");
+                })
+                .catch(() => {
+                    showErrorNotification("Failed copying to clipboard");
+                });
+        },
     }
 });
 </script>
-- 
cgit v1.2.3

