no avatar title when profilecard is shown
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Martti Malmi 2023-11-29 14:36:24 +02:00
parent 51e68b1288
commit d84843a46d
2 changed files with 16 additions and 4 deletions

View File

@ -16,10 +16,21 @@ interface AvatarProps {
image?: string; image?: string;
imageOverlay?: ReactNode; imageOverlay?: ReactNode;
icons?: ReactNode; icons?: ReactNode;
showTitle?: boolean;
className?: string; className?: string;
} }
const Avatar = ({ pubkey, user, size, onClick, image, imageOverlay, icons, className }: AvatarProps) => { const Avatar = ({
pubkey,
user,
size,
onClick,
image,
imageOverlay,
icons,
className,
showTitle = true,
}: AvatarProps) => {
const [url, setUrl] = useState(""); const [url, setUrl] = useState("");
useEffect(() => { useEffect(() => {
@ -44,7 +55,7 @@ const Avatar = ({ pubkey, user, size, onClick, image, imageOverlay, icons, class
className, className,
)} )}
data-domain={domain?.toLowerCase()} data-domain={domain?.toLowerCase()}
title={getDisplayName(user, "")}> title={showTitle ? getDisplayName(user, "") : undefined}>
<ProxyImg <ProxyImg
className="rounded-full object-cover aspect-square" className="rounded-full object-cover aspect-square"
src={url} src={url}

View File

@ -47,7 +47,7 @@ export default function ProfileImage({
onClick, onClick,
showFollowDistance = true, showFollowDistance = true,
icons, icons,
showProfileCard, showProfileCard = true,
}: ProfileImageProps) { }: ProfileImageProps) {
const user = useUserProfile(profile ? "" : pubkey) ?? profile; const user = useUserProfile(profile ? "" : pubkey) ?? profile;
const nip05 = defaultNip ? defaultNip : user?.nip05; const nip05 = defaultNip ? defaultNip : user?.nip05;
@ -81,6 +81,7 @@ export default function ProfileImage({
user={user} user={user}
size={size} size={size}
imageOverlay={imageOverlay} imageOverlay={imageOverlay}
showTitle={!showProfileCard}
icons={ icons={
showFollowDistance || icons ? ( showFollowDistance || icons ? (
<> <>
@ -105,7 +106,7 @@ export default function ProfileImage({
} }
function profileCard() { function profileCard() {
if ((showProfileCard ?? true) && user && isHovering) { if (showProfileCard && user && isHovering) {
return ( return (
<div className="absolute shadow-lg z-10"> <div className="absolute shadow-lg z-10">
<ProfileCard pubkey={pubkey} user={user} show={true} /> <ProfileCard pubkey={pubkey} user={user} show={true} />