import React, {useEffect} from "react";
import { connect } from "react-redux";
import { backURL } from "../constants";
function getUrl(obj) {
if (obj.avatar?.url) {
return backURL + obj.avatar?.url;
} else {
return false;
}
}
export const UserAvatar = ({ profile, text = "", className = "small" }) => {
useEffect(() => {}, [getUrl(profile)])
return (
<>
{console.log(getUrl(profile), "gjfsghfklsglk")}
{text}
>
);
};
export const CMyAvatar = connect((state) => ({
profile: state.promise.myProfile?.payload || {},
}))(UserAvatar);
export const ChatAvatar = ({ userChat, text = "", className = "small", _id }) => {
return (
<>
{userChat[_id]?.avatar?.url ?
:
}
{text}
>
)
}
export const CChatAvatar = connect((state) => ({
userChat: state.chats || {},
}))(ChatAvatar);
const SearchAvatar = ({findUser, avatarUrl}) => {
return(
)
}
export const CSearchAvatar = connect((state) => ({findUser: state?.promise?.findUser?.payload}))(
SearchAvatar
)