wip: migrate channel to zustand

This commit is contained in:
Ren Amamiya
2023-05-29 07:52:03 +07:00
parent ff6d494b49
commit 0492729e7e
11 changed files with 113 additions and 97 deletions

View File

@@ -1,21 +1,22 @@
import { Image } from "@shared/image";
import { DEFAULT_AVATAR } from "@stores/constants";
import { useProfile } from "@utils/hooks/useProfile";
export function User({ data }: { data: any }) {
const metadata = JSON.parse(data.metadata);
export function User({ pubkey }: { pubkey: string }) {
const { user } = useProfile(pubkey);
return (
<div className="flex items-center gap-2">
<div className="h-8 w-8 shrink-0 overflow-hidden rounded bg-zinc-900">
<Image
src={metadata?.picture || DEFAULT_AVATAR}
alt={data.pubkey}
src={user?.picture || DEFAULT_AVATAR}
alt={pubkey}
className="h-8 w-8 object-cover"
loading="auto"
/>
</div>
<h5 className="text-base font-semibold leading-none text-white">
{metadata?.display_name || metadata?.name || (
{user?.nip05 || user?.name || (
<div className="h-3 w-20 animate-pulse rounded-sm bg-zinc-700" />
)}
</h5>