diff --git a/src/pages/secondary/NotePage/index.tsx b/src/pages/secondary/NotePage/index.tsx index 01509891..5ac901f6 100644 --- a/src/pages/secondary/NotePage/index.tsx +++ b/src/pages/secondary/NotePage/index.tsx @@ -11,10 +11,12 @@ import { Skeleton } from '@/components/ui/skeleton' import { ExtendedKind } from '@/constants' import { useFetchEvent } from '@/hooks' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' -import { getParentEventId, getRootEventId, isPictureEvent } from '@/lib/event' +import { getParentEventId, getParentEventTag, getRootEventId, isPictureEvent } from '@/lib/event' import { toNote, toNoteList } from '@/lib/link' import { tagNameEquals } from '@/lib/tag' import { cn } from '@/lib/utils' +import { Ellipsis } from 'lucide-react' +import { Event } from 'nostr-tools' import { forwardRef, useMemo } from 'react' import { useTranslation } from 'react-i18next' import NotFoundPage from '../NotFoundPage' @@ -28,6 +30,8 @@ const NotePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref () => (event?.kind === ExtendedKind.COMMENT ? event.tags.find(tagNameEquals('I')) : undefined), [event] ) + const { isFetching: isFetchingRootEvent, event: rootEvent } = useFetchEvent(rootEventId) + const { isFetching: isFetchingParentEvent, event: parentEvent } = useFetchEvent(parentEventId) if (!event && isFetching) { return ( @@ -73,9 +77,18 @@ const NotePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref
{rootITag && } {rootEventId !== parentEventId && ( - + )} - + - +
-
+
) } + if (!event) return null return (
{ if (!event) return - push(toNote(eventId)) + push(toNote(event)) }} > {event && } -
+ {isConsecutive ? ( +
+ ) : ( + + )}
) } + +function isConsecutive(rootEvent?: Event, parentEvent?: Event) { + const eTag = getParentEventTag(parentEvent) + if (!eTag) return false + + return rootEvent?.id === eTag[1] +}