From dfb1916b025a827dcea75d341e017f1df71f2d33 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 18 Apr 2023 09:32:07 -0500 Subject: [PATCH] Fix a few bugs --- .env | 2 +- ROADMAP.md | 4 +- src/app/shared/Note.svelte | 17 ++++++-- src/app/shared/NoteActions.svelte | 10 ++--- src/app/shared/PersonActions.svelte | 4 +- src/app/shared/PersonSummary.svelte | 24 +++++++----- src/app/state.ts | 6 ++- src/app/views/Feeds.svelte | 61 ++++++++++++----------------- src/app/views/Search.svelte | 1 + src/partials/Modal.svelte | 4 +- src/partials/state.ts | 15 +++++-- 11 files changed, 85 insertions(+), 63 deletions(-) diff --git a/.env b/.env index eb763200..68b5faff 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ VITE_THEME_DARK=transparent:transparent,black:#0f0f0e,white:#FFFFFF,accent:#EB5E28,accent-light:#FB652C,gray-1:#FFFFFF,gray-2:#FAF6F1,gray-3:#F2EBE1,gray-4:#E9E0D3,gray-5:#B3AA98,gray-6:#565249,gray-7:#393530,gray-8:#252422,danger:#ff0000,warning:#ebd112,success:#37ab51,input:#FAF6F1,input-hover:#F2EBE1 -VITE_THEME_LIGHT=transparent:transparent,black:#0f0f0e,white:#FFFFFF,accent:#EB5E28,accent-light:#FB652C,gray-8:#FFFFFF,gray-7:#FAF6F1,gray-6:#F2EBE1,gray-5:#E9E0D3,gray-4:#B3AA98,gray-3:#565249,gray-2:#393530,gray-1:#252422,danger:#ff0000,warning:#ebd112,success:#37ab51,input:#FAF6F1,input-hover:#F2EBE1 +VITE_THEME_LIGHT=transparent:transparent,black:#0f0f0e,white:#FFFFFF,accent:#EB5E28,accent-light:#FB652C,gray-8:#FFFFFF,gray-7:#FAF6F1,gray-6:#F2EBE1,gray-5:#B3AA98,gray-4:#B3AA98,gray-3:#565249,gray-2:#393530,gray-1:#252422,danger:#ff0000,warning:#ebd112,success:#37ab51,input:#FAF6F1,input-hover:#F2EBE1 VITE_DUFFLEPUD_URL=https://dufflepud.onrender.com diff --git a/ROADMAP.md b/ROADMAP.md index 0a32cc9e..2bf20232 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,10 +1,11 @@ # Current -- [ ] Claim relays bounty - [ ] Add real search, it's a big hurdle for first-timers/anons - [ ] Remember message/chat status +- [ ] Fix note nesting - [ ] Image classification - https://github.com/bhky/opennsfw2 +- [ ] Claim relays bounty # Core @@ -71,6 +72,7 @@ - [ ] Share button for notes, shows qr code and nevent - [ ] open web+nostr links like snort - [ ] Pinned posts ala snort +- [ ] Scroll to top button that appears after scrolling a bit - [ ] Likes list on note detail. Maybe a sidebar or header for note detail page? - [ ] Add keyword mutes - [ ] Show options on note detail for retrieving replies diff --git a/src/app/shared/Note.svelte b/src/app/shared/Note.svelte index 5e489aaf..2d6c6185 100644 --- a/src/app/shared/Note.svelte +++ b/src/app/shared/Note.svelte @@ -2,6 +2,7 @@ import {nip19} from "nostr-tools" import {find, last} from "ramda" import {onMount} from "svelte" + import {get} from "svelte/store" import {quantify} from "hurdak/lib/hurdak" import {findRootId, findReplyId, displayPerson} from "src/util/nostr" import {formatTimestamp} from "src/util/misc" @@ -55,24 +56,34 @@ return showContext ? true : !r.isContext }) + // If we're already in a note detail modal, don't infinitely nest. But if we're in + // some other modal, make it possible to go back. + const goToNote = data => { + if (modal.getCurrent()?.type === "note/detail") { + modal.replace({type: "note/detail", ...data}) + } else { + modal.push({type: "note/detail", ...data}) + } + } + const onClick = e => { const target = e.target as HTMLElement if (interactive && !["I"].includes(target.tagName) && !target.closest("a")) { - modal.push({type: "note/detail", note}) + goToNote({note}) } } const goToParent = async () => { const relays = getRelaysForEventParent(note) - modal.push({type: "note/detail", note: {id: findReplyId(note)}, relays}) + goToNote({note: {id: findReplyId(note)}, relays}) } const goToRoot = async () => { const relays = getRelaysForEventParent(note) - modal.push({type: "note/detail", note: {id: findRootId(note)}, relays}) + goToNote({note: {id: findRootId(note)}, relays}) } const setBorderHeight = () => { diff --git a/src/app/shared/NoteActions.svelte b/src/app/shared/NoteActions.svelte index 34561d16..b3f03468 100644 --- a/src/app/shared/NoteActions.svelte +++ b/src/app/shared/NoteActions.svelte @@ -176,19 +176,19 @@ } -
+
-
-
+
{#if pool.forceUrls.length === 0}
{ - const [{url}] = getPubkeyWriteRelays(person.pubkey) + const [{url}] = sampleRelays(getPubkeyWriteRelays(person.pubkey)) user.addPetname(person.pubkey, url, displayPerson(person)) } diff --git a/src/app/shared/PersonSummary.svelte b/src/app/shared/PersonSummary.svelte index 5d094e03..69e0e647 100644 --- a/src/app/shared/PersonSummary.svelte +++ b/src/app/shared/PersonSummary.svelte @@ -1,12 +1,14 @@ @@ -79,7 +72,7 @@ {/if}
- + {#if $canPublish} {#if $lists.length > 1} @@ -89,19 +82,17 @@ class="flex flex-col items-start overflow-hidden rounded border border-solid border-gray-8 bg-black"> {#each $lists as e (e.id)} {@const meta = Tags.from(e).asMeta()} - {#if meta.d !== $activeTab} - - {/if} + {/each}
diff --git a/src/app/views/Search.svelte b/src/app/views/Search.svelte index c934c04e..ba2fcaf5 100644 --- a/src/app/views/Search.svelte +++ b/src/app/views/Search.svelte @@ -16,6 +16,7 @@ const topics = t .all() .map(topic => ({type: "topic", id: topic.name, topic, text: "#" + topic.name})) + const people = p .all({"kind0.name": {$type: "string"}, pubkey: {$ne: user.getPubkey()}}) .map(person => ({ diff --git a/src/partials/Modal.svelte b/src/partials/Modal.svelte index 6dfb95c5..a50f319e 100644 --- a/src/partials/Modal.svelte +++ b/src/partials/Modal.svelte @@ -24,7 +24,9 @@ }} />