From 80eaf1c8ea326a9204c8d2e0de90286f9fc2cb5b Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 26 Jul 2022 18:34:40 +0200 Subject: [PATCH] add fucntionality to copy link and text after creating a transaction link --- frontend/src/components/ClipboardCopy.vue | 20 +++++++++++++++++++ .../GddSend/TransactionResultLink.vue | 14 ++++++++----- frontend/src/pages/Send.vue | 9 ++++++++- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/ClipboardCopy.vue b/frontend/src/components/ClipboardCopy.vue index 7a6cf0ec1..78af3c772 100644 --- a/frontend/src/components/ClipboardCopy.vue +++ b/frontend/src/components/ClipboardCopy.vue @@ -3,6 +3,9 @@ + + {{ $t('gdd_per_link.copy-with-text') }} + {{ $t('gdd_per_link.copy') }} @@ -22,6 +25,8 @@ export default { name: 'ClipboardCopy', props: { link: { type: String, required: true }, + amount: { type: Number, required: true }, + memo: { type: String, required: true }, }, data() { return { @@ -40,6 +45,21 @@ export default { this.toastError(this.$t('gdd_per_link.not-copied')) }) }, + copyLinkWithText() { + navigator.clipboard + .writeText( + `${this.link} +${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido. +"${this.memo}"`, + ) + .then(() => { + this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) + }) + .catch(() => { + this.canCopyLink = false + this.toastError(this.$t('gdd_per_link.not-copied')) + }) + }, }, } diff --git a/frontend/src/components/GddSend/TransactionResultLink.vue b/frontend/src/components/GddSend/TransactionResultLink.vue index 04445acfe..81d18644d 100644 --- a/frontend/src/components/GddSend/TransactionResultLink.vue +++ b/frontend/src/components/GddSend/TransactionResultLink.vue @@ -3,7 +3,12 @@
{{ $t('gdd_per_link.created') }}
- +
@@ -27,10 +32,9 @@ export default { FigureQrCode, }, props: { - link: { - type: String, - required: true, - }, + link: { type: String, required: true }, + amount: { type: Number, required: true }, + memo: { type: String, required: true }, }, data() { return { diff --git a/frontend/src/pages/Send.vue b/frontend/src/pages/Send.vue index cd5f8f572..85ac53a52 100644 --- a/frontend/src/pages/Send.vue +++ b/frontend/src/pages/Send.vue @@ -41,7 +41,12 @@ >
@@ -145,6 +150,8 @@ export default { .then((result) => { this.$emit('set-tunneled-email', null) this.link = result.data.createTransactionLink.link + this.amount = this.transactionData.amount + this.memo = this.transactionData.memo this.transactionData = { ...EMPTY_TRANSACTION_DATA } this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink this.updateTransactions({})