Preferences page

This commit is contained in:
2023-08-21 14:58:57 +01:00
parent 35423cc91b
commit 976f841d0b
45 changed files with 484 additions and 467 deletions

View File

@ -11,19 +11,21 @@ interface AvatarProps {
user?: UserMetadata;
onClick?: () => void;
size?: number;
image?: string;
}
const Avatar = ({ user, size, onClick }: AvatarProps) => {
const Avatar = ({ user, size, onClick, image }: AvatarProps) => {
const [url, setUrl] = useState<string>(Nostrich);
const { proxy } = useImgProxy();
useEffect(() => {
if (user?.picture) {
const url = proxy(user.picture, size ?? 120);
setUrl(url);
const url = image ?? user?.picture;
if (url) {
const proxyUrl = proxy(url, size ?? 120);
setUrl(proxyUrl);
} else {
setUrl(Nostrich);
}
}, [user]);
}, [user, image]);
const backgroundImage = `url(${url})`;
const style = { "--img-url": backgroundImage } as CSSProperties;