From d506670b64065fe98b2a2f9a5e83942532f7c5fc Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 30 Apr 2024 00:22:23 +1200 Subject: [PATCH] only show chat items for the peer we have selected --- index.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8a2e8f1..d370a1f 100644 --- a/index.html +++ b/index.html @@ -155,8 +155,8 @@
-
-
+
+
@@ -466,6 +466,21 @@ isMobile() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); }, + selectedPeerChatItems() { + + // get all chat items related to the selected peer + if(this.selectedPeer){ + return this.chatItems.filter((chatItem) => { + const isFromSelectedPeer = chatItem.source_hash === this.selectedPeer.destination_hash; + const isToSelectedPeer = chatItem.destination_hash === this.selectedPeer.destination_hash; + return isFromSelectedPeer || isToSelectedPeer; + }); + } + + // no peer, so no chat items! + return []; + + } }, }).mount('#app');