mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 23:24:22 +01:00
fix: resolve all linting and type errors
This commit is contained in:
@@ -68,7 +68,6 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
|||||||
setReaderContent,
|
setReaderContent,
|
||||||
setReaderLoading,
|
setReaderLoading,
|
||||||
setIsCollapsed,
|
setIsCollapsed,
|
||||||
setIsHighlightsCollapsed,
|
|
||||||
setHighlights,
|
setHighlights,
|
||||||
setHighlightsLoading,
|
setHighlightsLoading,
|
||||||
setCurrentArticleCoordinate,
|
setCurrentArticleCoordinate,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ interface UseArticleLoaderProps {
|
|||||||
setReaderContent: (content: ReadableContent | undefined) => void
|
setReaderContent: (content: ReadableContent | undefined) => void
|
||||||
setReaderLoading: (loading: boolean) => void
|
setReaderLoading: (loading: boolean) => void
|
||||||
setIsCollapsed: (collapsed: boolean) => void
|
setIsCollapsed: (collapsed: boolean) => void
|
||||||
setIsHighlightsCollapsed: (collapsed: boolean) => void
|
|
||||||
setHighlights: (highlights: Highlight[]) => void
|
setHighlights: (highlights: Highlight[]) => void
|
||||||
setHighlightsLoading: (loading: boolean) => void
|
setHighlightsLoading: (loading: boolean) => void
|
||||||
setCurrentArticleCoordinate: (coord: string | undefined) => void
|
setCurrentArticleCoordinate: (coord: string | undefined) => void
|
||||||
@@ -26,7 +25,6 @@ export function useArticleLoader({
|
|||||||
setReaderContent,
|
setReaderContent,
|
||||||
setReaderLoading,
|
setReaderLoading,
|
||||||
setIsCollapsed,
|
setIsCollapsed,
|
||||||
setIsHighlightsCollapsed,
|
|
||||||
setHighlights,
|
setHighlights,
|
||||||
setHighlightsLoading,
|
setHighlightsLoading,
|
||||||
setCurrentArticleCoordinate,
|
setCurrentArticleCoordinate,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { RelayPool, completeOnEose } from 'applesauce-relay'
|
import { RelayPool, completeOnEose, onlyEvents } from 'applesauce-relay'
|
||||||
import { lastValueFrom, takeUntil, timer, toArray, scan } from 'rxjs'
|
import { lastValueFrom, takeUntil, timer, tap, toArray } from 'rxjs'
|
||||||
import { NostrEvent } from 'nostr-tools'
|
import { NostrEvent } from 'nostr-tools'
|
||||||
import {
|
import {
|
||||||
getHighlightText,
|
getHighlightText,
|
||||||
@@ -91,15 +91,16 @@ export const fetchHighlightsForArticle = async (
|
|||||||
relayPool
|
relayPool
|
||||||
.req(highlightRelays, { kinds: [9802], '#a': [articleCoordinate] })
|
.req(highlightRelays, { kinds: [9802], '#a': [articleCoordinate] })
|
||||||
.pipe(
|
.pipe(
|
||||||
scan((acc: NostrEvent[], event: NostrEvent) => {
|
onlyEvents(),
|
||||||
|
tap((event: NostrEvent) => {
|
||||||
const highlight = processEvent(event)
|
const highlight = processEvent(event)
|
||||||
if (highlight && onHighlight) {
|
if (highlight && onHighlight) {
|
||||||
onHighlight(highlight)
|
onHighlight(highlight)
|
||||||
}
|
}
|
||||||
return [...acc, event]
|
}),
|
||||||
}, []),
|
|
||||||
completeOnEose(),
|
completeOnEose(),
|
||||||
takeUntil(timer(10000))
|
takeUntil(timer(10000)),
|
||||||
|
toArray()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -112,15 +113,16 @@ export const fetchHighlightsForArticle = async (
|
|||||||
relayPool
|
relayPool
|
||||||
.req(highlightRelays, { kinds: [9802], '#e': [eventId] })
|
.req(highlightRelays, { kinds: [9802], '#e': [eventId] })
|
||||||
.pipe(
|
.pipe(
|
||||||
scan((acc: NostrEvent[], event: NostrEvent) => {
|
onlyEvents(),
|
||||||
|
tap((event: NostrEvent) => {
|
||||||
const highlight = processEvent(event)
|
const highlight = processEvent(event)
|
||||||
if (highlight && onHighlight) {
|
if (highlight && onHighlight) {
|
||||||
onHighlight(highlight)
|
onHighlight(highlight)
|
||||||
}
|
}
|
||||||
return [...acc, event]
|
}),
|
||||||
}, []),
|
|
||||||
completeOnEose(),
|
completeOnEose(),
|
||||||
takeUntil(timer(10000))
|
takeUntil(timer(10000)),
|
||||||
|
toArray()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
console.log('📊 Highlights via e-tag:', eTagEvents.length)
|
console.log('📊 Highlights via e-tag:', eTagEvents.length)
|
||||||
@@ -202,7 +204,8 @@ export const fetchHighlights = async (
|
|||||||
relayPool
|
relayPool
|
||||||
.req(relayUrls, { kinds: [9802], authors: [pubkey] })
|
.req(relayUrls, { kinds: [9802], authors: [pubkey] })
|
||||||
.pipe(
|
.pipe(
|
||||||
scan((acc: NostrEvent[], event: NostrEvent) => {
|
onlyEvents(),
|
||||||
|
tap((event: NostrEvent) => {
|
||||||
if (!seenIds.has(event.id)) {
|
if (!seenIds.has(event.id)) {
|
||||||
seenIds.add(event.id)
|
seenIds.add(event.id)
|
||||||
|
|
||||||
@@ -235,10 +238,10 @@ export const fetchHighlights = async (
|
|||||||
onHighlight(highlight)
|
onHighlight(highlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [...acc, event]
|
}),
|
||||||
}, []),
|
|
||||||
completeOnEose(),
|
completeOnEose(),
|
||||||
takeUntil(timer(10000))
|
takeUntil(timer(10000)),
|
||||||
|
toArray()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user