import { useState } from 'react'; import { VolumeX, Eye } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useMuteList } from '@/hooks/useMuteList'; import { isEventMuted } from '@/lib/muteHelpers'; import { cn } from '@/lib/utils'; import type { NostrEvent } from '@nostrify/nostrify'; interface MutedContentGuardProps { /** The Nostr event to check against the mute list. */ event: NostrEvent; /** Content that should only render when the user dismisses the guard. */ children: React.ReactNode; /** Optional class name for the guard container. */ className?: string; } /** * Guards children behind a muted-content overlay when the event matches * the user's mute list. Used on detail pages where the user navigated * directly to a muted post — feeds hide muted content entirely instead. * * Children are **not mounted** until the user explicitly reveals, so * media and nested queries are not fetched for muted content. */ export function MutedContentGuard({ event, children, className }: MutedContentGuardProps) { const { muteItems } = useMuteList(); const [revealed, setRevealed] = useState(false); if (revealed || muteItems.length === 0 || !isEventMuted(event, muteItems)) { return <>{children}>; } return (
Muted Content
This post is from a user or conversation you've muted.