+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
{follows.length >= 10 && (
navigate("/auth/onboarding", { replace: true }), 1200);
@@ -47,8 +47,6 @@ export function ImportStep2Screen() {
}
};
- console.log(account);
-
return (
diff --git a/src/app/space/components/blocks/thread.tsx b/src/app/space/components/blocks/thread.tsx
index bac42f46..a7cf18c4 100644
--- a/src/app/space/components/blocks/thread.tsx
+++ b/src/app/space/components/blocks/thread.tsx
@@ -9,6 +9,7 @@ import { NoteSkeleton } from "@shared/notes/skeleton";
import { TitleBar } from "@shared/titleBar";
import { User } from "@shared/user";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useAccount } from "@utils/hooks/useAccount";
import { parser } from "@utils/parser";
export function ThreadBlock({ params }: { params: any }) {
@@ -16,6 +17,7 @@ export function ThreadBlock({ params }: { params: any }) {
const queryClient = useQueryClient();
+ const { account } = useAccount();
const { status, data } = useQuery(["thread", params.content], async () => {
const res = await getNoteByID(params.content);
res["content"] = parser(res);
@@ -55,7 +57,12 @@ export function ThreadBlock({ params }: { params: any }) {
-
+ {account && (
+
+ )}
)}
diff --git a/src/shared/avatarUploader.tsx b/src/shared/avatarUploader.tsx
index 59c4cd05..74a05882 100644
--- a/src/shared/avatarUploader.tsx
+++ b/src/shared/avatarUploader.tsx
@@ -60,7 +60,7 @@ export function AvatarUploader({ setPicture }: { setPicture: any }) {
className="w-full h-full inline-flex items-center justify-center bg-zinc-900/40"
>
{loading ? (
-
+
) : (
)}
diff --git a/src/shared/bannerUploader.tsx b/src/shared/bannerUploader.tsx
index af417232..8e1215d5 100644
--- a/src/shared/bannerUploader.tsx
+++ b/src/shared/bannerUploader.tsx
@@ -60,7 +60,7 @@ export function BannerUploader({ setBanner }: { setBanner: any }) {
className="w-full h-full inline-flex items-center justify-center bg-zinc-900/40"
>
{loading ? (
-
+
) : (
)}
diff --git a/src/shared/notes/replies/form.tsx b/src/shared/notes/replies/form.tsx
index 46bb3d6c..10de49b1 100644
--- a/src/shared/notes/replies/form.tsx
+++ b/src/shared/notes/replies/form.tsx
@@ -2,16 +2,16 @@ import { usePublish } from "@libs/ndk";
import { Button } from "@shared/button";
import { Image } from "@shared/image";
import { DEFAULT_AVATAR, FULL_RELAYS } from "@stores/constants";
-import { useAccount } from "@utils/hooks/useAccount";
import { useProfile } from "@utils/hooks/useProfile";
+import { shortenKey } from "@utils/shortenKey";
import { useState } from "react";
-export function NoteReplyForm({ rootID }: { rootID: string }) {
+export function NoteReplyForm({
+ rootID,
+ userPubkey,
+}: { rootID: string; userPubkey: string }) {
const publish = usePublish();
-
- const { account } = useAccount();
- const { status, user } = useProfile(account.npub);
-
+ const { status, user } = useProfile(userPubkey);
const [value, setValue] = useState("");
const submit = () => {
@@ -45,9 +45,9 @@ export function NoteReplyForm({ rootID }: { rootID: string }) {
@@ -56,7 +56,7 @@ export function NoteReplyForm({ rootID }: { rootID: string }) {
Reply as
- {user?.nip05 || user?.name}
+ {user.nip05 || user.name || shortenKey(userPubkey)}
diff --git a/src/utils/hooks/useProfile.tsx b/src/utils/hooks/useProfile.tsx
index 751306cd..91718e4b 100644
--- a/src/utils/hooks/useProfile.tsx
+++ b/src/utils/hooks/useProfile.tsx
@@ -1,8 +1,9 @@
+import { NDKUser } from "@nostr-dev-kit/ndk";
import { RelayContext } from "@shared/relayProvider";
import { useQuery } from "@tanstack/react-query";
import { useContext } from "react";
-export function useProfile(pubkey: string) {
+export function useProfile(pubkey: string, fallback?: string) {
const ndk = useContext(RelayContext);
const {
status,
@@ -12,10 +13,15 @@ export function useProfile(pubkey: string) {
} = useQuery(
["user", pubkey],
async () => {
- const user = ndk.getUser({ hexpubkey: pubkey });
- await user.fetchProfile();
+ if (fallback) {
+ const profile = JSON.parse(fallback);
+ return profile;
+ } else {
+ const user = ndk.getUser({ hexpubkey: pubkey });
+ await user.fetchProfile();
- return user.profile;
+ return user.profile;
+ }
},
{
staleTime: Infinity,