From 72f5eab826c4866ed86853ada807390b24029dbd Mon Sep 17 00:00:00 2001 From: Digberi Date: Wed, 27 Sep 2023 22:28:43 +0300 Subject: [PATCH] block ui for 83 pool --- .../open-new-position/create-new-position.tsx | 48 ++++++++++++++++--- .../v3-item-page/create-new-position.page.tsx | 23 ++++++++- .../use-create-new-position-page.vm.ts | 4 +- .../pages/v3-item-page/use-v3-item-page.vm.ts | 3 +- .../pages/v3-item-page/v3-item-page.tsx | 27 ++++++++++- 5 files changed, 93 insertions(+), 12 deletions(-) diff --git a/src/modules/liquidity/pages/v3-item-page/components/open-new-position/create-new-position.tsx b/src/modules/liquidity/pages/v3-item-page/components/open-new-position/create-new-position.tsx index 8d3bccb41..3284371fd 100644 --- a/src/modules/liquidity/pages/v3-item-page/components/open-new-position/create-new-position.tsx +++ b/src/modules/liquidity/pages/v3-item-page/components/open-new-position/create-new-position.tsx @@ -1,8 +1,9 @@ import { FC, useContext } from 'react'; import cx from 'classnames'; -import { useLocation } from 'react-router-dom'; +import { useLocation, useParams } from 'react-router-dom'; +import { IS_NETWORK_MAINNET } from '@config/config'; import { SLASH } from '@config/constants'; import { ColorModes, ColorThemeContext } from '@providers/color-theme-context'; import { Button, Card } from '@shared/components'; @@ -20,16 +21,51 @@ const modeClass = { export const OpenNewPosition: FC = () => { const { t } = useTranslation(); const { colorThemeMode } = useContext(ColorThemeContext); + const { pathname } = useLocation(); const sanitizedPathname = `/${getRouterParts(pathname).join(SLASH)}`; const url = `${sanitizedPathname}${LiquidityRoutes.create}`; + const params = useParams(); + + const is83 = params?.id === '83' && IS_NETWORK_MAINNET; + return ( - -

{t('liquidity|induceToOpenNewPosition')}

- + + {is83 ? ( +
+

The deposits to the pool are paused.

+
+ ) : ( + <> +

{t('liquidity|induceToOpenNewPosition')}

+ + + )}
); }; diff --git a/src/modules/liquidity/pages/v3-item-page/create-new-position.page.tsx b/src/modules/liquidity/pages/v3-item-page/create-new-position.page.tsx index 79b0e9534..13e147aa2 100644 --- a/src/modules/liquidity/pages/v3-item-page/create-new-position.page.tsx +++ b/src/modules/liquidity/pages/v3-item-page/create-new-position.page.tsx @@ -6,7 +6,7 @@ import { OpenNewPositionForm, PageTitleContainer, PoolDetailsCreate, PositionFor import { useCreateNewPositionPageViewModel } from './use-create-new-position-page.vm'; export const CreateNewPositionPage = observer(() => { - const { titleText, backHref, ...formProps } = useCreateNewPositionPageViewModel(); + const { titleText, backHref, isBlocked, ...formProps } = useCreateNewPositionPageViewModel(); return ( <> @@ -14,7 +14,26 @@ export const CreateNewPositionPage = observer(() => { - + {isBlocked ? ( +
+

The deposits to the pool are paused.

+
+ ) : ( + + )}
diff --git a/src/modules/liquidity/pages/v3-item-page/use-create-new-position-page.vm.ts b/src/modules/liquidity/pages/v3-item-page/use-create-new-position-page.vm.ts index 870061eeb..9ee1bf832 100644 --- a/src/modules/liquidity/pages/v3-item-page/use-create-new-position-page.vm.ts +++ b/src/modules/liquidity/pages/v3-item-page/use-create-new-position-page.vm.ts @@ -2,6 +2,7 @@ import { useEffect, useMemo } from 'react'; import BigNumber from 'bignumber.js'; +import { IS_NETWORK_MAINNET } from '@config/config'; import { ZERO_AMOUNT_BN } from '@config/constants'; import { useGetLiquidityV3ItemWithPositions, @@ -109,6 +110,7 @@ export const useCreateNewPositionPageViewModel = () => { rangeInputsProps, titleText: t('liquidity|createPosition'), backHref, - warningMessages + warningMessages, + isBlocked: poolStore.poolId?.toFixed() === '83' && IS_NETWORK_MAINNET }; }; diff --git a/src/modules/liquidity/pages/v3-item-page/use-v3-item-page.vm.ts b/src/modules/liquidity/pages/v3-item-page/use-v3-item-page.vm.ts index 8ee58d3a5..c61520f60 100644 --- a/src/modules/liquidity/pages/v3-item-page/use-v3-item-page.vm.ts +++ b/src/modules/liquidity/pages/v3-item-page/use-v3-item-page.vm.ts @@ -2,6 +2,7 @@ import { useEffect } from 'react'; import { useParams } from 'react-router-dom'; +import { IS_NETWORK_MAINNET } from '@config/config'; import { useLiquidityV3PoolStore, useLiquidityV3ItemTokens, @@ -35,5 +36,5 @@ export const useV3ItemPageViewModel = () => { void v3PositionsStore.positionsStore.load(); }, [getLiquidityV3ItemBalances, getLiquidityV3Pool, v3PositionsStore.positionsStore, poolId, tabId]); - return { isLoading, error, isAddLiqForm, tabId }; + return { isLoading, error, isAddLiqForm, tabId, isBlocked: poolId?.toFixed() === '83' && IS_NETWORK_MAINNET }; }; diff --git a/src/modules/liquidity/pages/v3-item-page/v3-item-page.tsx b/src/modules/liquidity/pages/v3-item-page/v3-item-page.tsx index 2d0958199..4b834139a 100644 --- a/src/modules/liquidity/pages/v3-item-page/v3-item-page.tsx +++ b/src/modules/liquidity/pages/v3-item-page/v3-item-page.tsx @@ -15,7 +15,7 @@ import styles from './v3-item-page.module.scss'; export const V3ItemPage: FC = observer(() => { const { t } = useTranslation(); - const { isLoading, isAddLiqForm, tabId } = useV3ItemPageViewModel(); + const { isLoading, isAddLiqForm, tabId, isBlocked } = useV3ItemPageViewModel(); return ( <> @@ -28,7 +28,30 @@ export const V3ItemPage: FC = observer(() => { - {isAddLiqForm ? : } + {isAddLiqForm ? ( + isBlocked ? ( +
+

The deposits to the pool are paused.

+
+ ) : ( + + ) + ) : ( + + )}