add hashtag block

This commit is contained in:
Ren Amamiya
2023-07-17 08:54:17 +07:00
parent 4f41022b30
commit b3b790588a
15 changed files with 203 additions and 59 deletions
+5 -5
View File
@@ -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' ? (
<p>Loading...</p>
) : (
JSON.parse(account.follows).map((follow) => (
JSON.parse(account.follows as string).map((follow) => (
<Combobox.Option
key={follow}
value={follow}