Update wallet-profile.js
This commit is contained in:
parent
5c98615d54
commit
ea844c9298
@ -12,6 +12,7 @@ class WalletProfile extends connect(store)(LitElement) {
|
|||||||
wallet: { type: Object },
|
wallet: { type: Object },
|
||||||
nodeConfig: { type: Object },
|
nodeConfig: { type: Object },
|
||||||
accountInfo: { type: Object },
|
accountInfo: { type: Object },
|
||||||
|
imageUrl: { type: String },
|
||||||
theme: { type: String, reflect: true }
|
theme: { type: String, reflect: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,6 +31,7 @@ class WalletProfile extends connect(store)(LitElement) {
|
|||||||
names: [],
|
names: [],
|
||||||
addressInfo: {}
|
addressInfo: {}
|
||||||
}
|
}
|
||||||
|
this.imageUrl = ''
|
||||||
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
|
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,9 +58,9 @@ class WalletProfile extends connect(store)(LitElement) {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight:500;
|
font-weight:500;
|
||||||
display: inline-block;
|
|
||||||
width:100%;
|
width:100%;
|
||||||
padding-bottom:8px;
|
padding-bottom:8px;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#blocksMinted {
|
#blocksMinted {
|
||||||
@ -76,16 +78,37 @@ class WalletProfile extends connect(store)(LitElement) {
|
|||||||
margin-top:8px;
|
margin-top:8px;
|
||||||
font-size:11px;
|
font-size:11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.round-fullinfo {
|
||||||
|
position: relative;
|
||||||
|
width: 69px;
|
||||||
|
height: 69px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-info-logo {
|
||||||
|
width: 69px;
|
||||||
|
height: 69px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-block-child {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div id="profileInMenu">
|
<div id="profileInMenu">
|
||||||
<div style="padding: 8px 0;">
|
<div style="padding: 8px 0;">
|
||||||
<span id="accountName">
|
<div id="accountName">
|
||||||
${this.accountInfo.names.length !== 0 ? this.accountInfo.names[0].name : ''}
|
<div id="child inline-block-child" class="full-info-logo">${this.getAvatar()}</div>
|
||||||
</span>
|
|
||||||
${this.accountInfo.addressInfo ? html`<span style="margin-bottom: 8px; display: inline-block; font-size: 14px;">${translate("walletprofile.minterlevel")} - <span style="color: #03a9f4;">${this.accountInfo.addressInfo.level} ${this.accountInfo.addressInfo.flags === 1 ? html`<strong>(F)</strong>` : ''}</span>` : ''}
|
<div id="inline-block-child">
|
||||||
|
<div>${this.accountInfo.names.length !== 0 ? this.accountInfo.names[0].name : ''}</div>
|
||||||
|
<div>${this.accountInfo.addressInfo ? html`<span style="margin-bottom: 8px; display: inline-block; font-size: 14px;">${translate("walletprofile.minterlevel")} - <span style="color: #03a9f4;">${this.accountInfo.addressInfo.level} ${this.accountInfo.addressInfo.flags === 1 ? html`<strong>(F)</strong>` : ''}</span>` : ''}</div>
|
||||||
<p id="blocksMinted">${translate("walletprofile.blocksminted")} - ${this.accountInfo.addressInfo.blocksMinted + this.accountInfo.addressInfo.blocksMintedAdjustment}</p>
|
<p id="blocksMinted">${translate("walletprofile.blocksminted")} - ${this.accountInfo.addressInfo.blocksMinted + this.accountInfo.addressInfo.blocksMintedAdjustment}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<p id="address">${this.wallet.addresses[0].address}</p>
|
<p id="address">${this.wallet.addresses[0].address}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -106,6 +129,28 @@ class WalletProfile extends connect(store)(LitElement) {
|
|||||||
this.toast = container.appendChild(toast)
|
this.toast = container.appendChild(toast)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getAllWithAddress(myAddress) {
|
||||||
|
await this.getAddressUserAvatar(myAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
getAvatar() {
|
||||||
|
let numberBlocks = (this.accountInfo.addressInfo.blocksMinted + this.accountInfo.addressInfo.blocksMintedAdjustment);
|
||||||
|
if (Number.isNaN(numberBlocks) || numberBlocks == "" || numberBlocks === null) {
|
||||||
|
return html`<img class="round-fullinfo" src="/img/incognito.png">`
|
||||||
|
} else {
|
||||||
|
const avatarNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node]
|
||||||
|
const avatarUrl = avatarNode.protocol + '://' + avatarNode.domain + ':' + avatarNode.port
|
||||||
|
const url = `${avatarUrl}/arbitrary/THUMBNAIL/${this.accountInfo.names[0].name}/qortal_avatar?async=true&apiKey=${this.getApiKey()}`
|
||||||
|
return html`<img class="round-fullinfo" src="${url}" onerror="this.src='/img/incognito.png';" />`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getApiKey() {
|
||||||
|
const apiNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node];
|
||||||
|
let apiKey = apiNode.apiKey;
|
||||||
|
return apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
stateChanged(state) {
|
stateChanged(state) {
|
||||||
this.wallet = state.app.wallet
|
this.wallet = state.app.wallet
|
||||||
this.nodeConfig = state.app.nodeConfig
|
this.nodeConfig = state.app.nodeConfig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user