Improve relay publish summary

This commit is contained in:
Jonathan Staab 2023-07-26 10:02:04 -07:00
parent 97f33a9c0b
commit 2bdea06ffd
3 changed files with 20 additions and 15 deletions

View File

@ -9,6 +9,7 @@
- [x] Use NIP 89 for app recommendations - [x] Use NIP 89 for app recommendations
- [x] Add support for kinds filter in advanced search - [x] Add support for kinds filter in advanced search
- [x] Add support for displaying kinds 0, 3, 10002 - [x] Add support for displaying kinds 0, 3, 10002
- [x] Add detailed summary of relays a note was published to
# 0.2.35 # 0.2.35

View File

@ -1,7 +1,6 @@
# Current # Current
- [ ] Refactor - [ ] Refactor
- [ ] Improve publish summary, use relay cards
- [ ] Remove external dependencies from engine, open source it? - [ ] Remove external dependencies from engine, open source it?
- [ ] Show nip 5's in search and other places - [ ] Show nip 5's in search and other places
- [ ] Normalize all relay urls, see comment by daniele - [ ] Normalize all relay urls, see comment by daniele

View File

@ -1,19 +1,16 @@
<script lang="ts"> <script lang="ts">
import {displayList} from "hurdak"
import {nip19} from "nostr-tools" import {nip19} from "nostr-tools"
import {modal} from "src/partials/state" import {modal} from "src/partials/state"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
import Heading from "src/partials/Heading.svelte" import Heading from "src/partials/Heading.svelte"
import Anchor from "src/partials/Anchor.svelte" import Anchor from "src/partials/Anchor.svelte"
import RelayCard from "src/app/shared/RelayCard.svelte"
import {Nip65, User} from "src/app/engine" import {Nip65, User} from "src/app/engine"
import {publishWithToast} from "src/app/state" import {publishWithToast} from "src/app/state"
export let event export let event
export let progress export let progress
const displayRelays = (s: Set<string>) =>
displayList(Array.from(s).map(url => Nip65.displayRelay({url})))
const noteLink = const noteLink =
"/" + "/" +
nip19.neventEncode({ nip19.neventEncode({
@ -32,23 +29,31 @@
<Content size="lg"> <Content size="lg">
{#if progress.succeeded.size > 0} {#if progress.succeeded.size > 0}
<Heading>Success!</Heading> <Heading>Success!</Heading>
<p> <p>Your note has been published to the following relays:</p>
Your note has been published to the following relays: <div class="flex flex-col gap-2">
{displayRelays(progress.succeeded)}. {#each Array.from(progress.succeeded) as url}
</p> <RelayCard relay={{url}} />
{/each}
</div>
{:else} {:else}
<Heading>Failed to publish!</Heading> <Heading>Failed to publish!</Heading>
<p>Your note was not published.</p> <p>Your note was not published.</p>
{/if} {/if}
{#if progress.failed.size > 0} {#if progress.failed.size > 0}
<p> <p>The following relays rejected your note:</p>
The following relays rejected your note: {displayRelays(progress.failed)}. <div class="flex flex-col gap-2">
</p> {#each Array.from(progress.failed) as url}
<RelayCard relay={{url}} />
{/each}
</div>
{/if} {/if}
{#if progress.timeouts.size > 0} {#if progress.timeouts.size > 0}
<p> <p>The following relays did not respond:</p>
The following relays did not respond: {displayRelays(progress.timeouts)}. <div class="flex flex-col gap-2">
</p> {#each Array.from(progress.timeouts) as url}
<RelayCard relay={{url}} />
{/each}
</div>
{/if} {/if}
<div class="flex justify-center"> <div class="flex justify-center">
{#if progress.succeeded.size > 0} {#if progress.succeeded.size > 0}