From b4edf0d5b2b2bf498af98c17bc91448bd28473a0 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Sat, 26 Nov 2022 09:22:10 -0800 Subject: [PATCH] Add threads --- README.md | 1 + src/App.svelte | 2 + src/partials/Note.svelte | 92 ++++++++++++++++++++++++++++++---- src/partials/NoteDetail.svelte | 24 +++++++-- src/routes/Notes.svelte | 11 +++- src/routes/UserDetail.svelte | 17 ++++--- src/state/app.js | 4 +- src/state/dispatch.js | 26 +++++++--- src/state/nostr.js | 19 +++++++ src/util/html.js | 12 +++-- 10 files changed, 174 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 889ae1c4..71aea2e7 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,4 @@ Nostr implementation comments - [ ] It's impossible to get deletes for an event's replies/mentions in one query, since deletes can't tag anything other than what is to be deleted. - [ ] Recursive queries are really painful, e.g. to get all notes for an account, you need to 1. get the account's notes, then get everything with those notes in their tags, then get deletions for those. - [ ] The limit of 3 channels makes things difficult. I want to show a modal without losing all the state in the background. I am reserving one channel for one-off recursive queries. +- [ ] Why no spaces in names? Seems user hostile diff --git a/src/App.svelte b/src/App.svelte index e7fec7d1..735fb159 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -148,7 +148,9 @@ diff --git a/src/partials/Note.svelte b/src/partials/Note.svelte index 0db14e69..04494525 100644 --- a/src/partials/Note.svelte +++ b/src/partials/Note.svelte @@ -1,30 +1,33 @@ -
  • { + if (!hasParent('.fa-reply', e.target) && !hasParent('.note-reply', e.target)) { + reply = null + } + }} + on:keydown={e => { + if (e.key === 'Escape') { + reply = null + } + }} +/> + +

    {formatTimestamp(note.created_at)}

    + {#if parentId && !isReply} + + Reply to {parentId.slice(0, 8)} + + {/if}

    {ellipsize(note.content, 240)}

    - + {note.replies.length}
    @@ -78,4 +129,25 @@
    -
  • + + +{#if reply !== null} +
    +