feat: nip-89

This commit is contained in:
2024-09-12 22:15:54 +01:00
parent c74af0159c
commit ca4170be4f
15 changed files with 149 additions and 53 deletions

View File

@ -12,9 +12,9 @@ interface DisplayNameProps {
user?: UserMetadata | undefined;
}
const DisplayName = ({ pubkey }: DisplayNameProps) => {
const profile = useUserProfile(pubkey);
const [name, isPlaceHolder] = useMemo(() => getDisplayNameOrPlaceHolder(profile, pubkey), [profile, pubkey]);
const DisplayName = ({ pubkey, user }: DisplayNameProps) => {
const profile = useUserProfile(user ? undefined : pubkey);
const [name, isPlaceHolder] = useMemo(() => getDisplayNameOrPlaceHolder(profile ?? user, pubkey), [profile, pubkey]);
return <span className={classNames({ placeholder: isPlaceHolder })}>{name}</span>;
};