/** * @author Tanya Vykliuk */ import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; import CardMedia from '@material-ui/core/CardMedia'; import Typography from '@material-ui/core/Typography'; import VerifiedUserIcon from '@material-ui/icons/VerifiedUser'; import PersonPinIcon from '@material-ui/icons/PersonPin'; import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators, Dispatch } from 'redux'; import { selectCreatorsState } from '../../reducers/creator/selector'; import { getCreators } from '../../reducers/creator/service'; // @ts-ignore import styles from './Creators.module.scss'; import { selectPopupsState } from '../../reducers/popupsState/selector'; import { updateCreatorPageState } from '../../reducers/popupsState/service'; const mapStateToProps = (state: any): any => { return { creatorsState: selectCreatorsState(state), popupsState: selectPopupsState(state), }; }; const mapDispatchToProps = (dispatch: Dispatch): any => ({ getCreators: bindActionCreators(getCreators, dispatch), updateCreatorPageState: bindActionCreators(updateCreatorPageState, dispatch), }); interface Props{ creatorsState?: any, popupsState?: any, getCreators?: any, updateCreatorPageState?: typeof updateCreatorPageState, } const Creators = ({creatorsState, getCreators, popupsState, updateCreatorPageState}:Props) => { useEffect(()=> getCreators(), []); const creators= creatorsState && creatorsState.get('creators') ? creatorsState.get('creators') : null; const handleCreatorView = (id) =>{ updateCreatorPageState(false); updateCreatorPageState(true, id); }; return
{creators?.map((item, itemIndex)=> handleCreatorView(item.id)}> } title={item.name} /> {item.name} {item.verified === 1 && }

{item.username}

)}
; }; export default connect(mapStateToProps, mapDispatchToProps)(Creators);