From c3d53284bd5d3f650fc224b749d721bb4dc42d0f Mon Sep 17 00:00:00 2001 From: goodmice Date: Tue, 25 Oct 2022 18:59:10 +0500 Subject: [PATCH] =?UTF-8?q?*=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BA=D1=80=D0=BE=D1=88=D0=BA=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B5=20=D0=B0=D0=B4=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD=D0=BA=D0=B8,=20=D0=BA=D1=83=D1=81=D1=82=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D1=8B=20*?= =?UTF-8?q?=20=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D1=8B=20=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BB=D0=B8=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=86=D0=B0=D1=85=20=D1=81=D0=BA=D0=B2=D0=B0?= =?UTF-8?q?=D0=B6=D0=B8=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/context.ts | 4 + src/pages/AdminPanel/index.jsx | 11 +-- src/pages/Cluster/index.jsx | 3 +- .../Well/Documents/DocumentsTemplate.jsx | 2 +- src/pages/Well/index.jsx | 98 +++++++++++-------- src/styles/tvd.less | 4 +- 6 files changed, 68 insertions(+), 54 deletions(-) diff --git a/src/context.ts b/src/context.ts index 5db8820..bd186a5 100644 --- a/src/context.ts +++ b/src/context.ts @@ -11,6 +11,8 @@ export const RootPathContext = createContext('/') export const UserContext = createContext({}) /** Контекст метода редактирования параметров заголовка и меню */ export const LayoutPropsContext = createContext<(props: LayoutPortalProps) => void>(() => {}) +/** Контекст для блока справа от крошек на страницах скважин и админки */ +export const TopRightBlockContext = createContext<(block: JSX.Element) => void>(() => {}) /** * Получить текущую скважину @@ -33,6 +35,8 @@ export const useRootPath = () => useContext(RootPathContext) */ export const useUser = () => useContext(UserContext) +export const useTopRightBlock = () => useContext(TopRightBlockContext) + /** * Получить метод задания параметров заголовка и меню * diff --git a/src/pages/AdminPanel/index.jsx b/src/pages/AdminPanel/index.jsx index d515175..f66f718 100755 --- a/src/pages/AdminPanel/index.jsx +++ b/src/pages/AdminPanel/index.jsx @@ -2,9 +2,10 @@ import { Navigate, Route, Routes } from 'react-router-dom' import { lazy, memo, useMemo } from 'react' import { RootPathContext, useLayoutProps, useRootPath } from '@asb/context' +import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb' import { NoAccessComponent, wrapPrivateComponent } from '@utils' -import AdminNavigationMenu from './AdminNavigationMenu' +import { AdminNavigationMenu, menuItems } from './AdminNavigationMenu' const ClusterController = lazy(() => import('./ClusterController')) const CompanyController = lazy(() => import('./CompanyController')) @@ -23,6 +24,7 @@ const layoutProps = { sider: , title: 'Администраторская панель', isAdmin: true, + breadcrumb: , } const AdminPanel = memo(() => { @@ -56,9 +58,4 @@ const AdminPanel = memo(() => { ) }) -export default wrapPrivateComponent(AdminPanel, { - requirements: ['RequestTracker.get'], - title: 'Панель администратора', - route: 'admin/*', - key: 'admin', -}) +export default wrapPrivateComponent(AdminPanel, { requirements: ['RequestTracker.get'] }) diff --git a/src/pages/Cluster/index.jsx b/src/pages/Cluster/index.jsx index 3b82913..9c33768 100755 --- a/src/pages/Cluster/index.jsx +++ b/src/pages/Cluster/index.jsx @@ -10,7 +10,8 @@ import { OperationStatService } from '@api' import ClusterWells from './ClusterWells' const layoutProps = { - title: 'Анализ скважин куста' + title: 'Анализ скважин куста', + breadcrumb: true, } const Cluster = memo(() => { diff --git a/src/pages/Well/Documents/DocumentsTemplate.jsx b/src/pages/Well/Documents/DocumentsTemplate.jsx index 4ce2c6a..673a8a2 100644 --- a/src/pages/Well/Documents/DocumentsTemplate.jsx +++ b/src/pages/Well/Documents/DocumentsTemplate.jsx @@ -94,7 +94,7 @@ export const DocumentsTemplate = ({ idCategory, well: givenWell, mimeTypes, head return ( -
+
Фильтр по дате
diff --git a/src/pages/Well/index.jsx b/src/pages/Well/index.jsx index 3e65e7d..4725aa9 100644 --- a/src/pages/Well/index.jsx +++ b/src/pages/Well/index.jsx @@ -1,12 +1,13 @@ import { lazy, memo, useCallback, useEffect, useMemo, useState } from 'react' -import { Navigate, Route, Routes, useParams } from 'react-router-dom' +import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom' -import { WellContext, RootPathContext, useRootPath, useLayoutProps } from '@asb/context' +import { WellContext, RootPathContext, useRootPath, useLayoutProps, TopRightBlockContext } from '@asb/context' import { invokeWebApiWrapperAsync } from '@components/factory' +import { MenuBreadcrumbItems } from '@components/MenuBreadcrumb' import { NoAccessComponent, wrapPrivateComponent } from '@utils' import { WellService } from '@api' -import NavigationMenu from './NavigationMenu' +import { NavigationMenu, menuItems } from './NavigationMenu' import '@styles/index.css' @@ -42,7 +43,10 @@ const WellCompositeEditor = lazy(() => import('./Analytics/WellCompositeEditor') const Well = memo(() => { const { idWell } = useParams() + const location = useLocation() + const [well, setWell] = useState({ id: idWell }) + const [topRightBlock, setTopRightBlock] = useState() const root = useRootPath() const rootPath = useMemo(() => `${root}/well/${idWell}`, [root, idWell]) @@ -71,56 +75,64 @@ const Well = memo(() => { ) }, [idWell]) - useEffect(() => setLayoutProps({ sider: }), [well, setLayoutProps]) + useEffect(() => setLayoutProps({ + sider: , + breadcrumb: , + topRightBlock: topRightBlock, + }), [well, setLayoutProps, topRightBlock]) + + useEffect(() => setTopRightBlock(undefined), [location]) return ( - - } /> - } /> - - }> + + } /> } /> - } /> - } /> - } /> - } /> - } /> - } /> - - }> - } /> - } /> + }> + } /> + } /> - } /> - } /> - - }> - } /> - } /> + } /> + } /> + } /> + } /> + } /> + } /> + + }> + } /> + } /> - } /> - } /> - - }> - } /> - } /> + } /> + } /> + + }> + } /> + } /> - } /> - } /> - } /> - } /> - } /> - } /> - - } /> - } /> - } /> - } /> - + } /> + } /> + + }> + } /> + } /> + + } /> + } /> + } /> + } /> + } /> + } /> + + } /> + } /> + } /> + } /> + + ) diff --git a/src/styles/tvd.less b/src/styles/tvd.less index 6a672a5..9adbda4 100755 --- a/src/styles/tvd.less +++ b/src/styles/tvd.less @@ -6,19 +6,19 @@ min-height: 80vh; .tvd-top { + margin: 0 15px; display: flex; align-items: center; justify-content: space-between; - margin-top: 20px; .tvd-inputs { display: flex; align-items: center; + gap: 15px; .tvd-input-group { display: flex; align-items: center; - margin: 0 15px; & > span { margin-right: 5px;