diff --git a/src/entities/card-friends/ui/card-friends.tsx b/src/entities/card-friends/ui/card-friends.tsx index 5b665d0e..bc81a183 100644 --- a/src/entities/card-friends/ui/card-friends.tsx +++ b/src/entities/card-friends/ui/card-friends.tsx @@ -31,6 +31,7 @@ const CardFriends: FC = ({ const avatar = ( = ({ className, img, name, date, link }) => { - return ( - -
- -
-

- {name} - оценил вашу - - фотографию - -

- {date} -
- {link && } -
-
- ) -} - -export { CardLiked } diff --git a/src/entities/card-message/ui/card-message.tsx b/src/entities/card-message/ui/card-message.tsx index c60f6b9e..bfab0b6d 100644 --- a/src/entities/card-message/ui/card-message.tsx +++ b/src/entities/card-message/ui/card-message.tsx @@ -35,6 +35,7 @@ const CardMessage: FC = ({ )} > diff --git a/src/entities/card-notification/ui/card-notification.tsx b/src/entities/card-notification/ui/card-notification.tsx index 4b75f281..5b96cad7 100644 --- a/src/entities/card-notification/ui/card-notification.tsx +++ b/src/entities/card-notification/ui/card-notification.tsx @@ -24,6 +24,7 @@ const CardNotification: FC = ({ className, date, id, typ
= ({ }`} >
+ {/* @ts-expect-error Аватары берутся локально, userId не нужен */}

{firstName}
({telegram}) diff --git a/src/entities/message/ui/message.tsx b/src/entities/message/ui/message.tsx index 43cc5a4f..3584dad3 100644 --- a/src/entities/message/ui/message.tsx +++ b/src/entities/message/ui/message.tsx @@ -23,7 +23,7 @@ const Message: FC = ({ text, senderId, date }) => { }`} >
- + {parseDateToTime(date)}
= ({ post, buttonLike, buttonDelete }) => { className='w-[50px] h-[50px] mr-[15px]' src={post?.createdBy?.avatar || null} link={post?.createdBy?.id} + userId={post?.createdById} />
| undefined + friends: IRowFriend[] | undefined } -const RowFriends: FC = ({ avatars }) => { +const RowFriends: FC = ({ friends }) => { const { theme } = useTheme() const isMobile = useWindowSize(500) @@ -26,17 +29,18 @@ const RowFriends: FC = ({ avatars }) => { 'mr-[-20px] z-[5]' ] - const renderImg = (avatars: Array): JSX.Element[] => { - return avatars.map((avatar, i) => { + const renderImg = (friends: IRowFriend[]): JSX.Element[] => { + return friends.map((friend, i) => { return ( 0 && imgClasses[i] + friends.length > 0 && imgClasses[i] )} - src={avatar || avatarLight} - isImgNotOnBackend={!avatar} + src={friend.avatar} + isImgNotOnBackend={!friend.avatar} /> ) }) @@ -44,12 +48,12 @@ const RowFriends: FC = ({ avatars }) => { return (
- {avatars?.length ? `${avatars.length} друзей` : 'Пока нет друзей'} + {friends?.length ? `${friends.length} друзей` : 'Пока нет друзей'}
- {avatars?.length ? ( + {friends?.length ? ( renderImg( - avatars.slice(0, avatars.length > maxCount ? maxCount : avatars.length) + friends.slice(0, friends.length > maxCount ? maxCount : friends.length) ) ) : (
diff --git a/src/features/input-create-post/ui/input-create-post.tsx b/src/features/input-create-post/ui/input-create-post.tsx index 6bd243bb..dcdc45a9 100644 --- a/src/features/input-create-post/ui/input-create-post.tsx +++ b/src/features/input-create-post/ui/input-create-post.tsx @@ -18,7 +18,7 @@ const InputCreatePost: FC = ({ className }) => { } return ( { : allUsers.find((item) => item.id === currentUser?.id)?.friends // Поиск айди в массиве всех пользователей - const friends: IAllUser[] | undefined = currentUserFriends + const friends: IAllUser[] = currentUserFriends ? currentUserFriends .map((friendId) => allUsers?.find((item) => item.id === friendId)) .filter((item) => item !== undefined) diff --git a/src/shared/ui/input-send-message.tsx b/src/shared/ui/input-send-message.tsx index a0b813b2..9f91bbd9 100644 --- a/src/shared/ui/input-send-message.tsx +++ b/src/shared/ui/input-send-message.tsx @@ -10,7 +10,7 @@ import clip from '@assets/ui/clip.svg' import send from '@assets/ui/send.svg' interface IInputSendMessageProps extends IInputProps { - avatar?: string | null + user?: { avatar: string | null | undefined; userId: string | undefined } withPicture: boolean sendMessage: (message: string, pictures?: FileList) => Promise } @@ -19,7 +19,7 @@ interface IInputSendMessageProps extends IInputProps { const InputSendMessage: FC = ({ withPicture = false, - avatar, + user, className, sendMessage, ...props @@ -27,7 +27,7 @@ const InputSendMessage: FC = ({ const [message, setMessage] = useState('') const [previewUrls, setPreviewUrls] = useState([]) - const withAvatar = avatar !== undefined + const withAvatar = user !== undefined const handleInputFiles = (e: ChangeEvent): void => { const files = e.target.files as FileList @@ -77,7 +77,8 @@ const InputSendMessage: FC = ({
{withAvatar && ( )} diff --git a/src/shared/ui/user-avatar.tsx b/src/shared/ui/user-avatar.tsx index 7b8476d5..323e279b 100644 --- a/src/shared/ui/user-avatar.tsx +++ b/src/shared/ui/user-avatar.tsx @@ -59,19 +59,21 @@ const AvatarFallback = forwardRef< AvatarFallback.displayName = Fallback.displayName interface IUserAvatarProps { - src: string | null + src: string | null | undefined isImgNotOnBackend?: boolean className?: string link?: string + userId: string | undefined } const UserAvatar: FC = ({ src, className, isImgNotOnBackend, - link + link, + userId }) => { - const img = isImgNotOnBackend ? src : URL_AVATARS + src + const img = isImgNotOnBackend ? src : `${URL_AVATARS}${userId}/${src}` if (link) { return ( diff --git a/src/widgets/block-profile-mobile/ui/block-profile-mobile.tsx b/src/widgets/block-profile-mobile/ui/block-profile-mobile.tsx index 5741c552..bc75b157 100644 --- a/src/widgets/block-profile-mobile/ui/block-profile-mobile.tsx +++ b/src/widgets/block-profile-mobile/ui/block-profile-mobile.tsx @@ -23,6 +23,7 @@ const BlockProfileMobile: FC = ({
@@ -49,7 +50,12 @@ const BlockProfileMobile: FC = ({
)}
- friend?.avatar)} /> + ({ + avatar: friend?.avatar, + userId: friend.id + }))} + /> {isMyProfile ? ( ) : ( diff --git a/src/widgets/block-profile/ui/block-profile.tsx b/src/widgets/block-profile/ui/block-profile.tsx index 785a5668..349d056f 100644 --- a/src/widgets/block-profile/ui/block-profile.tsx +++ b/src/widgets/block-profile/ui/block-profile.tsx @@ -16,13 +16,22 @@ const BlockProfile: FC = ({ user, isMyProfile, friends }) => return (
- +

{user?.firstName} {user?.lastName}

{user?.description &&
{user?.description}
} {/* */} - friend?.avatar)} /> + ({ + avatar: friend?.avatar, + userId: friend.id + }))} + /> {isMyProfile ? ( ) : ( diff --git a/src/widgets/chat/ui/chat.tsx b/src/widgets/chat/ui/chat.tsx index e4b0d7f9..d2748964 100644 --- a/src/widgets/chat/ui/chat.tsx +++ b/src/widgets/chat/ui/chat.tsx @@ -129,7 +129,7 @@ const Chat: FC = () => { >{`${friend?.firstName} ${friend?.lastName}`}
- +
{ className='h-[100%] w-[100%]' src={avatarImg || null} isImgNotOnBackend + userId={user?.id} /> { }, [previewUrl, user?.banner]) return (
- +