|
|
@@ -1,38 +1,22 @@
|
|
|
-import React, { FC } from 'react';
|
|
|
+import React from 'react';
|
|
|
|
|
|
-import { useSWRxPageComment } from '../../stores/comment';
|
|
|
+import { useCurrentPageId } from '~/stores/context';
|
|
|
|
|
|
-import AppContainer from '~/client/services/AppContainer';
|
|
|
+import { useSWRxPageComment } from '../../stores/comment';
|
|
|
|
|
|
-import CommentEditor from './CommentEditor';
|
|
|
-import { useCommentPreviewOptions } from '~/stores/renderer';
|
|
|
+import { CommentEditor } from './CommentEditor';
|
|
|
|
|
|
-type Props = {
|
|
|
- appContainer: AppContainer,
|
|
|
- pageId: string,
|
|
|
-}
|
|
|
|
|
|
-const CommentEditorLazyRenderer:FC<Props> = (props:Props):JSX.Element => {
|
|
|
+export const CommentEditorLazyRenderer = (): JSX.Element => {
|
|
|
|
|
|
- const { pageId } = props;
|
|
|
+ const { data: pageId } = useCurrentPageId();
|
|
|
const { mutate } = useSWRxPageComment(pageId);
|
|
|
- const { data: rendererOptions } = useCommentPreviewOptions();
|
|
|
-
|
|
|
- if (rendererOptions == null) {
|
|
|
- return <></>;
|
|
|
- }
|
|
|
-
|
|
|
- const { appContainer } = props;
|
|
|
|
|
|
return (
|
|
|
<CommentEditor
|
|
|
- appContainer={appContainer}
|
|
|
- rendererOptions={rendererOptions}
|
|
|
replyTo={undefined}
|
|
|
onCommentButtonClicked={mutate}
|
|
|
isForNewComment
|
|
|
/>
|
|
|
);
|
|
|
};
|
|
|
-
|
|
|
-export default CommentEditorLazyRenderer;
|