From be8b40c86dedbb9174072b9ed4752cb69d155669 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sat, 29 Apr 2023 09:25:33 +0700 Subject: [PATCH] minor fixes --- src/app/channel/components/blacklist.tsx | 2 +- src/app/channel/components/createModal.tsx | 8 +- src/app/channel/components/updateModal.tsx | 21 +++-- src/app/channel/pages/index.page.tsx | 4 +- src/app/chat/pages/index.page.tsx | 2 +- src/app/newsfeed/components/contentParser.tsx | 4 +- src/shared/preview/video.tsx | 7 +- src/shared/preview/youtube.tsx | 7 +- src/utils/hooks/useChannelProfile.tsx | 77 +++++++++---------- src/utils/parser.tsx | 4 +- 10 files changed, 70 insertions(+), 66 deletions(-) diff --git a/src/app/channel/components/blacklist.tsx b/src/app/channel/components/blacklist.tsx index 7b2c755e..4911aa4f 100644 --- a/src/app/channel/components/blacklist.tsx +++ b/src/app/channel/components/blacklist.tsx @@ -10,7 +10,7 @@ export default function ChannelBlackList({ blacklist }: { blacklist: any }) { {({ open }) => ( <> diff --git a/src/app/channel/components/createModal.tsx b/src/app/channel/components/createModal.tsx index 3c0da232..f551fba4 100644 --- a/src/app/channel/components/createModal.tsx +++ b/src/app/channel/components/createModal.tsx @@ -10,10 +10,12 @@ import { RelayPool } from 'nostr-relaypool'; import { getEventHash, signEvent } from 'nostr-tools'; import { Fragment, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; +import { useSWRConfig } from 'swr'; import { navigate } from 'vite-plugin-ssr/client/router'; export default function ChannelCreateModal() { const { account, isError, isLoading } = useActiveAccount(); + const { mutate } = useSWRConfig(); const [isOpen, setIsOpen] = useState(false); const [image, setImage] = useState(DEFAULT_AVATAR); @@ -54,13 +56,15 @@ export default function ChannelCreateModal() { pool.publish(event, WRITEONLY_RELAYS); // insert to database createChannel(event.id, event.pubkey, event.content, event.created_at); + // update channe llist + mutate('channels'); // reset form reset(); setTimeout(() => { // close modal setIsOpen(false); // redirect to channel page - navigate(`/channel?id=${event.id}`); + navigate(`/app/channel?id=${event.id}`); }, 2000); } else { console.log('error'); @@ -204,7 +208,7 @@ export default function ChannelCreateModal() {