feat: show unread count
This commit is contained in:
parent
3a77bee659
commit
5942d135b3
2 changed files with 7 additions and 1 deletions
|
|
@ -2,9 +2,12 @@
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-2">
|
||||||
<h6 class="text-subtitle1 q-my-none">Messages</h6>
|
<h6 class="text-subtitle1 q-my-none">Messages</h6>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<q-badge v-if="unreadMessages" color="green"><span v-text="unreadMessages"></span> new</q-badge>
|
||||||
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="activePublicKey"
|
v-if="activePublicKey"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ async function directMessages(path) {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
customers: [],
|
customers: [],
|
||||||
|
unreadMessages: 0,
|
||||||
activePublicKey: null,
|
activePublicKey: null,
|
||||||
messages: [],
|
messages: [],
|
||||||
newMessage: ''
|
newMessage: ''
|
||||||
|
|
@ -59,6 +60,7 @@ async function directMessages(path) {
|
||||||
this.inkey
|
this.inkey
|
||||||
)
|
)
|
||||||
this.customers = data
|
this.customers = data
|
||||||
|
this.unreadMessages = data.filter(c => c.unread_messages).length
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
}
|
}
|
||||||
|
|
@ -86,6 +88,7 @@ async function directMessages(path) {
|
||||||
},
|
},
|
||||||
selectActiveCustomer: async function () {
|
selectActiveCustomer: async function () {
|
||||||
await this.getDirectMessages(this.activePublicKey)
|
await this.getDirectMessages(this.activePublicKey)
|
||||||
|
await this.getCustomers()
|
||||||
},
|
},
|
||||||
focusOnChatBox: function (index) {
|
focusOnChatBox: function (index) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue