Browse Source

Merge pull request #62 from PhillipLangMartinez/bugfix/sponsorship-add-sponsor

fix bugs
qchat-updates
AlphaX-Projects 2 years ago committed by GitHub
parent
commit
3ddc704df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      qortal-ui-core/src/components/start-minting.js
  2. 30
      qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list.src.js

24
qortal-ui-core/src/components/start-minting.js

@ -188,23 +188,24 @@ class StartMinting extends connect(store)(LitElement) {
}
firstUpdated() {
this.getMintingAcccounts();
this.shadowRoot.querySelector('mdc-dialog--open').setAttribute('style', 'width: 100vw')
}
this.renderErrorMsg1() {
renderErrorMsg1() {
return html`${translate("startminting.smchange1")}`
}
this.renderErrorMsg2() {
renderErrorMsg2() {
return html`${translate("startminting.smchange2")}`
}
this.renderErrorMsg3() {
renderErrorMsg3() {
return html`${translate("startminting.smchange3")}`
}
this.renderErrorMsg4() {
renderErrorMsg4() {
return html`${translate("startminting.smchange4")}`
}
@ -347,7 +348,7 @@ renderStartMintingButton() {
const mintingAccountData = this.mintingAccountData;
const addressInfo = this.addressInfo;
const addressInfo = window.parent.reduxStore.getState().app.accountInfo.addressInfo
const address =
window.parent.reduxStore.getState().app?.selectedAddress?.address;
@ -358,16 +359,16 @@ renderStartMintingButton() {
const publicAddress =
window.parent.reduxStore.getState().app?.selectedAddress
?.base58PublicKey;
const findMintingAccount = mintingAccountData.find((ma) =>
ma.publicKey.includes(publicAddress)
ma.mintingAccount === address
);
const isMinterButKeyMintingKeyNotAssigned =
addressInfo?.error !== 124 &&
addressInfo?.level >= 1 &&
!findMintingAccount;
const makeTransactionRequest = async (lastRef) => {
let mylastRef = lastRef;
let rewarddialog1 = get('transactions.rewarddialog1');
@ -396,7 +397,7 @@ renderStartMintingButton() {
const getTxnRequestResponse = (txnResponse) => {
let err6string = get('rewardsharepage.rchange21');
if (txnResponse?.extraData?.rewardSharePrivateKey && (txnResponse?.data?.message.includes('multiple') || txnResponse?.data?.message.includes('SELF_SHARE_EXISTS'))) {
if (txnResponse?.extraData?.rewardSharePrivateKey && (txnResponse?.data?.message?.includes('multiple') || txnResponse?.data?.message?.includes('SELF_SHARE_EXISTS'))) {
return err6string
}
if (txnResponse.success === false && txnResponse.message) {
@ -531,7 +532,8 @@ renderStartMintingButton() {
</div>
</div>
<div class="modalFooter">
<mwc-button
${this.errorMsg || this.status === 5 ? html`
<mwc-button
slot="primaryAction"
@click=${() => {
this.openDialogRewardShare = false
@ -542,6 +544,8 @@ renderStartMintingButton() {
>
${translate("general.close")}
</mwc-button>
` : '' }
</div>
</div>

30
qortal-ui-plugins/plugins/core/sponsorship-list/sponsorship-list.src.js

@ -127,25 +127,15 @@ class SponsorshipList extends LitElement {
return nodeInfo
}
async saveToClipboard(text) {
try {
await navigator.clipboard.writeText(text)
parentEpml.request('showSnackBar', this.onSuccessMessage)
} catch (err) {
parentEpml.request('showSnackBar', this.onErrorMessage)
console.error('Copy to clipboard error:', err)
}
}
changeStatus(value){
this.status = value
this.saveToClipboard(translate(
"walletpage.wchange4"
))
}
async atMount() {
this.changeLanguage()
this.addressInfo =
@ -337,7 +327,7 @@ class SponsorshipList extends LitElement {
}
let lastRef = await getLastRef()
if (accountDetails.level >= 5) {
if (accountDetails.level >= 5 || accountDetails.flags === 1) {
this.status = 1
this.errorMessage = ""
@ -386,12 +376,12 @@ class SponsorshipList extends LitElement {
const getTxnRequestResponse = (txnResponse) => {
if(txnResponse?.extraData?.rewardSharePrivateKey && (txnResponse?.data?.message.includes('multiple') || txnResponse?.data?.message.includes('SELF_SHARE_EXISTS')) ){
if(txnResponse?.extraData?.rewardSharePrivateKey && (txnResponse?.data?.message?.includes('multiple') || txnResponse?.data?.message?.includes('SELF_SHARE_EXISTS')) ){
this.privateRewardShareKey = txnResponse?.extraData?.rewardSharePrivateKey
this.confirmRelationship(publicKeyValue)
} else if (txnResponse.success === false && txnResponse?.message) {
this.errorMessage = txnResponse?.message
this.isLoadingCreateSponsorship = false
throw(txnResponse?.message)
@ -400,11 +390,11 @@ class SponsorshipList extends LitElement {
!txnResponse.data.error
) {
this.privateRewardShareKey = txnResponse?.extraData?.rewardSharePrivateKey
this.confirmRelationship(publicKeyValue)
} else {
this.errorMessage = txnResponse?.data?.message || txnResponse?.message
this.isLoadingCreateSponsorship = false
throw(txnResponse?.data?.message || txnResponse?.message)
@ -671,7 +661,7 @@ class SponsorshipList extends LitElement {
${this.privateRewardShareKey && this.status === 4 ? html`
<li class=${`column word-break ${this.status < 4 && 'inactiveText' }`}>
<p>Copy the key below and share it with your sponsored person.</p>
<p style="work-break: break-word">Copy the key below and share it with your sponsored person.</p>
<div style="background: #eee; padding: 8px; margin: 8px 0; border-radius: 5px;">
<span style="color: #000;">${this.privateRewardShareKey}</span>
</div>
@ -684,7 +674,7 @@ class SponsorshipList extends LitElement {
</ul>
<div class="warning column">
<p>
Warning: do not close the Qortal UI until completion!
Warning: do not leave this plugin or close the Qortal UI until completion!
</p>
<p class="message-error">${this.errorMessage}</p>
</div>

Loading…
Cancel
Save