From c40c809e6f4ba5aecf232c3c171f12fedca75298 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Fri, 31 Oct 2025 19:44:58 +0100 Subject: [PATCH] bug-fixes --- .../Note/AsciidocArticle/AsciidocArticle.tsx | 36 +++---- .../Note/MarkdownArticle/MarkdownArticle.tsx | 10 +- .../PublicationIndex/PublicationIndex.tsx | 94 ++++++++++--------- src/components/NoteList/index.tsx | 15 ++- 4 files changed, 88 insertions(+), 67 deletions(-) diff --git a/src/components/Note/AsciidocArticle/AsciidocArticle.tsx b/src/components/Note/AsciidocArticle/AsciidocArticle.tsx index d38e125..51e6fca 100644 --- a/src/components/Note/AsciidocArticle/AsciidocArticle.tsx +++ b/src/components/Note/AsciidocArticle/AsciidocArticle.tsx @@ -345,23 +345,25 @@ export default function AsciidocArticle({ return (
- {/* Article metadata */} -
-

{metadata.title}

- {metadata.summary && ( -
-

{metadata.summary}

-
- )} - {metadata.image && ( -
- -
- )} -
+ {/* Article metadata - hide when used as nested content */} + {!hideImagesAndInfo && ( +
+

{metadata.title}

+ {metadata.summary && ( +
+

{metadata.summary}

+
+ )} + {metadata.image && ( +
+ +
+ )} +
+ )} {/* Render AsciiDoc content (everything is now processed as AsciiDoc) */}
- {metadata.title &&

{metadata.title}

} - {metadata.summary && ( + {!hideMetadata && metadata.title &&

{metadata.title}

} + {!hideMetadata && metadata.summary && (

{metadata.summary}

)} - {metadata.image && (() => { + {!hideMetadata && metadata.image && (() => { // Find the index of the metadata image in allImages const cleanedMetadataImage = cleanUrl(metadata.image) const metadataImageIndex = cleanedMetadataImage diff --git a/src/components/Note/PublicationIndex/PublicationIndex.tsx b/src/components/Note/PublicationIndex/PublicationIndex.tsx index 0be9869..228dd6b 100644 --- a/src/components/Note/PublicationIndex/PublicationIndex.tsx +++ b/src/components/Note/PublicationIndex/PublicationIndex.tsx @@ -46,10 +46,12 @@ interface PublicationMetadata { export default function PublicationIndex({ event, - className + className, + isNested = false }: { event: Event className?: string + isNested?: boolean }) { const { push } = useSecondaryPage() // Parse publication metadata from event tags @@ -780,48 +782,50 @@ export default function PublicationIndex({ return (
- {/* Publication Metadata */} -
-
-
-

{metadata.title}

- -
- {metadata.summary && ( -
-

{metadata.summary}

-
- )} -
- {metadata.author && ( -
- Author: {metadata.author} -
- )} - {metadata.version && ( -
- Version: {metadata.version} -
- )} - {metadata.type && ( -
- Type: {metadata.type} -
+ {/* Publication Metadata - only show for top-level publications */} + {!isNested && ( +
+
+
+

{metadata.title}

+ +
+ {metadata.summary && ( +
+

{metadata.summary}

+
)} -
-
-
+
+ {metadata.author && ( +
+ Author: {metadata.author} +
+ )} + {metadata.version && ( +
+ Version: {metadata.version} +
+ )} + {metadata.type && ( +
+ Type: {metadata.type} +
+ )} +
+ +
+ )} - {/* Table of Contents */} - {!isLoading && tableOfContents.length > 0 && ( + {/* Table of Contents - only show for top-level publications */} + {!isNested && !isLoading && tableOfContents.length > 0 && (

Table of Contents

)} - {/* Failed References Banner */} - {!isLoading && failedReferences.length > 0 && references.length > 0 && ( + {/* Failed References Banner - only show for top-level publications */} + {!isNested && !isLoading && failedReferences.length > 0 && references.length > 0 && (
@@ -954,7 +958,7 @@ export default function PublicationIndex({ // Recursively render nested 30040 publication index return (
- +
) } else if (eventKind === ExtendedKind.PUBLICATION_CONTENT || eventKind === ExtendedKind.WIKI_ARTICLE) { @@ -968,7 +972,7 @@ export default function PublicationIndex({ // Render 30817 content as MarkdownArticle return (
- +
) } else { diff --git a/src/components/NoteList/index.tsx b/src/components/NoteList/index.tsx index 2c5d195..d667145 100644 --- a/src/components/NoteList/index.tsx +++ b/src/components/NoteList/index.tsx @@ -1,5 +1,6 @@ import NewNotesButton from '@/components/NewNotesButton' import { Button } from '@/components/ui/button' +import { ExtendedKind } from '@/constants' import { getReplaceableCoordinateFromEvent, isMentioningMutedUsers, @@ -7,12 +8,14 @@ import { isReplyNoteEvent } from '@/lib/event' import { shouldFilterEvent } from '@/lib/event-filtering' +import { getZapInfoFromEvent } from '@/lib/event-metadata' import { isTouchDevice } from '@/lib/utils' import { useContentPolicy } from '@/providers/ContentPolicyProvider' import { useDeletedEvent } from '@/providers/DeletedEventProvider' import { useMuteList } from '@/providers/MuteListProvider' import { useNostr } from '@/providers/NostrProvider' import { useUserTrust } from '@/providers/UserTrustProvider' +import { useZap } from '@/providers/ZapProvider' import client from '@/services/client.service' import { TFeedSubRequest } from '@/types' import dayjs from 'dayjs' @@ -65,6 +68,7 @@ const NoteList = forwardRef( const { mutePubkeySet } = useMuteList() const { hideContentMentioningMutedUsers } = useContentPolicy() const { isEventDeleted } = useDeletedEvent() + const { zapReplyThreshold } = useZap() const [events, setEvents] = useState([]) const [newEvents, setNewEvents] = useState([]) const [hasMore, setHasMore] = useState(true) @@ -106,9 +110,18 @@ const NoteList = forwardRef( // Filter out expired events if (shouldFilterEvent(evt)) return true + // Filter out zap receipts below the zap threshold (superzaps) + if (evt.kind === ExtendedKind.ZAP_RECEIPT) { + const zapInfo = getZapInfoFromEvent(evt) + // Hide zap receipts if amount is missing, 0, or below the threshold + if (!zapInfo || zapInfo.amount === undefined || zapInfo.amount === 0 || zapInfo.amount < zapReplyThreshold) { + return true + } + } + return false }, - [hideReplies, hideUntrustedNotes, mutePubkeySet, pinnedEventIds, isEventDeleted] + [hideReplies, hideUntrustedNotes, mutePubkeySet, pinnedEventIds, isEventDeleted, zapReplyThreshold] ) const filteredEvents = useMemo(() => {