visuddhinanda 2 лет назад
Родитель
Сommit
fa33dcb08b
1 измененных файлов с 18 добавлено и 4 удалено
  1. 18 4
      dashboard/src/components/discussion/DiscussionTopic.tsx

+ 18 - 4
dashboard/src/components/discussion/DiscussionTopic.tsx

@@ -2,15 +2,29 @@ import { Divider } from "antd";
 
 import CommentTopicInfo from "./DiscussionTopicInfo";
 import CommentTopicChildren from "./DiscussionTopicChildren";
+import { IComment } from "./DiscussionItem";
 
 interface IWidget {
   topicId?: string;
   onItemCountChange?: Function;
+  onTopicReady?: Function;
 }
-const DiscussionTopicWidget = ({ topicId, onItemCountChange }: IWidget) => {
+const DiscussionTopicWidget = ({
+  topicId,
+  onTopicReady,
+  onItemCountChange,
+}: IWidget) => {
   return (
-    <div>
-      <CommentTopicInfo topicId={topicId} />
+    <>
+      <CommentTopicInfo
+        topicId={topicId}
+        onReady={(value: IComment) => {
+          console.log("on Topic Ready", value);
+          if (typeof onTopicReady !== "undefined") {
+            onTopicReady(value);
+          }
+        }}
+      />
       <Divider />
       <CommentTopicChildren
         topicId={topicId}
@@ -21,7 +35,7 @@ const DiscussionTopicWidget = ({ topicId, onItemCountChange }: IWidget) => {
           }
         }}
       />
-    </div>
+    </>
   );
 };