chore: code format

This commit is contained in:
Vlad Stan 2023-03-08 14:42:23 +02:00
parent 9bf416072f
commit 82a04cc8b9
3 changed files with 6 additions and 7 deletions

View file

@ -18,11 +18,10 @@
<q-card-section> <q-card-section>
<div class="chat-container" ref="chatCard"> <div class="chat-container" ref="chatCard">
<div class="chat-box"> <div class="chat-box">
<div class="chat-messages" style="height: 45vh"> <div class="chat-messages" style="height: 45vh">
<q-chat-message <q-chat-message
v-for="(dm, index) in messages" v-for="(dm, index) in messages"
:key="index" :key="index"
:name="dm.incoming ? 'customer': 'me'" :name="dm.incoming ? 'customer': 'me'"
:text="[dm.message]" :text="[dm.message]"
:sent="!dm.incoming" :sent="!dm.incoming"

View file

@ -31,7 +31,6 @@ async function directMessages(path) {
this.messages.map(m => m.message) this.messages.map(m => m.message)
) )
this.focusOnChatBox(this.messages.length - 1) this.focusOnChatBox(this.messages.length - 1)
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
@ -50,14 +49,16 @@ async function directMessages(path) {
this.messages = this.messages.concat([data]) this.messages = this.messages.concat([data])
console.log('### this.messages', this.messages) console.log('### this.messages', this.messages)
this.newMessage = '' this.newMessage = ''
this.focusOnChatBox(this.messages.length - 1) this.focusOnChatBox(this.messages.length - 1)
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
}, },
focusOnChatBox: function(index) { focusOnChatBox: function (index) {
setTimeout(() => { setTimeout(() => {
const lastChatBox = document.getElementsByClassName(`chat-mesage-index-${index}`); const lastChatBox = document.getElementsByClassName(
`chat-mesage-index-${index}`
)
if (lastChatBox && lastChatBox[0]) { if (lastChatBox && lastChatBox[0]) {
lastChatBox[0].scrollIntoView() lastChatBox[0].scrollIntoView()
} }

View file

@ -166,7 +166,6 @@
margin-left: auto; margin-left: auto;
width: 100%; width: 100%;
} }
</style> </style>
<!-- todo: serve locally --> <!-- todo: serve locally -->