1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-30 15:16:41 +07:00

feature: added image preview for comments

This commit is contained in:
Fedor Katurov 2020-06-05 17:42:02 +07:00
parent 08f6b518e4
commit 7d3132237d
5 changed files with 80 additions and 63 deletions
src/components/node/NodeComments

View file

@ -11,6 +11,7 @@ import { nodeLockComment, nodeEditComment, nodeLoadMoreComments } from '~/redux/
import { INodeState } from '~/redux/node/reducer';
import { COMMENTS_DISPLAY } from '~/redux/node/constants';
import { plural } from '~/utils/dom';
import * as MODAL_ACTIONS from '~/redux/modal/actions';
interface IProps {
comments?: IComment[];
@ -21,6 +22,7 @@ interface IProps {
onEdit: typeof nodeEditComment;
onLoadMore: typeof nodeLoadMoreComments;
order?: 'ASC' | 'DESC';
modalShowPhotoswipe: typeof MODAL_ACTIONS.modalShowPhotoswipe;
}
const NodeComments: FC<IProps> = memo(
@ -33,6 +35,7 @@ const NodeComments: FC<IProps> = memo(
onLoadMore,
comment_count = 0,
order = 'DESC',
modalShowPhotoswipe,
}) => {
const comments_left = useMemo(() => Math.max(0, comment_count - comments.length), [
comments,
@ -73,6 +76,7 @@ const NodeComments: FC<IProps> = memo(
can_edit={canEditComment(group, user)}
onDelete={onDelete}
onEdit={onEdit}
modalShowPhotoswipe={modalShowPhotoswipe}
/>
))}