Show title on avatar

This commit is contained in:
Kieran 2023-08-19 22:59:49 +01:00
parent fe9cc3495a
commit 0cb56870a4
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -5,6 +5,7 @@ import { CSSProperties, useEffect, useState } from "react";
import type { UserMetadata } from "@snort/system";
import useImgProxy from "Hooks/useImgProxy";
import { getDisplayName } from "Element/ProfileImage";
interface AvatarProps {
user?: UserMetadata;
@ -27,7 +28,14 @@ const Avatar = ({ user, size, onClick }: AvatarProps) => {
const backgroundImage = `url(${url})`;
const style = { "--img-url": backgroundImage } as CSSProperties;
const domain = user?.nip05 && user.nip05.split("@")[1];
return <div onClick={onClick} style={style} className="avatar" data-domain={domain?.toLowerCase()}></div>;
return (
<div
onClick={onClick}
style={style}
className="avatar"
data-domain={domain?.toLowerCase()}
title={getDisplayName(user, "")}></div>
);
};
export default Avatar;