فهرست منبع

add get access token

visuddhinanda 1 سال پیش
والد
کامیت
edb6fa402e
1فایلهای تغییر یافته به همراه29 افزوده شده و 0 حذف شده
  1. 29 0
      dashboard-v4/dashboard/src/components/channel/ChannelMy.tsx

+ 29 - 0
dashboard-v4/dashboard/src/components/channel/ChannelMy.tsx

@@ -36,6 +36,7 @@ import { IChannel } from "./Channel";
 import CopyToModal from "./CopyToModal";
 import { ArticleType } from "../article/Article";
 import { ChannelInfoModal } from "./ChannelInfo";
+import TokenModal from "../article/TokenModal";
 
 const { Search } = Input;
 
@@ -50,6 +51,12 @@ export const getSentIdInArticle = () => {
   return sentList;
 };
 
+interface IToken {
+  channelId?: string;
+  articleId?: string;
+  type?: ArticleType;
+}
+
 interface ChannelTreeNode {
   key: string;
   title: string | React.ReactNode;
@@ -87,6 +94,8 @@ const ChannelMy = ({
   const [statistic, setStatistic] = useState<IItem>();
   const [sentenceCount, setSentenceCount] = useState<number>(0);
   const [sentencesId, setSentencesId] = useState<string[]>();
+  const [token, SetToken] = useState<IToken>();
+  const [tokenOpen, setTokenOpen] = useState(false);
 
   console.debug("ChannelMy render", type, articleId);
 
@@ -250,6 +259,11 @@ const ChannelMy = ({
 
   return (
     <div style={style}>
+      <TokenModal
+        {...token}
+        open={tokenOpen}
+        onClose={() => setTokenOpen(false)}
+      />
       <Card
         size="small"
         title={
@@ -464,6 +478,13 @@ const ChannelMy = ({
                               }),
                               icon: <InfoCircleOutlined />,
                             },
+                            {
+                              key: "token",
+                              label: intl.formatMessage({
+                                id: "buttons.access-token.get",
+                              }),
+                              icon: <InfoCircleOutlined />,
+                            },
                           ],
                           onClick: (e) => {
                             switch (e.key) {
@@ -479,6 +500,14 @@ const ChannelMy = ({
                                 setInfoOpen(true);
                                 setStatistic(node.channel);
                                 break;
+                              case "token":
+                                SetToken({
+                                  channelId: node.channel.uid,
+                                  type: type as ArticleType,
+                                  articleId: articleId,
+                                });
+                                setTokenOpen(true);
+                                break;
                               default:
                                 break;
                             }