replace all nostr-react useProfile with NDK useProfileValue

This commit is contained in:
2025-05-04 23:25:24 +02:00
parent ec4e6f2712
commit 048a721b65
22 changed files with 56 additions and 67 deletions

View File

@@ -15,14 +15,14 @@ import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar"
import { useProfile } from "nostr-react"
import Link from "next/link"
import { nip19 } from "nostr-tools"
import { useProfileValue } from "@nostr-dev-kit/ndk-hooks"
export function AvatarDropdown() {
let pubkey = window.localStorage.getItem('pubkey');
let pubkeyEncoded = pubkey ? nip19.npubEncode(pubkey) : pubkey;
let src = "https://robohash.org/" + (pubkey as string);
const { data: userData } = useProfile({
pubkey: pubkey as string,
});
const userData = useProfileValue(pubkey as string);
if (pubkey !== null) {
src = userData?.picture || "https://robohash.org/" + pubkey;
}