From 38974e5a22ccd86fc06007efddafc10aec15998c Mon Sep 17 00:00:00 2001 From: Ticruz Date: Fri, 22 Nov 2024 16:25:35 +0100 Subject: [PATCH 01/13] 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 6509feff0..33d7e6863 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 000000000..e3ee5c1ff --- /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 000000000..e5c74a276 --- /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} From 278959f9435ba0825ed3db2b3bbf10b60aef6003 Mon Sep 17 00:00:00 2001 From: Ticruz Date: Mon, 25 Nov 2024 15:21:12 +0100 Subject: [PATCH 02/13] UI refinements --- src/app/views/PublishesConnections.svelte | 137 ++++++---------------- src/app/views/PublishesNotices.svelte | 54 ++++----- 2 files changed, 65 insertions(+), 126 deletions(-) diff --git a/src/app/views/PublishesConnections.svelte b/src/app/views/PublishesConnections.svelte index e3ee5c1ff..3819bc0f0 100644 --- a/src/app/views/PublishesConnections.svelte +++ b/src/app/views/PublishesConnections.svelte @@ -1,20 +1,27 @@ -
- (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 -
-
+ +
+
+ {Array.from(connectionsStatus[option]?.values() || []).length || 0} + {option} +
+
+
{#each connections as cxn (cxn.url)} {@const relay = $relaysByUrl.get(cxn.url)} -
+
{#if relay?.profile?.icon} {:else} @@ -170,31 +120,20 @@
-
- {#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 options as opt} + {#if connectionsStatus[opt]?.has(cxn.url)} +
diff --git a/src/app/views/PublishesNotices.svelte b/src/app/views/PublishesNotices.svelte index e5c74a276..9a40a1f2f 100644 --- a/src/app/views/PublishesNotices.svelte +++ b/src/app/views/PublishesNotices.svelte @@ -1,14 +1,14 @@ - -
-
- {Array.from(connectionsStatus[option]?.values() || []).length || 0} - {option} -
+ +
+ {Array.from(connectionsStatus[option]?.values() || []).length || 0} + {option}
{#each connections as cxn (cxn.url)} @@ -123,7 +127,7 @@
{#each options as opt} {#if connectionsStatus[opt]?.has(cxn.url)} -