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;