mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-24 03:47:53 +00:00
fix avatar issue
This commit is contained in:
parent
e07884c1e1
commit
fe9af1dc82
@ -108,9 +108,10 @@ class ChatHead extends LitElement {
|
||||
this.isImageLoaded = false
|
||||
this.imageFetches = 0
|
||||
this.lastReadMessageTimestamp = 0
|
||||
this.loggedInAddress = window.parent.reduxStore.getState().app.selectedAddress.address
|
||||
}
|
||||
|
||||
createImage(imageUrl) {
|
||||
createImage(imageUrl) {
|
||||
const imageHTMLRes = new Image();
|
||||
imageHTMLRes.src = imageUrl;
|
||||
imageHTMLRes.style= "width:40px; height:40px; float: left; border-radius:50%";
|
||||
@ -125,7 +126,7 @@ class ChatHead extends LitElement {
|
||||
setTimeout(() => {
|
||||
this.imageFetches = this.imageFetches + 1;
|
||||
imageHTMLRes.src = imageUrl;
|
||||
}, 500);
|
||||
}, 750);
|
||||
} else {
|
||||
|
||||
|
||||
@ -134,9 +135,9 @@ class ChatHead extends LitElement {
|
||||
};
|
||||
return imageHTMLRes;
|
||||
}
|
||||
updated(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
let avatarImg = '';
|
||||
let backupAvatarImg = ''
|
||||
@ -158,7 +159,10 @@ class ChatHead extends LitElement {
|
||||
if(this.activeChatHeadUrl === this.chatInfo.url){
|
||||
isUnread = false
|
||||
}
|
||||
|
||||
|
||||
if(this.chatInfo.sender === this.loggedInAddress){
|
||||
isUnread = false
|
||||
}
|
||||
return html`
|
||||
<li @click=${() => this.getUrl(this.chatInfo.url)} class="clearfix ${this.activeChatHeadUrl === this.chatInfo.url ? 'active' : ''}">
|
||||
${this.isImageLoaded ? html`${avatarImg}` : html`` }
|
||||
@ -221,6 +225,14 @@ class ChatHead extends LitElement {
|
||||
return true
|
||||
}
|
||||
if(changedProperties.has('chatInfo')){
|
||||
|
||||
const prevChatInfo = changedProperties.get('chatInfo')
|
||||
|
||||
if(prevChatInfo.address !== this.chatInfo.address){
|
||||
|
||||
this.isImageLoaded = false
|
||||
this.requestUpdate()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import { Epml } from '../../../../epml.js';
|
||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate';
|
||||
import { qchatStyles } from './q-chat-css.src.js'
|
||||
import WebWorker from 'web-worker:./computePowWorker.src.js';
|
||||
import {repeat} from 'lit/directives/repeat.js';
|
||||
|
||||
registerTranslateConfig({
|
||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||
@ -856,14 +857,11 @@ class Chat extends LitElement {
|
||||
}
|
||||
|
||||
renderChatHead(chatHeadArr) {
|
||||
|
||||
let tempUrl = document.location.href
|
||||
let splitedUrl = decodeURI(tempUrl).split('?')
|
||||
// let activeChatHeadUrl = splitedUrl[1] === undefined ? '' : splitedUrl[1]
|
||||
|
||||
|
||||
return chatHeadArr.map(eachChatHead => {
|
||||
return html`<chat-head activeChatHeadUrl=${this.activeChatHeadUrl} .setActiveChatHeadUrl=${(val)=> this.setActiveChatHeadUrl(val)} chatInfo=${JSON.stringify(eachChatHead)}></chat-head>`
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
renderChatPage() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user