visuddhinanda 2 anni fa
parent
commit
775ff53b82
1 ha cambiato i file con 17 aggiunte e 1 eliminazioni
  1. 17 1
      dashboard/src/components/export/ShareButton.tsx

+ 17 - 1
dashboard/src/components/export/ShareButton.tsx

@@ -3,6 +3,7 @@ import { ShareAltOutlined, ExportOutlined } from "@ant-design/icons";
 import ExportModal from "./ExportModal";
 import { useState } from "react";
 import { ArticleType } from "../article/Article";
+import AddToAnthology from "../article/AddToAnthology";
 
 const { Text } = Typography;
 
@@ -23,6 +24,7 @@ const ShareButtonWidget = ({
   anthologyId,
 }: IWidget) => {
   const [exportOpen, setExportOpen] = useState(false);
+  const [addToAnthologyOpen, setAddToAnthologyOpen] = useState(false);
 
   return (
     <>
@@ -42,13 +44,20 @@ const ShareButtonWidget = ({
               key: "export",
               icon: <ExportOutlined />,
             },
+            {
+              label: "添加到文集",
+              key: "add_to_anthology",
+              icon: <ExportOutlined />,
+            },
           ],
           onClick: ({ key }) => {
             switch (key) {
               case "export":
                 setExportOpen(true);
                 break;
-
+              case "add_to_anthology":
+                setAddToAnthologyOpen(true);
+                break;
               default:
                 break;
             }
@@ -67,6 +76,13 @@ const ShareButtonWidget = ({
         open={exportOpen}
         onClose={() => setExportOpen(false)}
       />
+      {articleId ? (
+        <AddToAnthology
+          open={addToAnthologyOpen}
+          onClose={(isOpen: boolean) => setAddToAnthologyOpen(isOpen)}
+          articleIds={[articleId]}
+        />
+      ) : undefined}
     </>
   );
 };