import * as React from 'react'; import I18n from 'i18n-js'; import Separator from '../common/Separator'; import { MutedText } from '../common/CustomTexts'; import friendlyDate from '../../helpers/datetime'; import { ReplyFormState } from '../../reducers/replyFormReducer'; interface Props { id: number; createdAt: string; updatedAt: string; replyForm: ReplyFormState; isPowerUser: boolean; currentUserEmail: string; commentAuthorEmail: string; handleDeleteComment(id: number): void; handleToggleCommentReply(): void; toggleEditMode(): void; } const CommentFooter = ({ id, createdAt, updatedAt, replyForm, isPowerUser, currentUserEmail, commentAuthorEmail, handleDeleteComment, handleToggleCommentReply, toggleEditMode, }: Props) => (
{ replyForm.isOpen ? I18n.t('common.buttons.cancel') : I18n.t('post.comments.reply_button') } { isPowerUser || currentUserEmail === commentAuthorEmail ? <> {I18n.t('common.buttons.edit')} confirm(I18n.t('common.confirmation')) && handleDeleteComment(id)} className="commentLink"> {I18n.t('common.buttons.delete')} : null } {friendlyDate(createdAt)} { createdAt !== updatedAt ? <> { I18n.t('common.edited').toLowerCase() } : null }
); export default CommentFooter;