added note metadta component
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
import { Content } from '@components/note/content';
|
||||
import { RootNote } from '@components/note/root';
|
||||
|
||||
import { useRouter } from 'next/router';
|
||||
import { memo, useEffect, useState } from 'react';
|
||||
|
||||
export const Note = memo(function Note({ event }: { event: any }) {
|
||||
const router = useRouter();
|
||||
|
||||
const [root, setRoot] = useState(null);
|
||||
const tags = JSON.parse(event.tags);
|
||||
|
||||
const openThread = () => {
|
||||
router.push({
|
||||
pathname: '/newsfeed/thread',
|
||||
query: { id: root ? root : event.id },
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (tags.length > 0) {
|
||||
if (tags[0][0] === 'e') {
|
||||
@@ -16,7 +26,10 @@ export const Note = memo(function Note({ event }: { event: any }) {
|
||||
}, [tags]);
|
||||
|
||||
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">
|
||||
<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"
|
||||
>
|
||||
{root && (
|
||||
<>
|
||||
<RootNote id={root} />
|
||||
|
||||
Reference in New Issue
Block a user