Kaynağa Gözat

:fire: <div>

visuddhinanda 2 yıl önce
ebeveyn
işleme
0da95b764c

+ 31 - 34
dashboard/src/components/discussion/DiscussionListCard.tsx

@@ -44,8 +44,7 @@ const DiscussionListCardWidget = ({
     let url: string = "";
     let url: string = "";
     if (typeof topicId !== "undefined") {
     if (typeof topicId !== "undefined") {
       url = `/v2/discussion?view=question-by-topic&id=${topicId}`;
       url = `/v2/discussion?view=question-by-topic&id=${topicId}`;
-    }
-    if (typeof resId !== "undefined") {
+    } else if (typeof resId !== "undefined") {
       url = `/v2/discussion?view=question&id=${resId}`;
       url = `/v2/discussion?view=question&id=${resId}`;
     }
     }
     if (url === "") {
     if (url === "") {
@@ -88,39 +87,37 @@ const DiscussionListCardWidget = ({
   }
   }
 
 
   return (
   return (
-    <div>
-      <Card title="讨论" extra={"More"}>
-        {data.length > 0 ? (
-          <CommentList
-            onSelect={(
-              e: React.MouseEvent<HTMLSpanElement, MouseEvent>,
-              comment: IComment
-            ) => {
-              if (typeof onSelect !== "undefined") {
-                onSelect(e, comment);
-              }
-            }}
-            data={data}
-          />
-        ) : undefined}
+    <Card title="讨论" extra={"More"}>
+      {data.length > 0 ? (
+        <CommentList
+          onSelect={(
+            e: React.MouseEvent<HTMLSpanElement, MouseEvent>,
+            comment: IComment
+          ) => {
+            if (typeof onSelect !== "undefined") {
+              onSelect(e, comment);
+            }
+          }}
+          data={data}
+        />
+      ) : undefined}
 
 
-        {resId && resType ? (
-          <CommentCreate
-            contentType="markdown"
-            resId={resId}
-            resType={resType}
-            onCreated={(e: IComment) => {
-              const newData = JSON.parse(JSON.stringify(e));
-              console.log("create", e);
-              if (typeof onItemCountChange !== "undefined") {
-                onItemCountChange(data.length + 1);
-              }
-              setData([...data, newData]);
-            }}
-          />
-        ) : undefined}
-      </Card>
-    </div>
+      {resId && resType ? (
+        <CommentCreate
+          contentType="markdown"
+          resId={resId}
+          resType={resType}
+          onCreated={(e: IComment) => {
+            const newData = JSON.parse(JSON.stringify(e));
+            console.log("create", e);
+            if (typeof onItemCountChange !== "undefined") {
+              onItemCountChange(data.length + 1);
+            }
+            setData([...data, newData]);
+          }}
+        />
+      ) : undefined}
+    </Card>
   );
   );
 };
 };