diff --git a/src/app/space/components/blocks/profile.tsx b/src/app/space/components/blocks/profile.tsx new file mode 100644 index 00000000..4ec091ad --- /dev/null +++ b/src/app/space/components/blocks/profile.tsx @@ -0,0 +1,107 @@ +import { ArrowLeftIcon } from "@shared/icons"; +import { Image } from "@shared/image"; +import { useActiveAccount } from "@stores/accounts"; +import { DEFAULT_AVATAR } from "@stores/constants"; +import { useProfile } from "@utils/hooks/useProfile"; +import { compactNumber } from "@utils/number"; +import { shortenKey } from "@utils/shortenKey"; +import useSWR from "swr"; + +const fetcher = (url: string) => fetch(url).then((r) => r.json()); + +export function ProfileBlock({ params }: { params: any }) { + const removeBlock = useActiveAccount((state: any) => state.removeBlock); + + const close = () => { + removeBlock(params.id, true); + }; + + const { user } = useProfile(params.pubkey); + const { data: userStats } = useSWR( + user ? `https://api.nostr.band/v0/stats/profile/${params.pubkey}` : null, + fetcher, + ); + + return ( +
+ {user?.bio || user.about} +
+Loading...
+ ) : ( +{pubkey}
-+
{user?.about}