fix issues with tipuser

This commit is contained in:
Phillip 2023-01-14 11:07:25 -05:00
parent 17d0efefaa
commit 6767b40406
8 changed files with 33 additions and 47 deletions

View File

@ -97,7 +97,9 @@ class ChatPage extends LitElement {
myTrimmedMeassage: { type: String }, myTrimmedMeassage: { type: String },
editor: {type: Object}, editor: {type: Object},
currentEditor: {type: String}, currentEditor: {type: String},
isEnabledChatEnter: {type: Boolean} isEnabledChatEnter: {type: Boolean},
openTipUser: { type: Boolean },
setOpenTipUser: {attribute: false}
} }
} }
@ -887,6 +889,10 @@ class ChatPage extends LitElement {
this.requestUpdate() this.requestUpdate()
} }
setOpenTipUser(props) {
this.openTipUser = props;
}
toggleEnableChatEnter(){ toggleEnableChatEnter(){
localStorage.setItem('isEnabledChatEnter', !this.isEnabledChatEnter ) localStorage.setItem('isEnabledChatEnter', !this.isEnabledChatEnter )
this.isEnabledChatEnter = !this.isEnabledChatEnter this.isEnabledChatEnter = !this.isEnabledChatEnter
@ -1229,7 +1235,9 @@ class ChatPage extends LitElement {
.groupAdmin=${this.groupAdmin} .groupAdmin=${this.groupAdmin}
.leaveGroupObj=${this.groupInfo} .leaveGroupObj=${this.groupInfo}
.setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
.chatEditor=${this.chatEditor}> .setOpenTipUser=${(val) => this.setOpenTipUser(val)}
?openTipUser=${this.openTipUser}
>
</chat-right-panel> </chat-right-panel>
</div> </div>
</div> </div>
@ -1356,13 +1364,11 @@ class ChatPage extends LitElement {
} }
initialChat(e) { initialChat(e) {
if (this.editor && !this.editor.isFocused && this.currentEditor === '_chatEditorDOM' && !this.openForwardOpen) { if (this.editor && !this.editor.isFocused && this.currentEditor === '_chatEditorDOM' && !this.openForwardOpen && !this.openTipUser) {
// WARNING: Deprecated methods from KeyBoard Event // WARNING: Deprecated methods from KeyBoard Event
if (e.code === "Space" || e.keyCode === 32 || e.which === 32) { if (e.code === "Space" || e.keyCode === 32 || e.which === 32) {
// this.chatEditor.insertText('&nbsp;');
} else if (inputKeyCodes.includes(e.keyCode)) { } else if (inputKeyCodes.includes(e.keyCode)) {
this.editor.commands.insertContent(e.key) this.editor.commands.insertContent(e.key)
// this.chatEditor.insertText(e.key);
this.editor.commands.focus('end') this.editor.commands.focus('end')
} else { } else {
this.editor.commands.focus('end') this.editor.commands.focus('end')
@ -1664,12 +1670,12 @@ class ChatPage extends LitElement {
} }
renderChatScroller() { renderChatScroller() {
console.log('renderChatScroller')
return html` return html`
<chat-scroller <chat-scroller
chatId=${this.chatId} chatId=${this.chatId}
.messages=${this.messagesRendered} .messages=${this.messagesRendered}
.escapeHTML=${escape} .escapeHTML=${escape}
.chatEditor=${this.chatEditor}
.getOldMessage=${this.getOldMessage} .getOldMessage=${this.getOldMessage}
.setRepliedToMessageObj=${(val) => this.setRepliedToMessageObj(val)} .setRepliedToMessageObj=${(val) => this.setRepliedToMessageObj(val)}
.setEditedMessageObj=${(val) => this.setEditedMessageObj(val)} .setEditedMessageObj=${(val) => this.setEditedMessageObj(val)}
@ -1681,6 +1687,8 @@ class ChatPage extends LitElement {
.setIsLoadingMessages=${(val) => this.setIsLoadingMessages(val)} .setIsLoadingMessages=${(val) => this.setIsLoadingMessages(val)}
.setForwardProperties=${(forwardedMessage)=> this.setForwardProperties(forwardedMessage)} .setForwardProperties=${(forwardedMessage)=> this.setForwardProperties(forwardedMessage)}
.setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
.setOpenTipUser=${(val) => this.setOpenTipUser(val)}
?openTipUser=${this.openTipUser}
> >
</chat-scroller> </chat-scroller>
` `

View File

@ -29,12 +29,12 @@ class ChatRightPanel extends LitElement {
setOpenPrivateMessage: { attribute: false }, setOpenPrivateMessage: { attribute: false },
openTipUser: { type: Boolean }, openTipUser: { type: Boolean },
userName: { type: String }, userName: { type: String },
chatEditor: { type: Object },
walletBalance: { type: Number }, walletBalance: { type: Number },
sendMoneyLoading: { type: Boolean }, sendMoneyLoading: { type: Boolean },
btnDisable: { type: Boolean }, btnDisable: { type: Boolean },
errorMessage: { type: String }, errorMessage: { type: String },
successMessage: { type: String } successMessage: { type: String },
setOpenTipUser: { attribute: false },
} }
} }
@ -57,7 +57,6 @@ class ChatRightPanel extends LitElement {
this.btnDisable = false this.btnDisable = false
this.errorMessage = "" this.errorMessage = ""
this.successMessage = "" this.successMessage = ""
this.setOpenTipUser = this.setOpenTipUser.bind(this);
this.setOpenUserInfo = this.setOpenUserInfo.bind(this); this.setOpenUserInfo = this.setOpenUserInfo.bind(this);
} }
@ -233,9 +232,7 @@ class ChatRightPanel extends LitElement {
} }
} }
setOpenTipUser(props) {
this.openTipUser = props
}
setOpenUserInfo(props) { setOpenUserInfo(props) {
this.openUserInfo = props this.openUserInfo = props
@ -312,20 +309,18 @@ class ChatRightPanel extends LitElement {
.setOpenUserInfo=${(val) => this.setOpenUserInfo(val)} .setOpenUserInfo=${(val) => this.setOpenUserInfo(val)}
.setOpenTipUser=${(val) => this.setOpenTipUser(val)} .setOpenTipUser=${(val) => this.setOpenTipUser(val)}
.setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
.chatEditor=${this.chatEditor}
.userName=${this.userName} .userName=${this.userName}
.selectedHead=${this.selectedHead} .selectedHead=${this.selectedHead}
></user-info> ></user-info>
</wrapper-modal> </wrapper-modal>
<wrapper-modal <wrapper-modal
zIndex=${55}
.onClickFunc=${() => { .onClickFunc=${() => {
this.openTipUser = false; this.setOpenTipUser(false);
this.chatEditor.enable();
}} }}
style=${this.openTipUser ? "display: block" : "display: none"}> style=${this.openTipUser ? "display: block" : "display: none"}>
<tip-user <tip-user
.closeTipUser=${this.openUserInfo} .closeTipUser=${this.openUserInfo}
.chatEditor=${this.chatEditor}
.userName=${this.userName} .userName=${this.userName}
.setOpenTipUser=${(val) => this.setOpenTipUser(val)} .setOpenTipUser=${(val) => this.setOpenTipUser(val)}
> >

View File

@ -35,7 +35,6 @@ class ChatScroller extends LitElement {
hideMessages: { type: Array }, hideMessages: { type: Array },
setRepliedToMessageObj: { attribute: false }, setRepliedToMessageObj: { attribute: false },
setEditedMessageObj: { attribute: false }, setEditedMessageObj: { attribute: false },
focusChatEditor: { attribute: false },
sendMessage: { attribute: false }, sendMessage: { attribute: false },
sendMessageForward: { attribute: false }, sendMessageForward: { attribute: false },
showLastMessageRefScroller: { attribute: false }, showLastMessageRefScroller: { attribute: false },
@ -43,7 +42,6 @@ class ChatScroller extends LitElement {
isLoadingMessages: { type: Boolean}, isLoadingMessages: { type: Boolean},
setIsLoadingMessages: { attribute: false }, setIsLoadingMessages: { attribute: false },
chatId: { type: String }, chatId: { type: String },
chatEditor: { type: Object },
setForwardProperties: { attribute: false }, setForwardProperties: { attribute: false },
setOpenPrivateMessage: { attribute: false }, setOpenPrivateMessage: { attribute: false },
openTipUser: { type: Boolean }, openTipUser: { type: Boolean },
@ -60,7 +58,6 @@ class ChatScroller extends LitElement {
this.messages = [] this.messages = []
this._upObserverhandler = this._upObserverhandler.bind(this) this._upObserverhandler = this._upObserverhandler.bind(this)
this._downObserverHandler = this._downObserverHandler.bind(this) this._downObserverHandler = this._downObserverHandler.bind(this)
this.setOpenTipUser = this.setOpenTipUser.bind(this)
this.setOpenUserInfo = this.setOpenUserInfo.bind(this) this.setOpenUserInfo = this.setOpenUserInfo.bind(this)
this.setUserName = this.setUserName.bind(this) this.setUserName = this.setUserName.bind(this)
this.myAddress = window.parent.reduxStore.getState().app.selectedAddress.address this.myAddress = window.parent.reduxStore.getState().app.selectedAddress.address
@ -143,14 +140,13 @@ class ChatScroller extends LitElement {
</ul> </ul>
<wrapper-modal <wrapper-modal
.onClickFunc=${() => { .onClickFunc=${() => {
this.openTipUser = false; this.setOpenTipUser(false);
this.chatEditor.enable();
}} }}
zIndex=${55}
style=${this.openTipUser ? "display: block;" : "display: none;"}> style=${this.openTipUser ? "display: block;" : "display: none;"}>
<tip-user <tip-user
.closeTipUser=${!this.openTipUser} .closeTipUser=${!this.openTipUser}
.chatEditor=${this.chatEditor}
.focusChatEditor=${this.focusChatEditor}
.userName=${this.userName} .userName=${this.userName}
.setOpenTipUser=${(val) => this.setOpenTipUser(val)}> .setOpenTipUser=${(val) => this.setOpenTipUser(val)}>
</tip-user> </tip-user>
@ -158,7 +154,6 @@ class ChatScroller extends LitElement {
<wrapper-modal <wrapper-modal
.onClickFunc=${() => { .onClickFunc=${() => {
this.openUserInfo = false; this.openUserInfo = false;
this.chatEditor.enable();
this.userName = ""; this.userName = "";
this.selectedHead = {}; this.selectedHead = {};
}} }}
@ -169,7 +164,6 @@ class ChatScroller extends LitElement {
.setOpenUserInfo=${(val) => this.setOpenUserInfo(val)} .setOpenUserInfo=${(val) => this.setOpenUserInfo(val)}
.setOpenTipUser=${(val) => this.setOpenTipUser(val)} .setOpenTipUser=${(val) => this.setOpenTipUser(val)}
.setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
.chatEditor=${this.chatEditor}
.userName=${this.userName} .userName=${this.userName}
.selectedHead=${this.selectedHead} .selectedHead=${this.selectedHead}
></user-info> ></user-info>
@ -190,6 +184,9 @@ class ChatScroller extends LitElement {
if(changedProperties.has('openUserInfo')){ if(changedProperties.has('openUserInfo')){
return true return true
} }
if(changedProperties.has('userName')){
return true
}
// Only update element if prop1 changed. // Only update element if prop1 changed.
return changedProperties.has('messages'); return changedProperties.has('messages');
} }
@ -205,17 +202,14 @@ class ChatScroller extends LitElement {
toggledMessage = message; toggledMessage = message;
} }
setOpenTipUser(props) {
this.openTipUser = props;
this.chatEditor.disable();
}
setOpenUserInfo(props) { setOpenUserInfo(props) {
this.openUserInfo = props; this.openUserInfo = props;
this.chatEditor.disable();
} }
setUserName(props) { setUserName(props) {
console.log({props})
this.userName = props.senderName ? props.senderName : props.sender; this.userName = props.senderName ? props.senderName : props.sender;
this.selectedHead = { this.selectedHead = {
...this.selectedHead, ...this.selectedHead,
@ -321,7 +315,8 @@ class MessageTemplate extends LitElement {
setOpenPrivateMessage : { attribute: false }, setOpenPrivateMessage : { attribute: false },
setOpenTipUser: { attribute: false }, setOpenTipUser: { attribute: false },
setOpenUserInfo: { attribute: false }, setOpenUserInfo: { attribute: false },
setUserName: { attribute: false } setUserName: { attribute: false },
openTipUser:{type: Boolean}
} }
} }
@ -370,6 +365,7 @@ class MessageTemplate extends LitElement {
} }
render() { render() {
console.log('this.userName', this.userName)
const hidemsg = this.hideMessages; const hidemsg = this.hideMessages;
let message = ""; let message = "";
let messageVersion2 = "" let messageVersion2 = ""

View File

@ -12,7 +12,6 @@ export class TipUser extends LitElement {
static get properties() { static get properties() {
return { return {
userName: { type: String }, userName: { type: String },
chatEditor: { type: Object },
walletBalance: { type: Number }, walletBalance: { type: Number },
sendMoneyLoading: { type: Boolean }, sendMoneyLoading: { type: Boolean },
closeTipUser: { type: Boolean }, closeTipUser: { type: Boolean },
@ -20,7 +19,6 @@ export class TipUser extends LitElement {
errorMessage: { type: String }, errorMessage: { type: String },
successMessage: { type: String }, successMessage: { type: String },
setOpenTipUser: { attribute: false }, setOpenTipUser: { attribute: false },
focusChatEditor: { attribute: false }
} }
} }
@ -221,8 +219,6 @@ export class TipUser extends LitElement {
this.btnDisable = false; this.btnDisable = false;
setTimeout(() => { setTimeout(() => {
this.setOpenTipUser(false); this.setOpenTipUser(false);
this.chatEditor.enable();
this.focusChatEditor();
this.successMessage = ""; this.successMessage = "";
}, 3000); }, 3000);
} else { } else {

View File

@ -15,7 +15,6 @@ export class UserInfo extends LitElement {
setOpenUserInfo: { attribute: false }, setOpenUserInfo: { attribute: false },
setOpenTipUser: { attribute: false }, setOpenTipUser: { attribute: false },
setOpenPrivateMessage: { attribute: false }, setOpenPrivateMessage: { attribute: false },
chatEditor: { type: Object },
userName: { type: String }, userName: { type: String },
selectedHead: { type: Object }, selectedHead: { type: Object },
isImageLoaded: { type: Boolean } isImageLoaded: { type: Boolean }
@ -69,7 +68,6 @@ export class UserInfo extends LitElement {
slot="icon" slot="icon"
@click=${() => { @click=${() => {
this.setOpenUserInfo(false) this.setOpenUserInfo(false)
this.chatEditor.enable();
}}> }}>
</vaadin-icon> </vaadin-icon>
${this.isImageLoaded ? ${this.isImageLoaded ?
@ -114,7 +112,6 @@ export class UserInfo extends LitElement {
@click=${() => { @click=${() => {
this.setOpenTipUser(true); this.setOpenTipUser(true);
this.setOpenUserInfo(false); this.setOpenUserInfo(false);
this.chatEditor.disable();
}}> }}>
${translate("chatpage.cchange59")} ${translate("chatpage.cchange59")}
</div> </div>

View File

@ -30,7 +30,7 @@ export const wrapperModalStyles = css`
overflow-y: auto; overflow-y: auto;
animation: 1s cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal forwards running modal_transition; animation: 1s cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal forwards running modal_transition;
max-height: 80%; max-height: 80%;
z-index: 51 z-index: 60
} }
@keyframes backdrop_blur { @keyframes backdrop_blur {

View File

@ -7,6 +7,7 @@ export class WrapperModal extends LitElement {
return { return {
customStyle: {type: String}, customStyle: {type: String},
onClickFunc: { attribute: false }, onClickFunc: { attribute: false },
zIndex: {type: Number}
} }
} }
@ -15,7 +16,7 @@ export class WrapperModal extends LitElement {
render() { render() {
return html` return html`
<div> <div>
<div class="backdrop" @click=${() => { <div style="z-index: ${this.zIndex || 50}" class="backdrop" @click=${() => {
this.onClickFunc(); this.onClickFunc();
}}></div> }}></div>
<div class="modal-body" style=${this.customStyle ? this.customStyle : ""}> <div class="modal-body" style=${this.customStyle ? this.customStyle : ""}>

View File

@ -44,7 +44,6 @@ class Chat extends LitElement {
blockedUsers: { type: Array }, blockedUsers: { type: Array },
blockedUserList: { type: Array }, blockedUserList: { type: Array },
privateMessagePlaceholder: { type: String}, privateMessagePlaceholder: { type: String},
chatEditor: { type: Object },
imageFile: { type: Object }, imageFile: { type: Object },
activeChatHeadUrl: { type: String }, activeChatHeadUrl: { type: String },
openPrivateMessage: { type: Boolean }, openPrivateMessage: { type: Boolean },
@ -537,12 +536,10 @@ class Chat extends LitElement {
async _sendMessage(outSideMsg, msg) { async _sendMessage(outSideMsg, msg) {
this.isLoading = true; this.isLoading = true;
// this.chatEditor.disable();
const trimmedMessage = msg const trimmedMessage = msg
if (/^\s*$/.test(trimmedMessage)) { if (/^\s*$/.test(trimmedMessage)) {
this.isLoading = false; this.isLoading = false;
// this.chatEditor.enable();
} else { } else {
const messageObject = { const messageObject = {
messageText: trimmedMessage, messageText: trimmedMessage,
@ -600,7 +597,6 @@ class Chat extends LitElement {
_publicKey = false; _publicKey = false;
let err4string = get("chatpage.cchange19"); let err4string = get("chatpage.cchange19");
parentEpml.request('showSnackBar', `${err4string}`); parentEpml.request('showSnackBar', `${err4string}`);
// this.chatEditor.enable();
this.isLoading = false; this.isLoading = false;
} else if (addressPublicKey !== false) { } else if (addressPublicKey !== false) {
isEncrypted = 1; isEncrypted = 1;
@ -609,7 +605,6 @@ class Chat extends LitElement {
} else { } else {
let err4string = get("chatpage.cchange39"); let err4string = get("chatpage.cchange39");
parentEpml.request('showSnackBar', `${err4string}`); parentEpml.request('showSnackBar', `${err4string}`);
// this.chatEditor.enable();
this.isLoading = false; this.isLoading = false;
} }
}; };
@ -675,7 +670,6 @@ class Chat extends LitElement {
} }
this.isLoading = false; this.isLoading = false;
// this.chatEditor.enable();
}; };
// Exec.. // Exec..
@ -686,7 +680,6 @@ class Chat extends LitElement {
insertImage(file) { insertImage(file) {
if (file.type.includes('image')) { if (file.type.includes('image')) {
this.imageFile = file; this.imageFile = file;
// this.chatEditor.disable();
return; return;
} }
parentEpml.request('showSnackBar', get("chatpage.cchange28")); parentEpml.request('showSnackBar', get("chatpage.cchange28"));