Исправлено название для контекста списка месторождений

This commit is contained in:
Александр Сироткин 2022-12-05 20:39:14 +05:00
parent cb8be79274
commit dc0f80fee5
5 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
import { memo, useEffect, useState } from 'react' import { memo, useEffect, useState } from 'react'
import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom'
import { DepositsContext } from '@asb/context' import { DepositListContext } from '@asb/context'
import LoaderPortal from '@components/LoaderPortal' import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory' import { invokeWebApiWrapperAsync } from '@components/factory'
import { DepositDto, DepositService } from '@api' import { DepositDto, DepositService } from '@api'
@ -24,11 +24,11 @@ export const DepositsOutlet = memo(() => {
}, []) }, [])
return ( return (
<DepositsContext.Provider value={deposits}> <DepositListContext.Provider value={deposits}>
<LoaderPortal show={isLoading}> <LoaderPortal show={isLoading}>
<Outlet /> <Outlet />
</LoaderPortal> </LoaderPortal>
</DepositsContext.Provider> </DepositListContext.Provider>
) )
}) })

View File

@ -1,7 +1,7 @@
import { Tag, TreeSelect } from 'antd' import { Tag, TreeSelect } from 'antd'
import { memo, useEffect, useState } from 'react' import { memo, useEffect, useState } from 'react'
import { useDeposits } from '@asb/context' import { useDepositList } from '@asb/context'
import { invokeWebApiWrapperAsync } from '@components/factory' import { invokeWebApiWrapperAsync } from '@components/factory'
import { hasPermission } from '@utils' import { hasPermission } from '@utils'
@ -39,7 +39,7 @@ export const WellSelector = memo(({ value, onChange, treeData, treeLabels, ...ot
const [wellsTree, setWellsTree] = useState([]) const [wellsTree, setWellsTree] = useState([])
const [wellLabels, setWellLabels] = useState([]) const [wellLabels, setWellLabels] = useState([])
const deposits = useDeposits() const deposits = useDepositList()
useEffect(() => { useEffect(() => {
invokeWebApiWrapperAsync( invokeWebApiWrapperAsync(

View File

@ -2,7 +2,7 @@ import { Drawer, Tree, TreeDataNode, TreeProps } from 'antd'
import { useState, useEffect, useCallback, memo, Key, useMemo } from 'react' import { useState, useEffect, useCallback, memo, Key, useMemo } from 'react'
import { useNavigate, useLocation } from 'react-router-dom' import { useNavigate, useLocation } from 'react-router-dom'
import { useDeposits } from '@asb/context' import { useDepositList } from '@asb/context'
import { WellIcon, WellIconState } from '@components/icons' import { WellIcon, WellIconState } from '@components/icons'
import { DepositDto, WellDto } from '@api' import { DepositDto, WellDto } from '@api'
import { isRawDate } from '@utils' import { isRawDate } from '@utils'
@ -126,7 +126,7 @@ export const WellTreeSelector = memo<WellTreeSelectorProps>(({ expand, current,
const navigate = useNavigate() const navigate = useNavigate()
const location = useLocation() const location = useLocation()
const deposits = useDeposits() const deposits = useDepositList()
const wellsTree = useMemo(() => makeWellsTreeData(deposits), [deposits]) const wellsTree = useMemo(() => makeWellsTreeData(deposits), [deposits])

View File

@ -14,7 +14,7 @@ export const LayoutPropsContext = createContext<(props: LayoutPortalProps) => vo
/** Контекст для блока справа от крошек на страницах скважин и админки */ /** Контекст для блока справа от крошек на страницах скважин и админки */
export const TopRightBlockContext = createContext<(block: JSX.Element) => void>(() => {}) export const TopRightBlockContext = createContext<(block: JSX.Element) => void>(() => {})
/** Контекст со списком месторождений */ /** Контекст со списком месторождений */
export const DepositsContext = createContext<DepositDto[]>([]) export const DepositListContext = createContext<DepositDto[]>([])
/** /**
* Получить текущую скважину * Получить текущую скважину
@ -42,7 +42,7 @@ export const useUser = () => useContext(UserContext)
* *
* @returns Список скважин * @returns Список скважин
*/ */
export const useDeposits = () => useContext(DepositsContext) export const useDepositList = () => useContext(DepositListContext)
/** /**
* Получить метод задания элементов справа от крошек * Получить метод задания элементов справа от крошек

View File

@ -3,7 +3,7 @@ import { Link, useLocation } from 'react-router-dom'
import { Map, Overlay } from 'pigeon-maps' import { Map, Overlay } from 'pigeon-maps'
import { Popover, Badge } from 'antd' import { Popover, Badge } from 'antd'
import { useDeposits, useLayoutProps } from '@asb/context' import { useDepositList, useLayoutProps } from '@asb/context'
import { PointerIcon } from '@components/icons' import { PointerIcon } from '@components/icons'
import { FastRunMenu } from '@components/FastRunMenu' import { FastRunMenu } from '@components/FastRunMenu'
import { limitValue, withPermissions } from '@utils' import { limitValue, withPermissions } from '@utils'
@ -38,7 +38,7 @@ const calcViewParams = (clusters) => {
} }
const Deposit = memo(() => { const Deposit = memo(() => {
const deposits = useDeposits() const deposits = useDepositList()
const setLayoutProps = useLayoutProps() const setLayoutProps = useLayoutProps()
const location = useLocation() const location = useLocation()