diff --git a/src/app/components/Content.svelte b/src/app/components/Content.svelte
index 066c54d..46ee9e6 100644
--- a/src/app/components/Content.svelte
+++ b/src/app/components/Content.svelte
@@ -50,6 +50,8 @@
return false
}
+ const isStartAndEnd = (i: number) => Boolean(isBoundary(i - 1) && isBoundary(i + 1))
+
const isStartOrEnd = (i: number) => Boolean(isBoundary(i - 1) || isBoundary(i + 1))
const isBlock = (i: number) => {
@@ -81,7 +83,7 @@
{:else if isTopic(parsed)}
{:else if isCode(parsed)}
-
+
{:else if isCashu(parsed) || isInvoice(parsed)}
{:else if isLink(parsed)}
diff --git a/src/app/components/ContentCode.svelte b/src/app/components/ContentCode.svelte
index 89d43ee..0240f2c 100644
--- a/src/app/components/ContentCode.svelte
+++ b/src/app/components/ContentCode.svelte
@@ -1,9 +1,8 @@
-
-
- {value}
-
-
+
+ {value}
+
diff --git a/src/app/components/ThreadItem.svelte b/src/app/components/ThreadItem.svelte
index be36517..483450a 100644
--- a/src/app/components/ThreadItem.svelte
+++ b/src/app/components/ThreadItem.svelte
@@ -1,29 +1,32 @@
-
+
-
+
- {replies.length}
+ {$replies.length}
diff --git a/src/app/state.ts b/src/app/state.ts
index 5f904c2..5a259d8 100644
--- a/src/app/state.ts
+++ b/src/app/state.ts
@@ -17,7 +17,6 @@ import {
} from "@welshman/lib"
import {
getIdFilters,
- NOTE,
WRAP,
RELAYS,
REACTION,
@@ -27,8 +26,6 @@ import {
EVENT_TIME,
getRelayTagValues,
isShareableRelayUrl,
- getAncestorTags,
- getAncestorTagValues,
getPubkeyTagValues,
isHashedEvent,
displayProfile,
@@ -60,7 +57,7 @@ import {
} from "@welshman/app"
import type {AppSyncOpts} from "@welshman/app"
import type {SubscribeRequestWithHandlers} from "@welshman/net"
-import {throttled, deriveEvents, deriveEventsMapped, withGetter} from "@welshman/store"
+import {deriveEvents, deriveEventsMapped, withGetter} from "@welshman/store"
export const ROOM = "~"
@@ -394,46 +391,6 @@ export const eventsByUrl = derived([trackerStore, events], ([$tracker, $events])
return eventsByUrl
})
-// Threads
-
-export type Thread = {
- root: TrustedEvent
- replies: TrustedEvent[]
-}
-
-export const notes = deriveEvents(repository, {filters: [{kinds: [NOTE]}]})
-
-export const threadsByUrl = derived(
- [throttled(300, trackerStore), throttled(300, notes)],
- ([$tracker, $notes]) => {
- const threadsByUrl = new Map()
- const [parents, children] = partition(e => getAncestorTags(e.tags).replies.length === 0, $notes)
-
- for (const event of parents) {
- for (const url of $tracker.getRelays(event.id)) {
- pushToMapKey(threadsByUrl, url, {root: event, replies: []})
- }
- }
-
- for (const event of children) {
- const [id] = getAncestorTagValues(event.tags).replies
-
- for (const url of $tracker.getRelays(event.id)) {
- const threads = threadsByUrl.get(url) || []
- const thread = threads.find(thread => thread.root.id === id)
-
- if (!thread) {
- continue
- }
-
- thread.replies.push(event)
- }
- }
-
- return threadsByUrl
- },
-)
-
// Rooms
export const roomsByUrl = derived(channels, $channels => {
diff --git a/src/routes/spaces/[nrelay]/threads/+page.svelte b/src/routes/spaces/[nrelay]/threads/+page.svelte
index b4a39b8..94adce4 100644
--- a/src/routes/spaces/[nrelay]/threads/+page.svelte
+++ b/src/routes/spaces/[nrelay]/threads/+page.svelte
@@ -1,7 +1,9 @@