4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

Merge pull request #67 from PhillipLangMartinez/bugfix/is-already-sponsored-change-logic

Bugfix/is already sponsored change logic
This commit is contained in:
AlphaX-Projects 2022-08-31 07:43:26 +02:00 committed by GitHub
commit b80766efc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 11 deletions

View File

@ -98,8 +98,7 @@ class BecomeMinter extends LitElement {
async atMount() {
this.changeLanguage();
this.addressInfo =
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
this.isPageLoading = true;
try {
const [nodeInfo, myRewardShareArray, mintingaccounts] =
@ -117,6 +116,8 @@ class BecomeMinter extends LitElement {
myRewardShareArray[0]?.rewardSharePublicKey;
this.isPageLoading = false;
this.mintingAccountData = mintingaccounts;
this.addressInfo =
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
} catch (error) {
console.error(error);
@ -147,15 +148,18 @@ class BecomeMinter extends LitElement {
}
render() {
const findMintingAccount = this.mintingAccountData?.find(
(ma) => ma.recipientAccount === window.parent.reduxStore.getState().app?.selectedAddress
?.address
(ma) => ma.recipientAccount === window.parent.reduxStore.getState().app?.selectedAddress
?.address
);
const isAlreadySponsored =
this.addressInfo?.error !== 124 &&
this.addressInfo?.level === 0 &&
findMintingAccount;
this.addressInfo?.blocksMinted > 0 && this.addressInfo?.blocksMinted < 7200
return html`
${this.isPageLoading
@ -176,19 +180,20 @@ class BecomeMinter extends LitElement {
</div>
${isAlreadySponsored
? ''
: html`
? ''
: html`
<not-sponsored
.atMount="${() => this.atMount()}"
></not-sponsored>
`}
${!isAlreadySponsored
? ''
: html`
? ''
: html`
<yes-sponsored
.rewardSharePublicKey=${this
.rewardSharePublicKey}
.rewardSharePublicKey}
.addressInfo=${this.addressInfo}
.isMinting=${!!findMintingAccount}
></yes-sponsored>
`}
</div>

View File

@ -19,6 +19,7 @@ class YesSponsored extends LitElement {
return {
addressInfo: { type: Object },
rewardSharePublicKey: { type: String },
isMinting: {type: Boolean}
};
}
@ -27,6 +28,7 @@ class YesSponsored extends LitElement {
this.addressInfo = {};
this.rewardSharePublicKey = '';
this.isMinting = false
}
static styles = [pageStyles];
@ -63,7 +65,12 @@ class YesSponsored extends LitElement {
<hr
style="color: #eee; border-radius: 90%; margin-bottom: 1rem;"
/>
${this.isMinting ? html`
<h4>${translate('becomeMinterPage.bchange12')}</h4>
` : html`
<h4>${translate('mintingpage.mchange9')}</h4>
`}
</div>
<div class="content-box">
<span class="title"