|
@@ -3,11 +3,13 @@ import React from 'react';
|
|
|
import { isPopulated } from '@growi/core';
|
|
import { isPopulated } from '@growi/core';
|
|
|
import { UserPicture } from '@growi/ui/dist/components';
|
|
import { UserPicture } from '@growi/ui/dist/components';
|
|
|
import { format } from 'date-fns';
|
|
import { format } from 'date-fns';
|
|
|
|
|
+import { t } from 'i18next';
|
|
|
|
|
+import { useTranslation } from 'next-i18next';
|
|
|
import {
|
|
import {
|
|
|
Button, Modal, ModalHeader, ModalBody, ModalFooter,
|
|
Button, Modal, ModalHeader, ModalBody, ModalFooter,
|
|
|
} from 'reactstrap';
|
|
} from 'reactstrap';
|
|
|
|
|
|
|
|
-import { ICommentHasId } from '../../interfaces/comment';
|
|
|
|
|
|
|
+import type { ICommentHasId } from '../../interfaces/comment';
|
|
|
import { Username } from '../User/Username';
|
|
import { Username } from '../User/Username';
|
|
|
|
|
|
|
|
import styles from './DeleteCommentModal.module.scss';
|
|
import styles from './DeleteCommentModal.module.scss';
|
|
@@ -26,6 +28,8 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
|
|
|
isShown, comment, errorMessage, cancelToDelete, confirmToDelete,
|
|
isShown, comment, errorMessage, cancelToDelete, confirmToDelete,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
+ const { t } = useTranslation();
|
|
|
|
|
+
|
|
|
const headerContent = () => {
|
|
const headerContent = () => {
|
|
|
if (comment == null || isShown === false) {
|
|
if (comment == null || isShown === false) {
|
|
|
return <></>;
|
|
return <></>;
|
|
@@ -33,7 +37,7 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
|
|
|
return (
|
|
return (
|
|
|
<span>
|
|
<span>
|
|
|
<span className="material-symbols-outlined">delete_forever</span>
|
|
<span className="material-symbols-outlined">delete_forever</span>
|
|
|
- Delete comment?
|
|
|
|
|
|
|
+ {t('page_comment.delete_comment')}
|
|
|
</span>
|
|
</span>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
@@ -58,7 +62,7 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
- <UserPicture user={creator} size="xs" /> <strong><Username user={creator}></Username></strong> wrote on {commentDate}:
|
|
|
|
|
|
|
+ <UserPicture user={creator} size="xs" /> <strong className="me-2"><Username user={creator}></Username></strong>{commentDate}:
|
|
|
<p className="card custom-card comment-body mt-2 p-2">{commentBodyElement}</p>
|
|
<p className="card custom-card comment-body mt-2 p-2">{commentBodyElement}</p>
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|
|
@@ -71,10 +75,10 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<span className="text-danger">{errorMessage}</span>
|
|
<span className="text-danger">{errorMessage}</span>
|
|
|
- <Button onClick={cancelToDelete}>Cancel</Button>
|
|
|
|
|
|
|
+ <Button onClick={cancelToDelete}>{t('Cancel')}</Button>
|
|
|
<Button color="danger" onClick={confirmToDelete}>
|
|
<Button color="danger" onClick={confirmToDelete}>
|
|
|
<span className="material-symbols-outlined">delete_forever</span>
|
|
<span className="material-symbols-outlined">delete_forever</span>
|
|
|
- Delete
|
|
|
|
|
|
|
+ {t('Delete')}
|
|
|
</Button>
|
|
</Button>
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|