Переглянути джерело

讨论图标移到弹窗里

visuddhinanda 2 роки тому
батько
коміт
256b6e9c11
1 змінених файлів з 16 додано та 2 видалено
  1. 16 2
      dashboard/src/components/template/Wbw/WbwDetail.tsx

+ 16 - 2
dashboard/src/components/template/Wbw/WbwDetail.tsx

@@ -2,7 +2,7 @@ import { useState } from "react";
 import { useIntl } from "react-intl";
 import { useIntl } from "react-intl";
 import { Dropdown, Tabs, Divider, Button, Switch, Rate } from "antd";
 import { Dropdown, Tabs, Divider, Button, Switch, Rate } from "antd";
 import type { MenuProps } from "antd";
 import type { MenuProps } from "antd";
-import { SaveOutlined } from "@ant-design/icons";
+import { SaveOutlined, CommentOutlined } from "@ant-design/icons";
 
 
 import { IWbw, IWbwField, TFieldName } from "./WbwWord";
 import { IWbw, IWbwField, TFieldName } from "./WbwWord";
 import WbwDetailBasic from "./WbwDetailBasic";
 import WbwDetailBasic from "./WbwDetailBasic";
@@ -13,13 +13,15 @@ import { LockIcon, UnLockIcon } from "../../../assets/icon";
 import { UploadFile } from "antd/es/upload/interface";
 import { UploadFile } from "antd/es/upload/interface";
 import { IAttachmentResponse } from "../../api/Attachments";
 import { IAttachmentResponse } from "../../api/Attachments";
 import WbwDetailAttachment from "./WbwDetailAttachment";
 import WbwDetailAttachment from "./WbwDetailAttachment";
+import CommentBox from "../../comment/CommentBox";
 
 
 interface IWidget {
 interface IWidget {
   data: IWbw;
   data: IWbw;
   onClose?: Function;
   onClose?: Function;
   onSave?: Function;
   onSave?: Function;
+  onCommentCountChange?: Function;
 }
 }
-const Widget = ({ data, onClose, onSave }: IWidget) => {
+const Widget = ({ data, onClose, onSave, onCommentCountChange }: IWidget) => {
   const intl = useIntl();
   const intl = useIntl();
   const [currWbwData, setCurrWbwData] = useState(data);
   const [currWbwData, setCurrWbwData] = useState(data);
   function fieldChanged(field: TFieldName, value: string) {
   function fieldChanged(field: TFieldName, value: string) {
@@ -95,6 +97,18 @@ const Widget = ({ data, onClose, onSave }: IWidget) => {
       <Tabs
       <Tabs
         size="small"
         size="small"
         type="card"
         type="card"
+        tabBarExtraContent={
+          <CommentBox
+            resId={data.uid}
+            resType="wbw"
+            trigger={<Button icon={<CommentOutlined />} type="text" />}
+            onCommentCountChange={(count: number) => {
+              if (typeof onCommentCountChange !== "undefined") {
+                onCommentCountChange(count);
+              }
+            }}
+          />
+        }
         items={[
         items={[
           {
           {
             label: intl.formatMessage({ id: "buttons.basic" }),
             label: intl.formatMessage({ id: "buttons.basic" }),