diff --git a/src/components/Documents.jsx b/src/components/Documents.jsx index 4291b62..a29a7dc 100644 --- a/src/components/Documents.jsx +++ b/src/components/Documents.jsx @@ -1,6 +1,5 @@ import {Table, DatePicker, Button, Modal, ConfigProvider} from 'antd' import { UploadOutlined } from '@ant-design/icons' -import MenuDocuments from "./MenuDocuments" import DocumentCreationForm from './modalWindows/DocumentCreationForm' import { FileService } from '../services/api' import {useState, useEffect} from "react" @@ -136,7 +135,6 @@ export default function Documents({selectedFileCategory}) { return (
-

Фильтр документов:

diff --git a/src/components/MenuDocuments.jsx b/src/components/MenuDocuments.jsx index 8aa1ad9..3c585f1 100644 --- a/src/components/MenuDocuments.jsx +++ b/src/components/MenuDocuments.jsx @@ -1,16 +1,22 @@ -import {Menu} from "antd"; +import {Layout, Menu} from "antd"; import {FolderOutlined} from "@ant-design/icons"; -import {Link} from "react-router-dom"; -import {useState} from "react" +import {Link, Route, Switch, useParams, useLocation} from "react-router-dom"; +import Documents from "../components/Documents"; +import LastData from '../pages/LastData' +import { useState, useEffect } from "react"; +const { Content } = Layout export default function MenuDocuments() { + let { id } = useParams() + let currentPath = useLocation().pathname - const [selectedItem, setSelectedItem] = useState(1) + const [selectedElement, setSelectedElement] = useState('fluidService') - const handleClick = e => { - setSelectedItem({ current: e.key }); - }; + useEffect(() => { + let pathLastElement = currentPath.split('/').pop() + setSelectedElement(pathLastElement) + }, [currentPath]) return( <> @@ -18,33 +24,63 @@ export default function MenuDocuments() { mode="horizontal" selectable={true} className="well_menu" - onClick={handleClick} - selectedKeys={[selectedItem]} + selectedKeys={[selectedElement]} > - }> - Растворный сервис + }> + Растворный сервис - }> - Цементирование + }> + Цементирование - }> - ННБ + }> + ННБ - }> - ГТИ + }> + ГТИ - }> - Документы по скважине + }> + Документы по скважине - }> - Супервайзер + }> + Супервайзер - }> - Мастер + }> + Мастер - }> - Последние данные + }> + Последние данные + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) } diff --git a/src/pages/LastData.jsx b/src/pages/LastData.jsx index a331594..45f434c 100644 --- a/src/pages/LastData.jsx +++ b/src/pages/LastData.jsx @@ -1,10 +1,9 @@ import {Button, Modal, Checkbox } from "antd"; import {CementFluid} from "../components/CementFluid"; -import React, {useState} from "react"; +import {useState} from "react"; import {Sludge} from "../components/Sludge"; import {NnbTable} from "../components/NnbTable" import Disposition from "../components/Disposition"; -import MenuDocuments from "../components/MenuDocuments"; export default function LastData() { @@ -15,9 +14,6 @@ export default function LastData() { return ( <> -
- -