forked from ddrilling/asb_cloud_front
* Добавленна ссылка на месторождение в подсказке значка на карте
* Исправлено выделение месторождения в селекторе
This commit is contained in:
parent
4dd57aff98
commit
17d7b7c41d
@ -67,7 +67,15 @@ const Map = memo(() => {
|
||||
|
||||
return (
|
||||
<Overlay width={32} anchor={anchor} key={anchor.join(' ')}>
|
||||
<Popover content={links} trigger={['click']} title={deposit.caption}>
|
||||
<Popover
|
||||
content={links}
|
||||
trigger={['click']}
|
||||
title={(
|
||||
<Link to={{ pathname: `/deposit/${deposit.id}` }}>
|
||||
{deposit.caption}
|
||||
</Link>
|
||||
)}
|
||||
>
|
||||
<div className={'pointer'}>
|
||||
<Badge count={deposit.clusters.length}>
|
||||
<PointerIcon state={'active'} width={48} height={59} />
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom'
|
||||
import { Navigate, Route, Routes, useParams } from 'react-router-dom'
|
||||
import { lazy, memo, useEffect, useMemo } from 'react'
|
||||
|
||||
import { DepositContext, RootPathContext, useDepositList, useLayoutProps, useRootPath } from '@asb/context'
|
||||
@ -10,11 +10,13 @@ const DepositNavigationMenu = lazy(() => import('./DepositNavigationMenu'))
|
||||
|
||||
const Deposit = memo(() => {
|
||||
const { '*': param } = useParams()
|
||||
const location = useLocation()
|
||||
|
||||
const setLayoutProps = useLayoutProps()
|
||||
const deposits = useDepositList()
|
||||
|
||||
const root = useRootPath()
|
||||
const rootPath = useMemo(() => `${root}/deposit`, [root])
|
||||
|
||||
const idDeposit = useMemo(() => {
|
||||
const result = /^([^\/#?]+)/.exec(param)
|
||||
return result && result[1] !== 'null' ? Number(result[1]) : null
|
||||
@ -22,15 +24,12 @@ const Deposit = memo(() => {
|
||||
|
||||
const deposit = useMemo(() => deposits.find((deposit) => deposit.id === idDeposit) || null, [deposits, idDeposit])
|
||||
|
||||
const root = useRootPath()
|
||||
const rootPath = useMemo(() => `${root}/deposit`, [root])
|
||||
|
||||
useEffect(() => {
|
||||
const hasId = location.pathname.length > '/deposit/'.length
|
||||
const key = idDeposit ? `/deposit/${idDeposit}` : null
|
||||
|
||||
const selectorProps = {
|
||||
expand: hasId ? [location.pathname] : true,
|
||||
current: hasId ? location.pathname : undefined,
|
||||
expand: key ? [key] : true,
|
||||
current: key || undefined,
|
||||
}
|
||||
|
||||
setLayoutProps({
|
||||
@ -40,7 +39,7 @@ const Deposit = memo(() => {
|
||||
selectorProps,
|
||||
title: 'Месторождение',
|
||||
})
|
||||
}, [setLayoutProps, location.pathname, deposit])
|
||||
}, [setLayoutProps, idDeposit])
|
||||
|
||||
return (
|
||||
<RootPathContext.Provider value={rootPath}>
|
||||
|
Loading…
Reference in New Issue
Block a user