|
@@ -3,33 +3,35 @@ import React from 'react';
|
|
|
import { PageComment } from '~/components/PageComment';
|
|
import { PageComment } from '~/components/PageComment';
|
|
|
import { useCommentPreviewOptions } from '~/stores/renderer';
|
|
import { useCommentPreviewOptions } from '~/stores/renderer';
|
|
|
|
|
|
|
|
|
|
+import { useIsTrashPage } from '../stores/context';
|
|
|
|
|
+
|
|
|
import { CommentEditorLazyRenderer } from './PageComment/CommentEditorLazyRenderer';
|
|
import { CommentEditorLazyRenderer } from './PageComment/CommentEditorLazyRenderer';
|
|
|
|
|
|
|
|
type CommentsProps = {
|
|
type CommentsProps = {
|
|
|
pageId?: string,
|
|
pageId?: string,
|
|
|
- isDeleted: boolean,
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const Comments = (props: CommentsProps): JSX.Element => {
|
|
export const Comments = (props: CommentsProps): JSX.Element => {
|
|
|
|
|
|
|
|
- const { pageId, isDeleted } = props;
|
|
|
|
|
|
|
+ const { pageId } = props;
|
|
|
|
|
|
|
|
const { data: rendererOptions } = useCommentPreviewOptions();
|
|
const { data: rendererOptions } = useCommentPreviewOptions();
|
|
|
|
|
+ const { data: isDeleted } = useIsTrashPage();
|
|
|
|
|
|
|
|
- // TODO: Implement Skelton
|
|
|
|
|
- if (rendererOptions == null) {
|
|
|
|
|
|
|
+ // TODO: Implement or refactor Skelton if server-side rendering
|
|
|
|
|
+ if (rendererOptions == null || isDeleted == null) {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- // TODO: Check CSS import
|
|
|
|
|
|
|
+ // TODO: Check and refactor CSS import
|
|
|
<div className="page-comments-row mt-5 py-4 d-edit-none d-print-none">
|
|
<div className="page-comments-row mt-5 py-4 d-edit-none d-print-none">
|
|
|
<div className="container-lg">
|
|
<div className="container-lg">
|
|
|
<div className="page-comments">
|
|
<div className="page-comments">
|
|
|
<div id="page-comments-list" className="page-comments-list">
|
|
<div id="page-comments-list" className="page-comments-list">
|
|
|
<PageComment pageId={pageId} isReadOnly={false} titleAlign="left" />
|
|
<PageComment pageId={pageId} isReadOnly={false} titleAlign="left" />
|
|
|
</div>
|
|
</div>
|
|
|
- { isDeleted && (
|
|
|
|
|
|
|
+ { !isDeleted && (
|
|
|
<div id="page-comment-write">
|
|
<div id="page-comment-write">
|
|
|
<CommentEditorLazyRenderer pageId={pageId} rendererOptions={rendererOptions} />
|
|
<CommentEditorLazyRenderer pageId={pageId} rendererOptions={rendererOptions} />
|
|
|
</div>
|
|
</div>
|