}
- colorClass='text-primary'
+ icon={
}
onClick={shareCurrentURLProc}
/>
}
- colorClass='text-primary'
+ icon={
}
loading={processing}
onClick={handleDownload}
/>
}
- colorClass='text-green'
+ icon={
}
onClick={() => claimOwnershipProc(claim, reload)}
/>
}
- colorClass='text-red'
+ icon={
}
loading={processing}
onClick={handleDelete}
/>
diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSFormTabs.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSFormTabs.tsx
index f301536b..a016bb88 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/RSFormTabs.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/RSFormTabs.tsx
@@ -43,31 +43,6 @@ function RSFormTabs() {
}
}, [setActive, schema, setInit]);
-// const [ locationKeys, setLocationKeys ] = useState([])
-// const history = useHistory()
-
-// useEffect(() => {
-// return history.listen(location => {
-// if (history.action === 'PUSH') {
-// setLocationKeys([ location.key ])
-// }
-
-// if (history.action === 'POP') {
-// if (locationKeys[1] === location.key) {
-// setLocationKeys(([ _, ...keys ]) => keys)
-
-// // Handle forward event
-
-// } else {
-// setLocationKeys((keys) => [ location.key, ...keys ])
-
-// // Handle back event
-
-// }
-// }
-// })
-// }, [ locationKeys, ])
-
useEffect(() => {
const url = new URL(window.location.href);
const tabQuery = url.searchParams.get('tab');
@@ -109,10 +84,10 @@ function RSFormTabs() {
defaultFocus={true}
selectedTabClassName='font-bold'
>
-
+
Паспорт схемы
-
+
Конституенты
{`${schema.stats?.count_errors} | ${schema.stats?.count_all}`}
diff --git a/rsconcept/frontend/src/pages/RSFormPage/TablistTools.tsx b/rsconcept/frontend/src/pages/RSFormPage/TablistTools.tsx
index 83546c2a..f95404bf 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/TablistTools.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/TablistTools.tsx
@@ -1,32 +1,60 @@
import { useCallback } from 'react';
import Button from '../../components/Common/Button';
import Dropdown from '../../components/Common/Dropdown';
-import { CrownIcon, DumpBinIcon, EyeIcon, EyeOffIcon, MenuIcon, PenIcon } from '../../components/Icons';
+import { CloneIcon, CrownIcon, DownloadIcon, DumpBinIcon, EyeIcon, EyeOffIcon, MenuIcon, PenIcon, ShareIcon, UploadIcon } from '../../components/Icons';
import { useRSForm } from '../../context/RSFormContext';
import useDropdown from '../../hooks/useDropdown';
import DropdownButton from '../../components/Common/DropdownButton';
import Checkbox from '../../components/Common/Checkbox';
import { useAuth } from '../../context/AuthContext';
-import { claimOwnershipProc, deleteRSFormProc } from '../../utils/procedures';
+import { claimOwnershipProc, deleteRSFormProc, downloadRSFormProc, shareCurrentURLProc } from '../../utils/procedures';
import { useNavigate } from 'react-router-dom';
+import { toast } from 'react-toastify';
function TablistTools() {
const navigate = useNavigate();
const {user} = useAuth();
- const {
+ const { schema,
isOwned, isEditable, isTracking, readonly, forceAdmin,
toggleTracking, toggleForceAdmin, toggleReadonly,
- claim, reload, destroy
+ claim, reload, destroy, download
} = useRSForm();
const schemaMenu = useDropdown();
const editMenu = useDropdown();
const handleClaimOwner = useCallback(() => {
- claimOwnershipProc(claim, reload)
- }, [claim, reload]);
+ editMenu.hide();
+ claimOwnershipProc(claim, reload);
+ }, [claim, reload, editMenu]);
- const handleDelete =
- useCallback(() => deleteRSFormProc(destroy, navigate), [destroy, navigate]);
+ const handleDelete = useCallback(() => {
+ schemaMenu.hide();
+ deleteRSFormProc(destroy, navigate);
+ }, [destroy, navigate, schemaMenu]);
+
+ const handleDownload = useCallback(() => {
+ schemaMenu.hide();
+ const fileName = (schema?.alias || 'Schema') + '.trs';
+ downloadRSFormProc(download, fileName);
+ }, [schemaMenu, download, schema?.alias]);
+
+ const handleUpload = useCallback(() => {
+ // TODO: implement
+ schemaMenu.hide();
+ toast.info('Замена содержимого на файл Экстеора');
+ }, [schemaMenu]);
+
+
+ const handleClone = useCallback(() => {
+ // TODO: implement
+ schemaMenu.hide();
+ toast.info('Клонирование РС-формы');
+ }, [schemaMenu]);
+
+ const handleShare = useCallback(() => {
+ schemaMenu.hide();
+ shareCurrentURLProc();
+ }, [schemaMenu]);
return (
@@ -40,22 +68,43 @@ function TablistTools() {
/>
{ schemaMenu.isActive &&
- клонировать
- поделиться
-
-
-
-
Удалить схему
+
+
+
+
+
+
+
+
+ Выгрузить файл Экстеор
+
+
+
+
+
+ Загрузить из Экстеора
+
+
+
+
+
+ Удалить схему
+
+
}