|
|
|
@ -6,6 +6,7 @@ import { Comment } from 'semantic-ui-react';
|
|
|
|
import { usePopup } from '../../../lib/popup';
|
|
|
|
import { usePopup } from '../../../lib/popup';
|
|
|
|
import { Markdown } from '../../../lib/custom-ui';
|
|
|
|
import { Markdown } from '../../../lib/custom-ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import getDateFormat from '../../../utils/get-date-format';
|
|
|
|
import CommentEdit from './CommentEdit';
|
|
|
|
import CommentEdit from './CommentEdit';
|
|
|
|
import User from '../../User';
|
|
|
|
import User from '../../User';
|
|
|
|
import DeleteStep from '../../DeleteStep';
|
|
|
|
import DeleteStep from '../../DeleteStep';
|
|
|
|
@ -16,10 +17,6 @@ const ItemComment = React.memo(
|
|
|
|
({ data, createdAt, isPersisted, user, canEdit, onUpdate, onDelete }) => {
|
|
|
|
({ data, createdAt, isPersisted, user, canEdit, onUpdate, onDelete }) => {
|
|
|
|
const [t] = useTranslation();
|
|
|
|
const [t] = useTranslation();
|
|
|
|
|
|
|
|
|
|
|
|
const thisYear = new Date().getFullYear();
|
|
|
|
|
|
|
|
const targetYear = createdAt.getFullYear();
|
|
|
|
|
|
|
|
const dateFormat = (targetYear == thisYear) ? "longDateTime" : "fullDateTime";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const commentEdit = useRef(null);
|
|
|
|
const commentEdit = useRef(null);
|
|
|
|
|
|
|
|
|
|
|
|
const handleEditClick = useCallback(() => {
|
|
|
|
const handleEditClick = useCallback(() => {
|
|
|
|
@ -37,7 +34,7 @@ const ItemComment = React.memo(
|
|
|
|
<div className={styles.title}>
|
|
|
|
<div className={styles.title}>
|
|
|
|
<span className={styles.author}>{user.name}</span>
|
|
|
|
<span className={styles.author}>{user.name}</span>
|
|
|
|
<span className={styles.date}>
|
|
|
|
<span className={styles.date}>
|
|
|
|
{t(`format:${dateFormat}`, {
|
|
|
|
{t(`format:${getDateFormat(createdAt)}`, {
|
|
|
|
postProcess: 'formatDate',
|
|
|
|
postProcess: 'formatDate',
|
|
|
|
value: createdAt,
|
|
|
|
value: createdAt,
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
|