refactor note component

This commit is contained in:
Ren Amamiya
2023-05-02 16:09:32 +07:00
parent b66525d148
commit dfd1333db8
22 changed files with 92 additions and 119 deletions

View File

@@ -0,0 +1,16 @@
import { useProfile } from '@lume/utils/hooks/useProfile';
import { shortenKey } from '@lume/utils/shortenKey';
export const NoteMentionUser = ({ pubkey }: { pubkey: string }) => {
const { user, isError, isLoading } = useProfile(pubkey);
return (
<>
{isError || isLoading ? (
<span className="inline-flex h-4 w-10 animate-pulse rounded bg-zinc-800"></span>
) : (
<span className="cursor-pointer text-fuchsia-500">@{user?.username || user?.name || shortenKey(pubkey)}</span>
)}
</>
);
};