import { RepostIcon } from "@lume/icons"; import { displayNpub, formatCreatedAt } from "@lume/utils"; import * as Avatar from "@radix-ui/react-avatar"; import { minidenticon } from "minidenticons"; import { useMemo } from "react"; import { twMerge } from "tailwind-merge"; import { useProfile } from "../../hooks/useProfile"; import { useNoteContext } from "./provider"; export function NoteUser({ variant = "text", className, }: { variant?: "text" | "repost" | "mention" | "thread"; className?: string; }) { const event = useNoteContext(); const createdAt = useMemo( () => formatCreatedAt(event.created_at), [event.created_at], ); const fallbackName = useMemo( () => displayNpub(event.pubkey, 16), [event.pubkey], ); const fallbackAvatar = useMemo( () => `data:image/svg+xml;utf8,${encodeURIComponent( minidenticon(event.pubkey, 90, 50), )}`, [event.pubkey], ); const { isLoading, user } = useProfile(event.pubkey); if (variant === "mention") { if (isLoading) { return (