This commit is contained in:
Ren Amamiya
2023-03-22 11:02:56 +07:00
parent ca87624727
commit b687bd9893
3 changed files with 12 additions and 7 deletions

View File

@@ -2,9 +2,11 @@ import { Content } from '@components/note/content';
import { RootNote } from '@components/note/root';
import destr from 'destr';
import { useRouter } from 'next/router';
import { memo, useMemo } from 'react';
export const Note = memo(function Note({ event }: { event: any }) {
const router = useRouter();
const tags = destr(event.tags);
const fetchRootEvent = useMemo(() => {
@@ -24,8 +26,15 @@ export const Note = memo(function Note({ event }: { event: any }) {
}
}, [tags]);
const openThread = () => {
router.push(`/newsfeed/${event.id}`);
};
return (
<div className="relative z-10 flex h-min min-h-min w-full cursor-pointer select-text flex-col border-b border-zinc-800 py-5 px-3 hover:bg-black/20">
<div
onClick={() => openThread()}
className="relative z-10 flex h-min min-h-min w-full cursor-pointer select-text flex-col border-b border-zinc-800 py-5 px-3 hover:bg-black/20"
>
<>{fetchRootEvent}</>
<Content data={event} />
</div>