toggleLikeComment(data)}>
diff --git a/src/containers/unit/Comments/Comment/index.js b/src/containers/unit/Comments/Comment/index.tsx
similarity index 100%
rename from src/containers/unit/Comments/Comment/index.js
rename to src/containers/unit/Comments/Comment/index.tsx
diff --git a/src/containers/unit/Comments/CommentBodyEditor.js b/src/containers/unit/Comments/CommentBodyEditor.tsx
similarity index 57%
rename from src/containers/unit/Comments/CommentBodyEditor.js
rename to src/containers/unit/Comments/CommentBodyEditor.tsx
index 985041934..afd19fd95 100755
--- a/src/containers/unit/Comments/CommentBodyEditor.js
+++ b/src/containers/unit/Comments/CommentBodyEditor.tsx
@@ -1,33 +1,51 @@
import React from 'react'
import dynamic from 'next/dynamic'
+import type { TUser } from '@/spec'
import { debounce } from '@/utils'
+
import { InputEditorWrapper } from './styles/comment_editor'
import EditorFooter from './EditorFooter'
-import * as logic from './logic'
+import {
+ onMentionSearch,
+ onMention,
+ onCommentInputChange,
+ backToEditor,
+ createCommentPreview,
+ onCommentInputBlur,
+} from './logic'
export const BodyEditor = dynamic(() => import('@/components/MarkdownEditor'), {
/* eslint-disable react/display-name */
loading: () =>
loading
,
})
-const CommentBodyEditor = ({
+type TProps = {
+ showInputEditor: boolean
+ showInputPreview: boolean
+ body: string
+ mentionList: TUser[]
+ onCreate: () => void
+ creating: boolean
+}
+
+const CommentBodyEditor: React.FC
= ({
showInputEditor,
showInputPreview,
body,
mentionList,
onCreate,
- restProps: { creating },
+ creating,
}) => {
return (
@@ -37,9 +55,9 @@ const CommentBodyEditor = ({
showFold
showPreview={showInputPreview}
onCreate={onCreate}
- onBackEdit={logic.backToEditor}
- onPreview={logic.createCommentPreview}
- onFold={logic.onCommentInputBlur}
+ onBackEdit={backToEditor}
+ onPreview={createCommentPreview}
+ onFold={onCommentInputBlur}
/>
)
diff --git a/src/containers/unit/Comments/CommentEditor.js b/src/containers/unit/Comments/CommentEditor.tsx
similarity index 71%
rename from src/containers/unit/Comments/CommentEditor.js
rename to src/containers/unit/Comments/CommentEditor.tsx
index 2c5b84c9b..3defaa49c 100755
--- a/src/containers/unit/Comments/CommentEditor.js
+++ b/src/containers/unit/Comments/CommentEditor.tsx
@@ -1,15 +1,34 @@
import React from 'react'
+
+import type { TAccount, TUser } from '@/spec'
import MarkDownRender from '@/components/MarkDownRender'
+
+import EditorHeader from './EditorHeader'
+import EditorFooter from './EditorFooter'
import CommentBodyEditor from './CommentBodyEditor'
import { Container, PreviewerWrapper } from './styles/comment_editor'
+import { backToEditor, createCommentPreview } from './logic'
-import EditorHeader from './EditorHeader'
-import EditorFooter from './EditorFooter'
+type TProps = {
+ referUsers: TUser[]
+ accountInfo: TAccount
+ mentionList: TUser[]
-import * as logic from './logic'
+ /* TODO: () => void */
+ onCreate?: any
+
+ restProps: {
+ countCurrent: number
+ showInputBox: boolean
+ showInputEditor: boolean
+ showInputPreview: boolean
+ editContent: string
+ creating: boolean
+ }
+}
-const CommentEditor = (props) => {
+const CommentEditor: React.FC = (props) => {
const {
referUsers,
accountInfo,
@@ -41,7 +60,7 @@ const CommentEditor = (props) => {
showInputEditor={showInputEditor}
body={editContent}
onCreate={onCreate}
- restProps={{ ...props }}
+ creating={creating}
/>
)}
{showInputPreview && (
@@ -53,8 +72,8 @@ const CommentEditor = (props) => {
loading={creating}
showPreview={showInputPreview}
onCreate={onCreate}
- onBackEdit={logic.backToEditor}
- onPreview={logic.createCommentPreview}
+ onBackEdit={backToEditor}
+ onPreview={createCommentPreview}
/>
)}
diff --git a/src/containers/unit/Comments/CommentReplyEditor.js b/src/containers/unit/Comments/CommentReplyEditor.tsx
similarity index 65%
rename from src/containers/unit/Comments/CommentReplyEditor.js
rename to src/containers/unit/Comments/CommentReplyEditor.tsx
index fc3f6387e..9e90dce8f 100755
--- a/src/containers/unit/Comments/CommentReplyEditor.js
+++ b/src/containers/unit/Comments/CommentReplyEditor.tsx
@@ -1,10 +1,14 @@
import React from 'react'
import dynamic from 'next/dynamic'
-import MarkDownRender from '@/components/MarkDownRender'
+import type { TAccount, TUser, TComment } from '@/spec'
import { debounce } from '@/utils'
+
+import MarkDownRender from '@/components/MarkDownRender'
+
import ReplyToBar from './ReplyToBar'
import ReplyEditorHeader from './ReplyEditorHeader'
+import EditorFooter from './EditorFooter'
import {
Wrapper,
@@ -12,16 +16,37 @@ import {
PreviewWrapper,
} from './styles/comment_reply_editor'
-import EditorFooter from './EditorFooter'
-
-import * as logic from './logic'
+import {
+ onReplyInputChange,
+ onMention,
+ onMentionSearch,
+ createReplyComment,
+ replyBackToEditor,
+ replyCommentPreview,
+} from './logic'
export const BodyEditor = dynamic(() => import('@/components/MarkdownEditor'), {
/* eslint-disable react/display-name */
loading: () =>