Browse Source

more discussions

imwald
Silberengel 5 months ago
parent
commit
ad924a99bb
  1. 1
      src/components/NoteList/index.tsx
  2. 18
      src/pages/primary/DiscussionsPage/index.tsx
  3. 17
      src/providers/KindFilterProvider.tsx

1
src/components/NoteList/index.tsx

@ -168,6 +168,7 @@ const NoteList = forwardRef( @@ -168,6 +168,7 @@ const NoteList = forwardRef(
setHasMore(true)
if (showKinds.length === 0) {
logger.warn('NoteList: showKinds is empty, no events will be displayed')
setLoading(false)
setHasMore(false)
return () => {}

18
src/pages/primary/DiscussionsPage/index.tsx

@ -238,6 +238,14 @@ function analyzeDynamicTopics(entries: EventMapEntry[]): { @@ -238,6 +238,14 @@ function analyzeDynamicTopics(entries: EventMapEntry[]): {
const allTopics = [...mainTopics, ...subtopics]
// Debug logging
console.log('Dynamic topics analysis:', {
hashtagCounts: Object.fromEntries(hashtagCounts),
mainTopics: mainTopics.map(t => ({ id: t.id, count: t.count })),
subtopics: subtopics.map(t => ({ id: t.id, count: t.count })),
allTopics: allTopics.map(t => ({ id: t.id, count: t.count, isMainTopic: t.isMainTopic, isSubtopic: t.isSubtopic }))
})
return { mainTopics, subtopics, allTopics }
}
@ -632,6 +640,16 @@ const DiscussionsPage = forwardRef(() => { @@ -632,6 +640,16 @@ const DiscussionsPage = forwardRef(() => {
return !!dynamicTopic
})
// Debug logging for subtopic detection
if (entrySubtopics.length > 0) {
console.log('Found subtopics for entry:', {
threadId: entry.event.id.substring(0, 8),
allTopics: entry.allTopics,
entrySubtopics,
dynamicTopics: dynamicTopics.allTopics.map(dt => ({ id: dt.id, isSubtopic: dt.isSubtopic }))
})
}
if (entrySubtopics.length > 0) {
// Group under the first subtopic found
const subtopic = entrySubtopics[0]

17
src/providers/KindFilterProvider.tsx

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
import { createContext, useContext, useState } from 'react'
import storage from '@/services/local-storage.service'
import { SUPPORTED_KINDS } from '@/constants'
import { kinds } from 'nostr-tools'
type TKindFilterContext = {
showKinds: number[]
@ -17,7 +19,20 @@ export const useKindFilter = () => { @@ -17,7 +19,20 @@ export const useKindFilter = () => {
}
export function KindFilterProvider({ children }: { children: React.ReactNode }) {
const [showKinds, setShowKinds] = useState<number[]>(storage.getShowKinds())
// Ensure we always have a default value - show all supported kinds except reposts
const defaultShowKinds = SUPPORTED_KINDS.filter(kind => kind !== kinds.Repost)
const storedShowKinds = storage.getShowKinds()
const [showKinds, setShowKinds] = useState<number[]>(
storedShowKinds.length > 0 ? storedShowKinds : defaultShowKinds
)
// Debug logging
console.log('KindFilterProvider initialized:', {
defaultShowKinds,
storedShowKinds,
finalShowKinds: showKinds,
showKindsLength: showKinds.length
})
const updateShowKinds = (kinds: number[]) => {
storage.setShowKinds(kinds)

Loading…
Cancel
Save