From b3b790588a099a5b8483039a5c0542bb45eeeacb Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Mon, 17 Jul 2023 08:54:17 +0700 Subject: [PATCH] add hashtag block --- src/app/space/components/addFeed.tsx | 10 +- src/app/space/components/addImage.tsx | 15 +-- src/app/space/components/blocks/feed.tsx | 10 +- src/app/space/components/blocks/following.tsx | 6 +- src/app/space/components/blocks/hashtag.tsx | 102 ++++++++++++++++++ src/app/space/components/blocks/image.tsx | 4 +- src/app/space/components/blocks/thread.tsx | 4 +- src/app/space/index.tsx | 35 +++--- src/shared/notes/actions.tsx | 4 +- src/shared/notes/content.tsx | 19 ++-- src/shared/notes/hashtag.tsx | 36 +++++++ src/shared/notes/index.tsx | 1 + src/shared/notes/kinds/kind1.tsx | 4 +- src/stores/constants.tsx | 8 ++ src/utils/types.d.ts | 4 +- 15 files changed, 203 insertions(+), 59 deletions(-) create mode 100644 src/app/space/components/blocks/hashtag.tsx create mode 100644 src/shared/notes/hashtag.tsx diff --git a/src/app/space/components/addFeed.tsx b/src/app/space/components/addFeed.tsx index 33ced7ad..aa221100 100644 --- a/src/app/space/components/addFeed.tsx +++ b/src/app/space/components/addFeed.tsx @@ -12,7 +12,7 @@ import { createBlock } from '@libs/storage'; import { CancelIcon, CheckCircleIcon, CommandIcon, LoaderIcon } from '@shared/icons'; -import { DEFAULT_AVATAR } from '@stores/constants'; +import { BLOCK_KINDS, DEFAULT_AVATAR } from '@stores/constants'; import { ADD_FEEDBLOCK_SHORTCUT } from '@stores/shortcuts'; import { useAccount } from '@utils/hooks/useAccount'; @@ -38,7 +38,7 @@ export function AddFeedBlock() { useHotkeys(ADD_FEEDBLOCK_SHORTCUT, () => openModal()); const block = useMutation({ - mutationFn: (data: any) => { + mutationFn: (data: { kind: number; title: string; content: string }) => { return createBlock(data.kind, data.title, data.content); }, onSuccess: () => { @@ -53,7 +53,7 @@ export function AddFeedBlock() { formState: { isDirty, isValid }, } = useForm(); - const onSubmit = (data: any) => { + const onSubmit = (data: { kind: number; title: string; content: string }) => { setLoading(true); selected.forEach((item, index) => { @@ -64,7 +64,7 @@ export function AddFeedBlock() { // insert to database block.mutate({ - kind: 1, + kind: BLOCK_KINDS.feed, title: data.title, content: JSON.stringify(selected), }); @@ -205,7 +205,7 @@ export function AddFeedBlock() { {status === 'loading' ? (
Loading...
) : ( - JSON.parse(account.follows).map((follow) => ( + JSON.parse(account.follows as string).map((follow) => (+ No new posts about this hashtag in 48 hours ago +
+