diff --git a/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list-css.src.js b/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list-css.src.js index 9e64410f..7e093d8b 100644 --- a/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list-css.src.js +++ b/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list-css.src.js @@ -423,6 +423,7 @@ export const pageStyles = css` display: flex; align-items: flex-start; flex-direction: column; + overflow-x: hidden; } .warning{ diff --git a/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list.src.js b/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list.src.js index c4159b16..406108df 100644 --- a/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list.src.js +++ b/qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list.src.js @@ -127,13 +127,23 @@ class SponsorshipList extends LitElement { return nodeInfo } - + async saveToClipboard(text) { + try { + await navigator.clipboard.writeText(this.privateRewardShareKey) + parentEpml.request('showSnackBar', text) + } catch (err) { + + console.error('Copy to clipboard error:', err) + } + } changeStatus(value){ this.status = value - + this.saveToClipboard('Copied to clipboard') } + + async atMount() { this.changeLanguage() @@ -279,7 +289,7 @@ class SponsorshipList extends LitElement { removeReceiver() } - async createRewardShare(publicKeyValue) { + async createRewardShare(publicKeyValue, isCopy) { this.openDialogRewardShare = true if(!publicKeyValue){ this.errorMessage = "unable to pull public key from the chain, account has no outgoing transactions" @@ -379,7 +389,7 @@ class SponsorshipList extends LitElement { if(txnResponse?.extraData?.rewardSharePrivateKey && (txnResponse?.data?.message?.includes('multiple') || txnResponse?.data?.message?.includes('SELF_SHARE_EXISTS')) ){ this.privateRewardShareKey = txnResponse?.extraData?.rewardSharePrivateKey - this.confirmRelationship(publicKeyValue) + this.confirmRelationship(publicKeyValue, isCopy) } else if (txnResponse.success === false && txnResponse?.message) { this.errorMessage = txnResponse?.message @@ -392,7 +402,7 @@ class SponsorshipList extends LitElement { this.privateRewardShareKey = txnResponse?.extraData?.rewardSharePrivateKey - this.confirmRelationship(publicKeyValue) + this.confirmRelationship(publicKeyValue, isCopy) } else { this.errorMessage = txnResponse?.data?.message || txnResponse?.message @@ -406,7 +416,7 @@ class SponsorshipList extends LitElement { - async confirmRelationship(recipientPublicKey){ + async confirmRelationship(recipientPublicKey, isCopy){ this.status = 2 let interval = null let stop = false @@ -431,7 +441,7 @@ class SponsorshipList extends LitElement { this.status = 3 - this.timer = countDown(180, ()=> this.changeStatus(4)); + this.timer = countDown(isCopy ? 5 : 180, ()=> this.changeStatus(4)); } } catch (error) { @@ -521,7 +531,7 @@ class SponsorshipList extends LitElement { { - this.createRewardShare(sponsorship?.publicKey) + this.createRewardShare(sponsorship?.publicKey, true) } }>copy
  • @@ -665,19 +675,22 @@ class SponsorshipList extends LitElement {
    ${this.privateRewardShareKey}
    - - - - + { + this.saveToClipboard('Copied to clipboard') + } }>copy +
  • ` : ''} + ${this.status === 4 ? '' : html`

    Warning: do not leave this plugin or close the Qortal UI until completion!

    ${this.errorMessage}

    + `} +