From 4b5e8e8a43ca4e9e8c743b86408223406133fb2f Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 12 May 2024 08:21:47 -0400 Subject: [PATCH] Consolidate similar request tags in the connection list. #59 --- apps/ssb.json | 2 +- apps/ssb/tf-tab-connections.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 634cec42..d3ce9e5c 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&cN1BLgsD5fU8QzkNbtKR/Ie1fO3miBq8FVSpgNqFbrc=.sha256" + "previous": "&6dwXL1RKL8t/RSV0UHBflkMnM8f8SV9VFvBZFqhW6LI=.sha256" } diff --git a/apps/ssb/tf-tab-connections.js b/apps/ssb/tf-tab-connections.js index 4b23dad6..2f3ec584 100644 --- a/apps/ssb/tf-tab-connections.js +++ b/apps/ssb/tf-tab-connections.js @@ -105,6 +105,14 @@ class TfTabConnectionsElement extends LitElement { } render_connection(connection) { + let requests = Object.values(connection.requests.reduce(function(accumulator, value) { + let key = `${value.name}:${Math.sign(value.request_number)}`; + if (!accumulator[key]) { + accumulator[key] = Object.assign({count: 0}, value); + } + accumulator[key].count++; + return accumulator; + }, {})); return html`