import { Avatar, Col, Row } from 'antd' import { ConstructorModal } from '../helpers' import { ResultUserFind } from '../components/Search_Users' import { Router, Route, Link, Redirect, Switch } from 'react-router-dom' import user from '../materials/user.png' import { HeartOutlined, HeartFilled } from '@ant-design/icons' import React, { useMemo, useState, useEffect } from 'react' export const Likes = ({ likes }) => { return ( <>
{likes && likes?.map(({ owner: { _id, login, avatar } }) => (

{login || 'Anon'}

))}
) } export const Like = ({ my_Id, postId, addLike, deleteLike, likes = [], children, }) => { const likeId = likes.find((like) => like?.owner?._id === my_Id)?._id const changeLike = () => likeId ? deleteLike(likeId, postId) : addLike(postId) // console.log('likeId', likeId) const [isModalVisible, setIsModalVisible] = useState(false) const showModal = () => { setIsModalVisible(true) } return ( <>

{likeId ? ( ) : ( )}

{likes.length ? (

{' '} {likes.length} likes

) : (

{' '} 0 likes

)}
) }