feat: mute

This commit is contained in:
codytseng 2025-01-19 14:40:05 +08:00
parent 34ff0cd314
commit cbae26e492
26 changed files with 564 additions and 45 deletions

View file

@ -5,7 +5,9 @@ import {
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
import { getSharableEventId } from '@/lib/event'
import { Code, Copy, Ellipsis } from 'lucide-react'
import { useMuteList } from '@/providers/MuteListProvider'
import { useNostr } from '@/providers/NostrProvider'
import { BellOff, Code, Copy, Ellipsis } from 'lucide-react'
import { Event } from 'nostr-tools'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -13,7 +15,9 @@ import RawEventDialog from './RawEventDialog'
export default function NoteOptions({ event }: { event: Event }) {
const { t } = useTranslation()
const { pubkey } = useNostr()
const [isRawEventDialogOpen, setIsRawEventDialogOpen] = useState(false)
const { mutePubkey } = useMuteList()
return (
<div className="h-4" onClick={(e) => e.stopPropagation()}>
@ -35,6 +39,15 @@ export default function NoteOptions({ event }: { event: Event }) {
<Code />
{t('raw event')}
</DropdownMenuItem>
{pubkey && (
<DropdownMenuItem
onClick={() => mutePubkey(event.pubkey)}
className="text-destructive focus:text-destructive"
>
<BellOff />
{t('mute author')}
</DropdownMenuItem>
)}
</DropdownMenuContent>
</DropdownMenu>
<RawEventDialog