Browse Source

提取 channelTypeFilter

visuddhinanda 2 năm trước cách đây
mục cha
commit
1e9305e8b0
1 tập tin đã thay đổi với 25 bổ sung33 xóa
  1. 25 33
      dashboard/src/components/channel/ChannelTable.tsx

+ 25 - 33
dashboard/src/components/channel/ChannelTable.tsx

@@ -1,5 +1,5 @@
 import { ActionType, ProTable } from "@ant-design/pro-components";
-import { useIntl } from "react-intl";
+import { FormattedMessage, useIntl } from "react-intl";
 import { Link } from "react-router-dom";
 import { Alert, Badge, message, Modal, Typography } from "antd";
 import { Button, Dropdown, Popover } from "antd";
@@ -31,6 +31,29 @@ import { TransferOutLinedIcon } from "../../assets/icon";
 
 const { Text } = Typography;
 
+export const channelTypeFilter = {
+  all: {
+    text: <FormattedMessage id="channel.type.all.title" />,
+    status: "Default",
+  },
+  translation: {
+    text: <FormattedMessage id="channel.type.translation.label" />,
+    status: "Success",
+  },
+  nissaya: {
+    text: <FormattedMessage id="channel.type.nissaya.label" />,
+    status: "Processing",
+  },
+  commentary: {
+    text: <FormattedMessage id="channel.type.commentary.label" />,
+    status: "Default",
+  },
+  original: {
+    text: <FormattedMessage id="channel.type.original.label" />,
+    status: "Default",
+  },
+};
+
 export interface IResNumberResponse {
   ok: boolean;
   message: string;
@@ -269,38 +292,7 @@ const ChannelTableWidget = ({
             search: false,
             filters: true,
             onFilter: true,
-            valueEnum: {
-              all: {
-                text: intl.formatMessage({
-                  id: "channel.type.all.title",
-                }),
-                status: "Default",
-              },
-              translation: {
-                text: intl.formatMessage({
-                  id: "channel.type.translation.label",
-                }),
-                status: "Success",
-              },
-              nissaya: {
-                text: intl.formatMessage({
-                  id: "channel.type.nissaya.label",
-                }),
-                status: "Processing",
-              },
-              commentary: {
-                text: intl.formatMessage({
-                  id: "channel.type.commentary.label",
-                }),
-                status: "Default",
-              },
-              original: {
-                text: intl.formatMessage({
-                  id: "channel.type.original.label",
-                }),
-                status: "Default",
-              },
-            },
+            valueEnum: channelTypeFilter,
           },
           {
             title: intl.formatMessage({