import React from 'react' ; import { useSelector } from 'react-redux' ; import { getUserInfo } from '@app/redux/reducers/user' ; import './styles/index.scss' ; interface Props { reply ? : any ; comment ? : any ; posts ? : any ; } export default function ( { reply , comment , posts } ) { const target = comment || reply || posts ; const _isMember = useSelector ( ( state ) => getUserInfo ( state ) ) ; const onClick = ( e ) => { e . stopPropagation ( ) ; if ( ! _isMember ) { $ ( '#sign' ) . modal ( { show : true } , { } ) ; return ; } let type = 'reply' ; if ( posts ) type = 'comment' ; $ ( '#editor-comment-modal' ) . modal ( { show : true } , { type , comment : comment || reply || null , posts } ) ; } ; const toSign = ( e ) => { $ ( '#sign' ) . modal ( 'show' ) ; e . stopPropagation ( ) ; } ; let t = posts ? '评论' : '回复' ; return ( < span className = 'a text-secondary' onClick = { _isMember ? onClick : toSign } > { t } < /span>); }