feat: support sending 1984 reports

This commit is contained in:
codytseng 2025-09-06 00:15:54 +08:00
parent 7562ae2c77
commit 71994be407
23 changed files with 685 additions and 17 deletions

View file

@ -6,7 +6,18 @@ import { useFavoriteRelays } from '@/providers/FavoriteRelaysProvider'
import { useMuteList } from '@/providers/MuteListProvider'
import { useNostr } from '@/providers/NostrProvider'
import client from '@/services/client.service'
import { Bell, BellOff, Code, Copy, Link, Mail, SatelliteDish, Server, Trash2 } from 'lucide-react'
import {
Bell,
BellOff,
Code,
Copy,
Link,
Mail,
SatelliteDish,
Server,
Trash2,
TriangleAlert
} from 'lucide-react'
import { Event } from 'nostr-tools'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
@ -34,6 +45,7 @@ interface UseMenuActionsProps {
closeDrawer: () => void
showSubMenuActions: (subMenu: SubMenuAction[], title: string) => void
setIsRawEventDialogOpen: (open: boolean) => void
setIsReportDialogOpen: (open: boolean) => void
isSmallScreen: boolean
}
@ -42,6 +54,7 @@ export function useMenuActions({
closeDrawer,
showSubMenuActions,
setIsRawEventDialogOpen,
setIsReportDialogOpen,
isSmallScreen
}: UseMenuActionsProps) {
const { t } = useTranslation()
@ -198,6 +211,19 @@ export function useMenuActions({
})
}
if (pubkey && event.pubkey !== pubkey) {
actions.push({
icon: TriangleAlert,
label: t('Report'),
className: 'text-destructive focus:text-destructive',
onClick: () => {
closeDrawer()
setIsReportDialogOpen(true)
},
separator: true
})
}
if (pubkey && event.pubkey !== pubkey) {
if (isMuted) {
actions.push({