updated thread component

This commit is contained in:
Ren Amamiya
2023-02-21 16:09:00 +07:00
parent 6f9f55a229
commit 0b28bf4ee8
3 changed files with 69 additions and 3 deletions

View File

@@ -1,12 +1,20 @@
import BaseLayout from '@layouts/baseLayout';
import UserLayout from '@layouts/userLayout';
import { Placeholder } from '@components/note/placeholder';
import { Thread } from '@components/thread';
import { hoursAgo } from '@utils/getDate';
import { dateToUnix, useNostrEvents } from 'nostr-react';
import { JSXElementConstructor, ReactElement, ReactFragment, ReactPortal, useRef } from 'react';
import {
JSXElementConstructor,
ReactElement,
ReactFragment,
ReactPortal,
Suspense,
useRef,
} from 'react';
export default function Page() {
const now = useRef(new Date());
@@ -15,12 +23,15 @@ export default function Page() {
filter: {
since: dateToUnix(hoursAgo(1, now.current)),
kinds: [1],
limit: 100,
},
});
return (
<div className="h-full w-full overflow-hidden rounded-lg border border-zinc-700 bg-zinc-900 shadow-input">
<Thread data={events} />
<div className="h-full w-full">
<Suspense fallback={<Placeholder />}>
<Thread data={events} />
</Suspense>
</div>
);
}