diff --git a/src/shared/notes/actions.tsx b/src/shared/notes/actions.tsx
index c106917b..9255850d 100644
--- a/src/shared/notes/actions.tsx
+++ b/src/shared/notes/actions.tsx
@@ -9,6 +9,8 @@ import { NoteReply } from '@shared/notes/actions/reply';
import { NoteRepost } from '@shared/notes/actions/repost';
import { NoteZap } from '@shared/notes/actions/zap';
+import { BLOCK_KINDS } from '@stores/constants';
+
export function NoteActions({ id, pubkey }: { id: string; pubkey: string }) {
const queryClient = useQueryClient();
@@ -22,7 +24,7 @@ export function NoteActions({ id, pubkey }: { id: string; pubkey: string }) {
});
const openThread = (thread: string) => {
- block.mutate({ kind: 2, title: 'Thread', content: thread });
+ block.mutate({ kind: BLOCK_KINDS.thread, title: 'Thread', content: thread });
};
return (
diff --git a/src/shared/notes/content.tsx b/src/shared/notes/content.tsx
index fe728ef3..e46a4990 100644
--- a/src/shared/notes/content.tsx
+++ b/src/shared/notes/content.tsx
@@ -2,6 +2,7 @@ import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import {
+ Hashtag,
ImagePreview,
LinkPreview,
MentionNote,
@@ -30,24 +31,16 @@ export function NoteContent({
del: ({ children }) => {
const key = children[0] as string;
if (key.startsWith('pub')) return
;
- if (key.startsWith('tag'))
- return (
-
- );
+ if (key.startsWith('tag')) return
;
},
}}
>
{content.parsed}
- {content.images.length > 0 &&
}
- {content.videos.length > 0 &&
}
- {content.links.length > 0 &&
}
- {content.notes.length > 0 &&
+ {content.images?.length > 0 &&
}
+ {content.videos?.length > 0 &&
}
+ {content.links?.length > 0 &&
}
+ {content.notes?.length > 0 &&
content.notes.map((note: string) =>
)}
>
);
diff --git a/src/shared/notes/hashtag.tsx b/src/shared/notes/hashtag.tsx
new file mode 100644
index 00000000..5b29c425
--- /dev/null
+++ b/src/shared/notes/hashtag.tsx
@@ -0,0 +1,36 @@
+import { useMutation, useQueryClient } from '@tanstack/react-query';
+
+import { createBlock } from '@libs/storage';
+
+import { BLOCK_KINDS } from '@stores/constants';
+
+export function Hashtag({ tag }: { tag: string }) {
+ const queryClient = useQueryClient();
+
+ const block = useMutation({
+ mutationFn: (data: { kind: number; title: string; content: string }) => {
+ return createBlock(data.kind, data.title, data.content);
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ['blocks'] });
+ },
+ });
+
+ const openBlock = () => {
+ block.mutate({
+ kind: BLOCK_KINDS.hashtag,
+ title: tag,
+ content: tag.replace('#', ''),
+ });
+ };
+
+ return (
+
+ );
+}
diff --git a/src/shared/notes/index.tsx b/src/shared/notes/index.tsx
index b12f5be9..a9ba8762 100644
--- a/src/shared/notes/index.tsx
+++ b/src/shared/notes/index.tsx
@@ -21,3 +21,4 @@ export * from './kinds/sub';
export * from './skeleton';
export * from './actions';
export * from './content';
+export * from './hashtag';
diff --git a/src/shared/notes/kinds/kind1.tsx b/src/shared/notes/kinds/kind1.tsx
index 13730902..f6bc0c0c 100644
--- a/src/shared/notes/kinds/kind1.tsx
+++ b/src/shared/notes/kinds/kind1.tsx
@@ -24,11 +24,11 @@ export function NoteKind_1({
-
+
{!skipMetadata ? (
-