From 7d8e725e55c5f5eda9f392ee051d0071af79d9d6 Mon Sep 17 00:00:00 2001 From: friedger Date: Sun, 23 Apr 2023 20:22:24 +0200 Subject: [PATCH] fix: use extend window in self-service-extend --- .../components/content-active-pooling.tsx | 9 +++- .../components/self-service-rows.tsx | 32 +++++++++---- .../components/self-service-extend-layout.tsx | 47 ++++++++++++++----- 3 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/pages/stacking/pooled-stacking-info/components/content-active-pooling.tsx b/src/pages/stacking/pooled-stacking-info/components/content-active-pooling.tsx index 99aabc2f..3410c4bd 100644 --- a/src/pages/stacking/pooled-stacking-info/components/content-active-pooling.tsx +++ b/src/pages/stacking/pooled-stacking-info/components/content-active-pooling.tsx @@ -17,6 +17,8 @@ import { import { makeStackingClubRewardAddressLink } from '@utils/external-links'; import { toHumanReadableStx } from '@utils/unit-convert'; +import routes from '@constants/routes'; +import { useNavigate } from 'react-router-dom'; import { Pox2Contracts } from '../../start-pooled-stacking/types-preset-pools'; import { DelegationStatus } from '../get-delegation-status'; import { IncreasePoolingAmount } from './increase-pooling-amount'; @@ -41,6 +43,7 @@ export function ActivePoolingContent({ stackerInfo, }: ActivePoolingContentProps) { const isStacking = stackerInfo.stacked; + const navigate = useNavigate(); const [showIncreasePoolingAmount, setShowIncreasePoolingAmount] = useState(false); const isSelfService = delegationStatusDetails.delegatedTo === Pox2Contracts.WrapperFastPool; return ( @@ -82,7 +85,11 @@ export function ActivePoolingContent({
- {isSelfService && !showIncreasePoolingAmount && } + {isSelfService && !showIncreasePoolingAmount && ( + navigate(routes.SELF_SERVICE_EXTEND)}> + Extend pooled stacking + + )} {showIncreasePoolingAmount ? ( { diff --git a/src/pages/stacking/pooled-stacking-info/components/self-service-rows.tsx b/src/pages/stacking/pooled-stacking-info/components/self-service-rows.tsx index b0b9b776..250ae9cf 100644 --- a/src/pages/stacking/pooled-stacking-info/components/self-service-rows.tsx +++ b/src/pages/stacking/pooled-stacking-info/components/self-service-rows.tsx @@ -1,5 +1,3 @@ -import { useNavigate } from 'react-router-dom'; - import { Button } from '@stacks/ui'; import { @@ -11,12 +9,23 @@ import { useGetCoreInfoQuery, useGetPoxInfoQuery, } from '@components/stacking-client-provider/stacking-client-provider'; -import routes from '@constants/routes'; import { nextExtendWindow } from '../../self-service-extend/utils'; -export function SelfServiceRows() { - const navigate = useNavigate(); +interface SelfServiceRowsProps { + isLoading?: boolean; + onClick: React.MouseEventHandler; + children: React.ReactNode; + showCancleButton?: boolean; + onClose?: React.MouseEventHandler; +} +export function SelfServiceRows({ + isLoading, + onClick, + showCancleButton, + onClose, + children, +}: SelfServiceRowsProps) { const getPoxInfoQuery = useGetPoxInfoQuery(); const getCoreInfoQuery = useGetCoreInfoQuery(); const burnBlockHeight = getCoreInfoQuery.data?.burn_block_height; @@ -41,12 +50,19 @@ export function SelfServiceRows() { {extendWindow.blocksUntilEnd} blocks )} - + + {showCancleButton && ( + + )} diff --git a/src/pages/stacking/self-service-extend/components/self-service-extend-layout.tsx b/src/pages/stacking/self-service-extend/components/self-service-extend-layout.tsx index fdb2cd7c..54357d97 100644 --- a/src/pages/stacking/self-service-extend/components/self-service-extend-layout.tsx +++ b/src/pages/stacking/self-service-extend/components/self-service-extend-layout.tsx @@ -17,6 +17,8 @@ import routes from '@constants/routes'; import { formatPoxAddressToNetwork } from '@utils/stacking'; import { toHumanReadableStx } from '@utils/unit-convert'; +import { SelfServiceRows } from '../../pooled-stacking-info/components/self-service-rows'; +import { nextExtendWindow } from '../utils'; import { Stacker } from './choose-stacker'; import { StackerDetailsRows } from './stacker-details-rows'; @@ -92,18 +94,25 @@ export function SelfServiceLayout(props: SelfServiceLayoutProps) { Lock your STX for the 1 more cycle. )} - - - {!showStackerAddress || showPreview ? ( - - ) : ( - )} - + + )} {!showStackerAddress && ( ; +}