feat: keep track of new messages

This commit is contained in:
Vlad Stan 2023-03-29 14:20:49 +03:00
parent 098cb5adf5
commit e04b9dc448
7 changed files with 32 additions and 1 deletions

View file

@ -9,7 +9,7 @@
<q-card-section>
<q-select
v-model="activePublicKey"
:options="customers.map(c => ({label: `${c.profile.name || 'unknown'} ${c.profile.about || ''} (${c.public_key.slice(0, 16)}...${c.public_key.slice(c.public_key.length - 16)})`, value: c.public_key}))"
:options="customers.map(c => ({label: buildCustomerLabel(c), value: c.public_key}))"
label="Select Customer"
emit-value
@input="selectActiveCustomer()"

View file

@ -20,6 +20,16 @@ async function directMessages(path) {
},
methods: {
sendMessage: async function () {},
buildCustomerLabel: function (c) {
let label = `${c.profile.name || 'unknown'} ${c.profile.about || ''}`
if (c.unread_messages) {
label += `[new: ${c.unread_messages}]`
}
label += ` (${c.public_key.slice(0, 16)}...${c.public_key.slice(
c.public_key.length - 16
)}`
return label
},
getDirectMessages: async function (pubkey) {
if (!pubkey) {
this.messages = []