/** * WordPress dependencies */ import { useSelect, useDispatch } from '@safe-wordpress/data'; import { useEffect, useState } from '@safe-wordpress/element'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import clsx from 'clsx'; import moment from 'moment'; import { AuthorIcon, DeleteButton } from '@nelio-content/components'; import { useAuthorName, store as NC_DATA } from '@nelio-content/data'; import { dateI18n, getSettings } from '@nelio-content/date'; import type { Uuid } from '@nelio-content/types'; /** * Internal dependencies */ import './style.scss'; import { store as NC_EDIT_POST } from '../../../store'; export type CommentProps = { readonly commentId: Uuid; }; export const Comment = ( { commentId }: CommentProps ): JSX.Element => { const comment = useComment( commentId ); const authorName = useAuthorName( comment?.authorId ); const isBeingDeleted = useSelect( ( select ) => select( NC_EDIT_POST ).isDeletingEditorialComment( commentId ), [ commentId ] ); const isBeingSynched = useSelect( ( select ) => select( NC_EDIT_POST ).isSynchingEditorialComment( commentId ), [ commentId ] ); const isCurrentUsers = useIsCurrentUsers( commentId ); const canBeDeleted = useCanBeDeleted( commentId ); const { deleteEditorialComment } = useDispatch( NC_EDIT_POST ); return (