import ReportCard from '@/components/ReportCard' import { RefreshButton } from '@/components/RefreshButton' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog' import { Skeleton } from '@/components/ui/skeleton' import { useProfileReportsEvents } from '@/hooks/useProfileReportsEvents' import { useProfileReportsRelayBuilder } from '@/hooks/useProfileReportsRelayBuilder' import { RefreshCw } from 'lucide-react' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' export function ProfileReportsPanel({ pubkey }: { pubkey: string }) { const { t } = useTranslation() const relayUrlsBuilder = useProfileReportsRelayBuilder(pubkey) const { received, made, isLoading, refresh } = useProfileReportsEvents({ pubkey, relayUrlsBuilder }) const [isRefreshing, setIsRefreshing] = useState(false) useEffect(() => { if (!isLoading) setIsRefreshing(false) }, [isLoading]) const handleRefresh = () => { setIsRefreshing(true) refresh() } if (isLoading && received.length === 0 && made.length === 0) { return (
{Array.from({ length: 3 }).map((_, i) => ( ))}
) } return (
{isRefreshing && (
{t('Refreshing reports...')}
)}

{t('Reports received')}

{received.length === 0 ? (

{t('No reports received')}

) : (
{received.map((event) => ( ))}
)}

{t('Reports made')}

{made.length === 0 ? (

{t('No reports made')}

) : (
{made.map((event) => ( ))}
)}
) } export default function ProfileReportsDialog({ open, onOpenChange, pubkey }: { open: boolean onOpenChange: (open: boolean) => void pubkey: string }) { const { t } = useTranslation() return ( {t('Reports')} {t('Profile reports dialog description')}
{open ? : null}
) }