Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
import treeSelect from '@automattic/tree-select';
import { find } from 'lodash';
import { getPostCommentItems } from 'calypso/state/comments/selectors/get-post-comment-items';
import 'calypso/state/comments/init';
/**
* Gets likes stats for the comment
* @param {Object} state redux state
* @param {number} siteId site identification
* @param {number} postId site identification
* @param {number} commentId comment identification
* @returns {Object} that has i_like and like_count props
*/
export const getCommentLike = treeSelect(
( state, siteId, postId ) => [ getPostCommentItems( state, siteId, postId ) ],
( [ comments ], siteId, postId, commentId ) => {
const comment = find( comments, { ID: commentId } );
if ( ! comment ) {
return undefined;
}
const { i_like, like_count } = comment;
return { i_like, like_count };
}
);