/** * @author Tanya Vykliuk */ import React from 'react'; import { bindActionCreators, Dispatch } from 'redux'; import { connect } from 'react-redux'; import Card from '@material-ui/core/Card'; import CardMedia from '@material-ui/core/CardMedia'; import Typography from '@material-ui/core/Typography'; import CardContent from '@material-ui/core/CardContent'; import Button from '@material-ui/core/Button'; import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos'; import { useTranslation } from 'react-i18next'; import MoreHorizIcon from '@material-ui/icons/MoreHoriz'; // import TwitterIcon from '@material-ui/icons/Twitter'; // import InstagramIcon from '@material-ui/icons/Instagram'; // import TitleIcon from '@material-ui/icons/Title'; // import SimpleModal from '../SimpleModal'; // @ts-ignore import styles from './CreatorCard.module.scss'; import { selectCreatorsState } from '../../reducers/creator/selector'; import { getCreator} from '../../reducers/creator/service'; import { updateCreatorPageState, updateCreatorFormState } from '../../reducers/popupsState/service'; import { selectPopupsState } from '../../reducers/popupsState/selector'; const mapStateToProps = (state: any): any => { return { creatorState: selectCreatorsState(state), popupsState: selectPopupsState(state), }; }; const mapDispatchToProps = (dispatch: Dispatch): any => ({ getCreator: bindActionCreators(getCreator, dispatch), updateCreatorPageState: bindActionCreators(updateCreatorPageState, dispatch), updateCreatorFormState: bindActionCreators(updateCreatorFormState, dispatch), // followCreator: bindActionCreators(followCreator, dispatch), // unFollowCreator: bindActionCreators(unFollowCreator, dispatch), // getFollowersList: bindActionCreators(getFollowersList, dispatch), // getFollowingList: bindActionCreators(getFollowingList, dispatch), }); interface Props{ creator: any; creatorState?: any; popupsState?: any; getCreator?: typeof getCreator; updateCreatorPageState?: typeof updateCreatorPageState, updateCreatorFormState?: typeof updateCreatorFormState, // followCreator?: typeof followCreator; // unFollowCreator?: typeof unFollowCreator; // getFollowersList?:typeof getFollowersList; // getFollowingList?:typeof getFollowingList; } const CreatorCard = ({creator,creatorState, updateCreatorPageState, popupsState, updateCreatorFormState}:Props) => { const isMe = creator?.id === creatorState?.get('currentCreator').id; const { t } = useTranslation(); // const [openFiredModal, setOpenFiredModal] = useState(false); // const [creatorsType, setCreatorsType] = useState('followers'); // const [anchorEl, setAnchorEl] = useState(null); // const handleClick = (event) => { // setAnchorEl(event.currentTarget); // }; // const handleClose = () => { // setAnchorEl(null); // }; // const handleEditClick = () =>{ // // handleClose(); // // history.push('/creatorEdit'); // }; // const handleFollowCreator = creatorId => followCreator(creatorId); // const handleUnFollowCreator = creatorId => unFollowCreator(creatorId); // const handleFollowersByCreator = creatorId => { // getFollowersList(creatorId); // setOpenFiredModal(true); // setCreatorsType('followers'); // }; // const handleFollowingByCreator = creatorId => { // getFollowingList(creatorId); // setOpenFiredModal(true); // setCreatorsType('following'); // }; // const renderSocials = () => <> // {creator.twitter && {creator.twitter}} // {creator.instagram && {creator.instagram}} // {creator.tiktok && {creator.tiktok}} // {creator.snap && {creator.snap}} // ; const renderEditButton = () => ; return creator ? ( <>
{isMe && renderEditButton()}
{/*hided for now*/} {/*
*/} {creator.name} {creator.username} {creator.tags} {creator.bio} {/* {!isMe && creator.followed === false && } {!isMe && creator.followed === true && } */} {/*hided for now*/} {/* {renderSocials()} */}
) : <>; }; export default connect(mapStateToProps, mapDispatchToProps)(CreatorCard);