diff --git a/messenger/index.html b/messenger/index.html
index b09547d..513ed6d 100644
--- a/messenger/index.html
+++ b/messenger/index.html
@@ -770,7 +770,7 @@
@@ -1411,11 +1411,6 @@
isRemovingMember = false
break
case 'new_message_popup':
- if (Object.keys(floGlobals.contacts).length) {
- getRef('search_contacts').classList.remove('hidden')
- } else {
- getRef('search_contacts').classList.add('hidden')
- }
renderContactList()
break
case 'creation_popup': {
@@ -2469,8 +2464,9 @@
`
},
contactCard(contactAddress, options = {}) {
- let { type, prepend = false, markUnread = false, ref } = options
- let name = getContactName(contactAddress)
+ let { type, prepend = false, markUnread = false, ref, name } = options
+ if (!name)
+ name = getContactName(contactAddress)
let initial
if (type === 'group') {
initial = html` `
@@ -3272,12 +3268,19 @@
getRef('search_contacts').addEventListener('input', function () {
const contacts = {}
+ const searchQuery = this.value.trim()
for (contact in floGlobals.contacts) {
- if (contact.toLowerCase().includes(this.value.toLowerCase()) || floGlobals.contacts[contact].toLowerCase().includes(this.value.toLowerCase())) {
+ if (contact.toLowerCase().includes(searchQuery.toLowerCase()) || floGlobals.contacts[contact].toLowerCase().includes(searchQuery.toLowerCase())) {
contacts[contact] = floGlobals.contacts[contact]
}
}
- renderContactList(contacts)
+ if (Object.keys(contacts).length) {
+ renderContactList(contacts)
+ } else if (floCrypto.validateAddr(searchQuery) || validateEthAddress(searchQuery)) {
+ renderElem(getRef('contacts_container'), render.contactCard(searchQuery, {
+ type: 'contact', ref: getRef('contacts_container'), name: 'Start a chat with'
+ }))
+ }
})
document.addEventListener('click', e => {
// detect click outside emoji panel and emoji button