Browse Source

move insert from page to components

tumao 4 years ago
parent
commit
26820c381d

+ 3 - 3
client/src/pages/insert/Container.tsx → client/src/components/insert/Container.tsx

@@ -1,8 +1,8 @@
 import { makeStyles, Theme } from '@material-ui/core';
 import { useContext, useMemo, useState } from 'react';
 import { useTranslation } from 'react-i18next';
-import DialogTemplate from '../../components/customDialog/DialogTemplate';
-import icons from '../../components/icons/Icons';
+import DialogTemplate from '../customDialog/DialogTemplate';
+import icons from '../icons/Icons';
 import { rootContext } from '../../context/Root';
 import InsertImport from './Import';
 import InsertPreview from './Preview';
@@ -17,7 +17,7 @@ const getStyles = makeStyles((theme: Theme) => ({
 
 /**
  * this component contains processes during insert
- * all interactions with server are done in it
+ * all datas and methods passed in as props, no interactions with server done in it
  */
 
 const InsertContainer = () => {

+ 2 - 2
client/src/pages/insert/Import.tsx → client/src/components/insert/Import.tsx

@@ -1,8 +1,8 @@
 import { useTranslation } from 'react-i18next';
 import Typography from '@material-ui/core/Typography';
 import { makeStyles, Theme, Divider } from '@material-ui/core';
-import CustomSelector from '../../components/customSelector/CustomSelector';
-import { Option } from '../../components/customSelector/Types';
+import CustomSelector from '../customSelector/CustomSelector';
+import { Option } from '../customSelector/Types';
 
 const getStyles = makeStyles((theme: Theme) => ({
   tip: {

+ 0 - 0
client/src/pages/insert/Preview.tsx → client/src/components/insert/Preview.tsx


+ 0 - 0
client/src/pages/insert/Status.tsx → client/src/components/insert/Status.tsx


+ 0 - 0
client/src/pages/insert/Types.ts → client/src/components/insert/Types.ts


+ 20 - 20
client/src/pages/collections/Collections.tsx

@@ -225,26 +225,26 @@ const Collections = () => {
       },
       icon: 'add',
     },
-    // {
-    //   label: btnTrans('insert'),
-    //   onClick: () => {
-    //     setDialog({
-    //       open: true,
-    //       type: 'custom',
-    //       params: {
-    //         component: <InsertContainer />,
-    //       },
-    //     });
-    //   },
-    //   /**
-    //    * insert validation:
-    //    * 1. At least 1 available collection
-    //    * 2. selected collections quantity shouldn't over 1
-    //    */
-    //   disabled: () =>
-    //     collectionList.length === 0 || selectedCollections.length > 1,
-    //   icon: 'upload',
-    // },
+    {
+      label: btnTrans('insert'),
+      onClick: () => {
+        setDialog({
+          open: true,
+          type: 'custom',
+          params: {
+            component: <InsertContainer />,
+          },
+        });
+      },
+      /**
+       * insert validation:
+       * 1. At least 1 available collection
+       * 2. selected collections quantity shouldn't over 1
+       */
+      disabled: () =>
+        collectionList.length === 0 || selectedCollections.length > 1,
+      icon: 'upload',
+    },
     {
       type: 'iconBtn',
       onClick: () => {