From 446300ca6b3aa135196f21964d34f377f06bbc0f Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 30 Apr 2024 23:55:07 +1200 Subject: [PATCH] implement searching peers --- public/index.html | 48 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/public/index.html b/public/index.html index f547c15..06b6b9a 100644 --- a/public/index.html +++ b/public/index.html @@ -64,7 +64,7 @@
-
+
@@ -73,8 +73,11 @@
Peers Discovered ({{ peersCount }})
-
-
+
+ +
+
+
@@ -84,14 +87,31 @@
-
-
- - - +
+ + +
+
+ + + +
+
No Peers Discovered
+
Waiting for someone to announce!
-
No Peers Discovered
-
Waiting for someone to announce!
+ + +
+
+ + + +
+
No Search Results
+
Your search didn't match any Peers!
+
+ +
@@ -277,6 +297,7 @@ config: null, peers: {}, + peersSearchTerm: "", selectedPeer: null, chatItems: [], @@ -562,6 +583,13 @@ return peerB.last_announce_timestamp - peerA.last_announce_timestamp; }); }, + searchedPeers() { + return this.peersOrderedByLatestAnnounce.filter((peer) => { + const search = this.peersSearchTerm.toLowerCase(); + const matchesAppData = (peer.app_data || "").toLowerCase().includes(search); + return matchesAppData; + }); + }, selectedPeerChatItems() { // get all chat items related to the selected peer