From d06bef4aff44ace4ece9acc59f968bb3596d9692 Mon Sep 17 00:00:00 2001 From: Ticruz Date: Fri, 22 Nov 2024 16:25:35 +0100 Subject: [PATCH] enhance notices view --- src/app/views/Publishes.svelte | 77 +++++---- src/app/views/PublishesConnections.svelte | 201 ++++++++++++++++++++++ src/app/views/PublishesNotices.svelte | 82 +++++++++ 3 files changed, 329 insertions(+), 31 deletions(-) create mode 100644 src/app/views/PublishesConnections.svelte create mode 100644 src/app/views/PublishesNotices.svelte diff --git a/src/app/views/Publishes.svelte b/src/app/views/Publishes.svelte index 6509feff..33d7e686 100644 --- a/src/app/views/Publishes.svelte +++ b/src/app/views/Publishes.svelte @@ -1,13 +1,21 @@ Published Events -
- -

{recent.length}

- {pluralize(recent.length, "Event")} -
- -

{relays.size}

- {pluralize(relays.size, "Relay")} -
- -

{pending.length}

- Pending -
- -

{success.length}

- Succeeded -
- -

{recent.length - pending.length - success.length}

- Failed -
-
-{#each sortBy(t => -t.event.created_at, recent) as thunk (thunk.event.id)} - -{/each} + (activeTab = tab)} /> +{#if activeTab === "events"} +
+ +

{recent.length}

+ {pluralize(recent.length, "Event")} +
+ +

{relays.size}

+ {pluralize(relays.size, "Relay")} +
+ +

{pending.length}

+ Pending +
+ +

{success.length}

+ Succeeded +
+ +

{recent.length - pending.length - success.length}

+ Failed +
+
+ {#each sortBy(t => -t.event.created_at, recent) as thunk (thunk.event.id)} + + {/each} +{:else if activeTab === "connections"} + +{:else if activeTab === "notices"} + +{/if} diff --git a/src/app/views/PublishesConnections.svelte b/src/app/views/PublishesConnections.svelte new file mode 100644 index 00000000..e3ee5c1f --- /dev/null +++ b/src/app/views/PublishesConnections.svelte @@ -0,0 +1,201 @@ + + +
+ (filters["Connected"] = !filters["Connected"])}> +

+ {Array.from(connectionsStatus["Connected"]?.values() || []).length || 0} +

+ Connected +
+ (filters["Logging in"] = !filters["Logging in"])}> +

+ {Array.from(connectionsStatus["Logging in"]?.values() || []).length || 0} +

+ Logging in +
+ (filters["Failed to log in"] = !filters["Failed to log in"])}> +

+ {Array.from(connectionsStatus["Failed to log in"]?.values() || []).length || 0} +

+ Login failed +
+ (filters["Failed to connect"] = !filters["Failed to connect"])} + lass="hidden sm:block"> +

+ {Array.from(connectionsStatus["Failed to connect"]?.values() || []).length || 0} +

+ Connection failed +
+ (filters["Waiting to reconnect"] = !filters["Waiting to reconnect"])}> +

+ {Array.from(connectionsStatus["Waiting to reconnect"]?.values() || []).length || 0} +

+ Reconnecting +
+ (filters["Not connected"] = !filters["Not connected"])}> +

+ {Array.from(connectionsStatus["Not connected"]?.values() || []).length || 0} +

+ Not Connected +
+
+{#each connections as cxn (cxn.url)} + {@const relay = $relaysByUrl.get(cxn.url)} + { + selected = cxn.url + activeTab = "notices" + }}> +
+ {#if relay?.profile?.icon} + + {:else} +
+ +
+ {/if} +
+
+
+ {displayRelayUrl(cxn.url)} +
+
+
+ {#if relay?.profile?.supported_nips} + + {relay.profile.supported_nips.length} NIPs + + {/if} + + Connected {quantify(relay?.stats?.open_count || 0, "time")} + +
+
+
+ {#if getStatus(PublishStatus.Success, cxn).length > 0} + {@const success = getStatus(PublishStatus.Success, cxn).length} +
+ {success || ""} +
+ {/if} + {#if getStatus(PublishStatus.Failure, cxn).length > 0} + {@const failure = getStatus(PublishStatus.Failure, cxn).length} +
+ {failure || ""} +
+ {/if} + {#if getStatus(PublishStatus.Pending, cxn).length > 0} + {@const pending = getStatus(PublishStatus.Pending, cxn).length} +
+ {pending || ""} +
+ {/if} + {#if getStatus(PublishStatus.Timeout, cxn).length > 0} + {@const timeout = getStatus(PublishStatus.Pending, cxn).length} +
+ {timeout || ""} +
+ {/if} +
+
+
+{/each} diff --git a/src/app/views/PublishesNotices.svelte b/src/app/views/PublishesNotices.svelte new file mode 100644 index 00000000..e5c74a27 --- /dev/null +++ b/src/app/views/PublishesNotices.svelte @@ -0,0 +1,82 @@ + + + +
+ {item} +
+
+ +{#if !notices.length && selected.length} +
+ +
No notices found for selected relays.
+
+
+{:else} + {#each notices as thunk} + +
+ Kind {thunk.event.kind}, published {formatTimestamp(thunk.event.created_at)} + router.at("notes").of(thunk.event.id).open()}>View Note +
+ {#each uniq(Object.entries(get(thunk.status)).filter( ([k, v]) => selected.includes(k), )) as [url, status]} +
+ {url} +
+ + {status.status} +
+
+ {/each} +
+ {/each} +{/if}