refactor newsfeed and note

This commit is contained in:
Ren Amamiya
2023-03-25 15:26:32 +07:00
parent f1965e1b43
commit f1647fd857
23 changed files with 530 additions and 444 deletions
+3 -13
View File
@@ -1,8 +1,7 @@
import BaseLayout from '@layouts/base';
import WithSidebarLayout from '@layouts/withSidebar';
import { Content } from '@components/note/content';
import { ContentExtend } from '@components/note/content/extend';
import { NoteExtend } from '@components/note/extend';
import FormComment from '@components/note/form/comment';
import { RelayContext } from '@components/relaysProvider';
@@ -11,7 +10,6 @@ import { relaysAtom } from '@stores/relays';
import { getNoteByID } from '@utils/storage';
import { useAtomValue } from 'jotai';
import { GetStaticPaths } from 'next';
import { useRouter } from 'next/router';
import {
JSXElementConstructor,
@@ -65,21 +63,13 @@ export default function Page() {
return (
<div className="scrollbar-hide flex h-full flex-col gap-2 overflow-y-auto py-5">
<div className="flex h-min min-h-min w-full select-text flex-col px-3">
{rootEvent && <ContentExtend data={rootEvent} />}
{rootEvent && <NoteExtend event={rootEvent} />}
</div>
<div>
<FormComment eventID={id} />
</div>
<div className="flex flex-col">
{comments.length > 0 &&
comments.map((comment) => (
<div
key={comment.id}
className="flex h-min min-h-min w-full select-text flex-col border-b border-zinc-800 px-3 py-5 hover:bg-black/20"
>
<Content data={comment} />
</div>
))}
{comments.length > 0 && comments.map((comment) => <p key={comment.id}>{comment.content}</p>)}
</div>
</div>
);