feat: 💨

This commit is contained in:
codytseng
2025-08-16 16:36:11 +08:00
parent 32ec3af729
commit 6df352a2ab
3 changed files with 7 additions and 4 deletions

View File

@@ -65,6 +65,9 @@ export default function Likes({ event }: { event: Event }) {
)}
onClick={(e) => {
e.stopPropagation()
if (pubkey && pubkeys.has(pubkey)) {
return
}
like(key, emoji)
}}
>

View File

@@ -15,7 +15,7 @@ import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { useUserTrust } from '@/providers/UserTrustProvider'
import noteStatsService from '@/services/note-stats.service'
import { Loader, PencilLine, Repeat } from 'lucide-react'
import { Event, kinds } from 'nostr-tools'
import { Event } from 'nostr-tools'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import PostEditor from '../PostEditor'
@@ -51,8 +51,8 @@ export default function RepostButton({ event }: { event: Event }) {
const hasReposted = noteStats?.repostPubkeySet?.has(pubkey)
if (hasReposted) return
if (!noteStats?.updatedAt) {
const events = await noteStatsService.fetchNoteStats(event, pubkey)
if (events.some((e) => e.kind === kinds.Repost && e.pubkey === pubkey)) {
const noteStats = await noteStatsService.fetchNoteStats(event, pubkey)
if (noteStats.repostPubkeySet?.has(pubkey)) {
return
}
}

View File

@@ -136,7 +136,7 @@ class NoteStatsService {
...(this.noteStatsMap.get(event.id) ?? {}),
updatedAt: dayjs().unix()
})
return events
return this.noteStatsMap.get(event.id) ?? {}
}
subscribeNoteStats(noteId: string, callback: () => void) {