-
Replies
+ {data.length} replies
- {status === 'loading' ? (
-
- ) : data.length === 0 ? (
+ {data?.length === 0 ? (
@@ -44,7 +68,7 @@ export function RepliesList({ id }: { id: string }) {
) : (
- data.map((event: NDKEvent) =>
)
+ data.reverse().map((event: NDKEvent) =>
)
)}
diff --git a/src/shared/notes/replies/sub.tsx b/src/shared/notes/replies/sub.tsx
new file mode 100644
index 00000000..57b3ad38
--- /dev/null
+++ b/src/shared/notes/replies/sub.tsx
@@ -0,0 +1,24 @@
+import { useMemo } from 'react';
+
+import { NoteActions, NoteContent } from '@shared/notes';
+import { User } from '@shared/user';
+
+import { parser } from '@utils/parser';
+import { LumeEvent } from '@utils/types';
+
+export function SubReply({ event }: { event: LumeEvent }) {
+ const content = useMemo(() => parser(event), [event]);
+
+ return (
+
+ );
+}
diff --git a/src/utils/hooks/useProfile.tsx b/src/utils/hooks/useProfile.tsx
index 4b1363f6..8855546b 100644
--- a/src/utils/hooks/useProfile.tsx
+++ b/src/utils/hooks/useProfile.tsx
@@ -16,6 +16,7 @@ export function useProfile(pubkey: string, fallback?: string) {
const current = Math.floor(Date.now() / 1000);
const cache = await getUserMetadata(pubkey);
if (cache && parseInt(cache.created_at) + 86400 >= current) {
+ console.log('cache hit - ', cache);
return cache;
} else {
const filter: NDKFilter = { kinds: [0], authors: [pubkey] };
@@ -24,6 +25,8 @@ export function useProfile(pubkey: string, fallback?: string) {
if (latest) {
await createMetadata(pubkey, pubkey, latest.content);
return JSON.parse(latest.content);
+ } else {
+ return null;
}
}
} else {
diff --git a/src/utils/types.d.ts b/src/utils/types.d.ts
index f5b2b7ba..2c7a807b 100644
--- a/src/utils/types.d.ts
+++ b/src/utils/types.d.ts
@@ -3,6 +3,7 @@ import { NDKEvent } from '@nostr-dev-kit/ndk';
export interface LumeEvent extends NDKEvent {
event_id?: string;
parent_id?: string;
+ replies?: LumeEvent[];
}
export interface Account {