add user page

This commit is contained in:
Ren Amamiya
2023-06-28 17:23:36 +07:00
parent 3fe601cfc6
commit ec1ff9ab87
27 changed files with 492 additions and 491 deletions

View File

@@ -0,0 +1,20 @@
import { getNotesByPubkey } from "@libs/storage";
import { Note } from "@shared/notes/note";
import { useQuery } from "@tanstack/react-query";
import { LumeEvent } from "@utils/types";
export function UserFeed({ pubkey }: { pubkey: string }) {
const { status, data } = useQuery(["user-feed", pubkey], async () => {
return await getNotesByPubkey(pubkey);
});
return (
<div className="w-full max-w-[400px] px-2">
{status === "loading" ? (
<p>Loading...</p>
) : (
data.map((note: LumeEvent) => <Note key={note.event_id} event={note} />)
)}
</div>
);
}