From 7f1dd1514fb825750166402663dc8a23c65d9c53 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sun, 14 May 2023 15:25:56 +0700 Subject: [PATCH] add user popover --- src/app/channel/pages/index.page.tsx | 2 +- src/app/chat/pages/index.page.tsx | 2 +- src/app/note/components/user/default.tsx | 65 ++++++++++++++++++++++-- src/app/note/components/user/repost.tsx | 64 +++++++++++++++++++++-- 4 files changed, 122 insertions(+), 11 deletions(-) diff --git a/src/app/channel/pages/index.page.tsx b/src/app/channel/pages/index.page.tsx index 312ac888..33028d3d 100644 --- a/src/app/channel/pages/index.page.tsx +++ b/src/app/channel/pages/index.page.tsx @@ -53,7 +53,7 @@ export function Page() { const now = useRef(new Date()); - useSWRSubscription(channelID && muted && hided ? ['channel', channelID] : null, ([, key], {}: any) => { + useSWRSubscription(account && channelID && muted && hided ? ['channel', channelID] : null, ([, key], {}: any) => { // subscribe to channel const unsubscribe = pool.subscribe( [ diff --git a/src/app/chat/pages/index.page.tsx b/src/app/chat/pages/index.page.tsx index 0455d830..6aa20758 100644 --- a/src/app/chat/pages/index.page.tsx +++ b/src/app/chat/pages/index.page.tsx @@ -27,7 +27,7 @@ export function Page() { const setChatMessages = useSetAtom(chatMessagesAtom); const resetChatMessages = useResetAtom(chatMessagesAtom); - useSWRSubscription(pubkey ? ['chat', pubkey] : null, ([, key], {}: any) => { + useSWRSubscription(account ? ['chat', pubkey] : null, ([, key], {}: any) => { const unsubscribe = pool.subscribe( [ { diff --git a/src/app/note/components/user/default.tsx b/src/app/note/components/user/default.tsx index f5a8230b..91b9eb1a 100644 --- a/src/app/note/components/user/default.tsx +++ b/src/app/note/components/user/default.tsx @@ -5,8 +5,10 @@ import { DEFAULT_AVATAR, IMGPROXY_URL } from '@stores/constants'; import { useProfile } from '@utils/hooks/useProfile'; import { shortenKey } from '@utils/shortenKey'; +import { Popover, Transition } from '@headlessui/react'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; +import { Fragment } from 'react'; dayjs.extend(relativeTime); @@ -14,17 +16,17 @@ export function NoteDefaultUser({ pubkey, time }: { pubkey: string; time: number const { user } = useProfile(pubkey); return ( -
{user?.about}
+{user?.about}
+