diff --git a/core/src/components/settings-view/account-view.js b/core/src/components/settings-view/account-view.js index 191fc0b4..6f4758d6 100644 --- a/core/src/components/settings-view/account-view.js +++ b/core/src/components/settings-view/account-view.js @@ -1,7 +1,7 @@ -import {css, html, LitElement} from 'lit' -import {connect} from 'pwa-helpers' -import {store} from '../../store.js' -import {translate} from 'lit-translate' +import { LitElement, html, css } from 'lit' +import { connect } from 'pwa-helpers' +import { store } from '../../store.js' +import { get, translate } from 'lit-translate' class AccountView extends connect(store)(LitElement) { static get properties() { @@ -65,7 +65,7 @@ class AccountView extends connect(store)(LitElement) { constructor() { super() - this.accountInfo = { names: [], addressInfo: {} } + this.accountInfo = store.getState().app.accountInfo this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light' this.switchAvatar = '' } @@ -76,7 +76,7 @@ class AccountView extends connect(store)(LitElement) {
${this.getAvatar()}
- ${this.accountInfo.names.length !== 0 ? this.accountInfo.names[0].name : 'No Registered Name'} + ${this.accountInfo.names.length !== 0 ? this.accountInfo.names[0].name : get("chatpage.cchange15")}
${translate("settings.address")}: @@ -98,21 +98,24 @@ class AccountView extends connect(store)(LitElement) { } getAvatar() { - 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()}` - const numberBlocks = (this.accountInfo.addressInfo.blocksMinted + this.accountInfo.addressInfo.blocksMintedAdjustment) - if (this.switchAvatar === 'light') { - if (Number.isNaN(numberBlocks) || numberBlocks == "" || numberBlocks === null) { + if (this.accountInfo.names.length === 0) { return html`` } else { + const avatarName = this.accountInfo.names[0].name + 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/${avatarName}/qortal_avatar?async=true&apiKey=${this.getApiKey()}` return html`` } } else if (this.switchAvatar === 'dark') { - if (Number.isNaN(numberBlocks) || numberBlocks == "" || numberBlocks === null) { + if (this.accountInfo.names.length === 0) { return html`` } else { + const avatarName = this.accountInfo.names[0].name + 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/${avatarName}/qortal_avatar?async=true&apiKey=${this.getApiKey()}` return html`` } } @@ -133,4 +136,4 @@ class AccountView extends connect(store)(LitElement) { } } -window.customElements.define('account-view', AccountView) +window.customElements.define('account-view', AccountView) \ No newline at end of file