fix: replies

This commit is contained in:
codytseng
2025-05-15 23:38:22 +08:00
parent a6c2decfe3
commit 304bbe4f01
13 changed files with 178 additions and 120 deletions

View File

@@ -1,25 +1,24 @@
import { Skeleton } from '@/components/ui/skeleton'
import { useFetchEvent } from '@/hooks'
import { cn } from '@/lib/utils'
import { useMuteList } from '@/providers/MuteListProvider'
import { Event } from 'nostr-tools'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import ContentPreview from '../ContentPreview'
import UserAvatar from '../UserAvatar'
export default function ParentNotePreview({
event,
isFetching = false,
eventId,
className,
onClick
}: {
event?: Event
isFetching?: boolean
eventId: string
className?: string
onClick?: React.MouseEventHandler<HTMLDivElement> | undefined
}) {
const { t } = useTranslation()
const { mutePubkeys } = useMuteList()
const { event, isFetching } = useFetchEvent(eventId)
const isMuted = useMemo(
() => (event ? mutePubkeys.includes(event.pubkey) : false),
[mutePubkeys, event]
@@ -43,6 +42,20 @@ export default function ParentNotePreview({
)
}
if (!event) {
return (
<div
className={cn(
'flex gap-1 items-center text-sm rounded-full px-2 bg-muted w-fit max-w-full text-muted-foreground',
className
)}
>
<div className="shrink-0">{t('reply to')}</div>
<div>{`[${t('Not found the note')}]`}</div>
</div>
)
}
return (
<div
className={cn(