소스 검색

add CloseOutlined

visuddhinanda 2 년 전
부모
커밋
a9a9a3161a
1개의 변경된 파일30개의 추가작업 그리고 2개의 파일을 삭제
  1. 30 2
      dashboard/src/components/discussion/DiscussionShow.tsx

+ 30 - 2
dashboard/src/components/discussion/DiscussionShow.tsx

@@ -16,6 +16,7 @@ import {
   CommentOutlined,
   CommentOutlined,
   MessageOutlined,
   MessageOutlined,
   ExclamationCircleOutlined,
   ExclamationCircleOutlined,
+  CloseOutlined,
 } from "@ant-design/icons";
 } from "@ant-design/icons";
 import type { MenuProps } from "antd";
 import type { MenuProps } from "antd";
 
 
@@ -34,6 +35,7 @@ interface IWidget {
   onSelect?: Function;
   onSelect?: Function;
   onDelete?: Function;
   onDelete?: Function;
   onReply?: Function;
   onReply?: Function;
+  onClose?: Function;
 }
 }
 const DiscussionShowWidget = ({
 const DiscussionShowWidget = ({
   data,
   data,
@@ -41,6 +43,7 @@ const DiscussionShowWidget = ({
   onSelect,
   onSelect,
   onDelete,
   onDelete,
   onReply,
   onReply,
+  onClose,
 }: IWidget) => {
 }: IWidget) => {
   const intl = useIntl();
   const intl = useIntl();
   const showDeleteConfirm = (id: string, title: string) => {
   const showDeleteConfirm = (id: string, title: string) => {
@@ -103,6 +106,11 @@ const DiscussionShowWidget = ({
           onEdit();
           onEdit();
         }
         }
         break;
         break;
+      case "close":
+        if (typeof onClose !== "undefined") {
+          onClose();
+        }
+        break;
       case "delete":
       case "delete":
         if (data.id) {
         if (data.id) {
           showDeleteConfirm(data.id, data.title ? data.title : "");
           showDeleteConfirm(data.id, data.title ? data.title : "");
@@ -139,6 +147,22 @@ const DiscussionShowWidget = ({
       }),
       }),
       icon: <EditOutlined />,
       icon: <EditOutlined />,
     },
     },
+    {
+      key: "close",
+      label: intl.formatMessage({
+        id: "buttons.close",
+      }),
+      icon: <CloseOutlined />,
+      disabled: data.status === "close",
+    },
+    {
+      key: "reopen",
+      label: intl.formatMessage({
+        id: "buttons.open",
+      }),
+      icon: <CloseOutlined />,
+      disabled: data.status === "active",
+    },
     {
     {
       key: "delete",
       key: "delete",
       label: intl.formatMessage({
       label: intl.formatMessage({
@@ -173,7 +197,7 @@ const DiscussionShowWidget = ({
               {data.title}
               {data.title}
             </Text>
             </Text>
           ) : undefined}
           ) : undefined}
-          <Text type="secondary">
+          <Text type="secondary" style={{ display: "none" }}>
             <Space>
             <Space>
               {data.user.nickName}
               {data.user.nickName}
               <TimeShow
               <TimeShow
@@ -204,7 +228,11 @@ const DiscussionShowWidget = ({
               </>
               </>
             ) : undefined}
             ) : undefined}
           </span>
           </span>
-          <Dropdown menu={{ items, onClick }} placement="bottomRight">
+          <Dropdown
+            menu={{ items, onClick }}
+            placement="bottomRight"
+            trigger={["click"]}
+          >
             <Button
             <Button
               shape="circle"
               shape="circle"
               size="small"
               size="small"