diff --git a/public/index.html b/public/index.html index 26bb362..15fb07d 100644 --- a/public/index.html +++ b/public/index.html @@ -228,7 +228,73 @@
-
+ + +
+
+ +
Conversations
+
Announces
+
+
+ + +
+ + +
+ +
+ + +
+
+
+
+
+ + + +
+
+
+
{{ conversation.name }}
+
{{ formatTimeAgo(conversation.updated_at) }}
+
+
+
+
+ + +
+
+ + + +
+
No Conversations
+
Discover peers on the Announces tab
+
+ + +
+
+ + + +
+
No Search Results
+
Your search didn't match any Conversations!
+
+ + +
+
+ +
+ + +
@@ -281,6 +347,7 @@
+
@@ -976,6 +1043,10 @@ selectedNode: null, selectedNodePath: null, + conversations: [], + conversationsSearchTerm: "", + messagesTab: "conversations", + lxmfMessagesRequestSequence: 0, chatItems: [], @@ -1019,6 +1090,7 @@ this.connectWebsocket(); this.getLxmfDeliveryAnnounces(); this.getNomadnetworkNodeAnnounces(); + this.getConversations(); this.loadInterfaces(); this.updateInterfaceStats(); @@ -1467,6 +1539,15 @@ console.log(e); } }, + async getConversations() { + try { + const response = await window.axios.get(`/api/v1/lxmf/conversations`); + this.conversations = response.data.conversations; + } catch(e) { + // do nothing if failed to load conversations + console.log(e); + } + }, async getPeerPath(destinationHash) { // clear previous known path @@ -1960,6 +2041,10 @@ this.getNodePath(node.destination_hash); this.loadNodePage(node.destination_hash, "/page/index.mu"); }, + onConversationClick: function(conversation) { + // object must stay compatible with format of peers + this.onPeerClick(conversation); + }, parseSeconds: function(secondsToFormat) { secondsToFormat = Number(secondsToFormat); var days = Math.floor(secondsToFormat / (3600 * 24)); @@ -2389,6 +2474,14 @@ return matchesAppData || matchesDestinationHash; }); }, + searchedConversations() { + return this.conversations.filter((conversation) => { + const search = this.conversationsSearchTerm.toLowerCase(); + const matchesName = conversation.name.toLowerCase().includes(search); + const matchesDestinationHash = conversation.destination_hash.toLowerCase().includes(search); + return matchesName || matchesDestinationHash; + }); + }, canSendMessage() { // can't send if empty message