diff --git a/src/lib/views/messages/Messages.svelte b/src/lib/views/messages/Messages.svelte index daaf3dd..fdfa125 100644 --- a/src/lib/views/messages/Messages.svelte +++ b/src/lib/views/messages/Messages.svelte @@ -62,12 +62,11 @@ renderQueue.subscribe((q) => {}); //remove viewed and add new items that haven't been viewed - let shortListLength = derived([renderQueue, viewed], ([$renderQ, $viewed]) => { - //todo: if root cool, but if not, keep loading more 3 at a time + let shortListLength = derived([renderQueue, viewed, threadParentID], ([$renderQ, $viewed, $parentID]) => { let dirty = false; let updated: NostrEvent[] = []; for (let e of _stableShortlist) { - if (!$viewed.has(e.id)) { + if (!$viewed.has(e.id) || $parentID != "root") { //console.log(72, e.id); updated.push(e); } else { diff --git a/src/lib/views/messages/RenderKind1.svelte b/src/lib/views/messages/RenderKind1.svelte index 6773dfc..fc59297 100644 --- a/src/lib/views/messages/RenderKind1.svelte +++ b/src/lib/views/messages/RenderKind1.svelte @@ -7,8 +7,7 @@ import { derived, type Writable } from 'svelte/store'; import type { FrontendData } from '@/snort_workers/types'; import { inview } from 'svelte-inview'; - import { viewed } from '@/workers_snort/firehose_master'; - + import { viewed } from '@/workers_snort/firehose_master'; export let note: NostrEvent; export let onClickReply: () => void; @@ -17,7 +16,6 @@ $: childrenCount = $store?.replies.get(note.id) ? $store.replies.get(note.id)!.size : 0; -
@@ -56,10 +54,15 @@
-
-
- {new Date(note.created_at * 1000).toLocaleString()} -
+
+
+ +
+
+
+ {new Date(note.created_at * 1000).toLocaleString()} {#if $viewed.has(note.id)}✓{/if} +
+
@@ -67,13 +70,13 @@
{ - if (event.detail.scrollDirection.vertical == "up") { - viewed.update(v=>{ - v.add(note.id) - return v - }) - } - }} ->
\ No newline at end of file + use:inview={{}} + on:inview_leave={(event) => { + if (event.detail.scrollDirection.vertical == 'up') { + viewed.update((v) => { + v.add(note.id); + return v; + }); + } + }} +> diff --git a/src/lib/views/messages/RenderKind1AsThreadHead.svelte b/src/lib/views/messages/RenderKind1AsThreadHead.svelte index 967549f..6928019 100644 --- a/src/lib/views/messages/RenderKind1AsThreadHead.svelte +++ b/src/lib/views/messages/RenderKind1AsThreadHead.svelte @@ -7,6 +7,7 @@ import Reply from "./Reply.svelte"; import { derived, type Writable } from "svelte/store"; import type { FrontendData } from "@/snort_workers/types"; + import { viewed } from "@/workers_snort/firehose_master"; export let note:NostrEvent export let store: Writable @@ -32,7 +33,7 @@
- {new Date(note.created_at * 1000).toLocaleString()} + {new Date(note.created_at * 1000).toLocaleString()}{#if $viewed.has(note.id)}✓{/if}