This commit is contained in:
Ren Amamiya
2023-06-22 10:45:45 +07:00
parent eaaf0e0e8a
commit 7b09dc3147
23 changed files with 285 additions and 124 deletions

View File

@@ -2,10 +2,17 @@ import { Image } from "@shared/image";
import { DEFAULT_AVATAR } from "@stores/constants";
import { useProfile } from "@utils/hooks/useProfile";
import { shortenKey } from "@utils/shortenKey";
import { nip19 } from "nostr-tools";
import { navigate } from "vite-plugin-ssr/client/router";
export function ChatSidebar({ pubkey }: { pubkey: string }) {
const { user } = useProfile(pubkey);
const viewProfile = () => {
const pubkey = nip19.decode(user.npub).data;
navigate(`/app/user?pubkey=${pubkey}`);
};
return (
<div className="px-3 py-2">
<div className="flex flex-col gap-3">
@@ -27,12 +34,13 @@ export function ChatSidebar({ pubkey }: { pubkey: string }) {
</div>
<div>
<p className="leading-tight">{user?.bio || user?.about}</p>
<a
href={`/app/user?npub=${user.npub}`}
<button
type="button"
onClick={() => viewProfile()}
className="mt-3 inline-flex w-full h-10 items-center justify-center rounded-md bg-zinc-900 hover:bg-zinc-800 text-sm text-zinc-300 hover:text-zinc-100 font-medium"
>
View full profile
</a>
</button>
</div>
</div>
</div>