feat: improve profile card
This commit is contained in:
@@ -1,27 +1,17 @@
|
|||||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
|
|
||||||
import { useFetchProfile } from '@/hooks'
|
import { useFetchProfile } from '@/hooks'
|
||||||
import { generateImageByPubkey } from '@/lib/pubkey'
|
|
||||||
import { useMemo } from 'react'
|
|
||||||
import FollowButton from '../FollowButton'
|
import FollowButton from '../FollowButton'
|
||||||
import Nip05 from '../Nip05'
|
import Nip05 from '../Nip05'
|
||||||
import ProfileAbout from '../ProfileAbout'
|
import ProfileAbout from '../ProfileAbout'
|
||||||
|
import { SimpleUserAvatar } from '../UserAvatar'
|
||||||
|
|
||||||
export default function ProfileCard({ pubkey }: { pubkey: string }) {
|
export default function ProfileCard({ pubkey }: { pubkey: string }) {
|
||||||
const { profile } = useFetchProfile(pubkey)
|
const { profile } = useFetchProfile(pubkey)
|
||||||
const defaultImage = useMemo(() => generateImageByPubkey(pubkey), [pubkey])
|
const { username, nip05, about } = profile || {}
|
||||||
|
|
||||||
if (!profile) return null
|
|
||||||
const { avatar = '', username, nip05, about } = profile
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full flex flex-col gap-2">
|
<div className="w-full flex flex-col gap-2">
|
||||||
<div className="flex space-x-2 w-full items-start justify-between">
|
<div className="flex space-x-2 w-full items-start justify-between">
|
||||||
<Avatar className="w-12 h-12">
|
<SimpleUserAvatar userId={pubkey} className="w-12 h-12" />
|
||||||
<AvatarImage className="object-cover object-center" src={avatar} />
|
|
||||||
<AvatarFallback>
|
|
||||||
<img src={defaultImage} alt={pubkey} />
|
|
||||||
</AvatarFallback>
|
|
||||||
</Avatar>
|
|
||||||
<FollowButton pubkey={pubkey} />
|
<FollowButton pubkey={pubkey} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user