import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card' import { cn } from '@/lib/utils' import { Repeat2 } from 'lucide-react' import { useTranslation } from 'react-i18next' import UserAvatar from '../UserAvatar' import Username from '../Username' /** * - reposters.length === 1: show "Alice reposted" * - reposters.length === 2: show "Alice, Bob reposted" * - reposters.length === 3: show "Alice, Bob, Charlie reposted" * - reposters.length > 3: show "Alice, Bob, and x others reposted" (with hover card showing avatars of others) */ export default function RepostDescription({ reposters, className }: { reposters?: string[] className?: string }) { const { t } = useTranslation() if (!reposters?.length) return null return (
1 && 'after:content-[","]')} skeletonClassName="h-3" /> {reposters.length > 1 && ( )} {reposters.length > 3 ? ( ) : reposters.length === 3 ? ( ) : null}
{t('reposted')}
) } function AndXOthers({ reposters }: { reposters: string[] }) { const { t } = useTranslation() return ( {t('and {{x}} others', { x: reposters.length })} {reposters.map((pubkey) => (
))}
) }