From 0632a17021d86fb53d997524cbc5f18e20137b29 Mon Sep 17 00:00:00 2001 From: Govard Barkhatov Date: Mon, 12 Aug 2024 21:08:51 +0200 Subject: [PATCH 1/2] fix: Refetch UTXOs on unsuccessful staking (#64) * no cancel * proper noCancel pass * partly reset --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yaml | 8 ++++---- src/app/components/Modals/ErrorModal.tsx | 18 +++++++++++------- src/app/components/Staking/Staking.tsx | 11 ++++++++++- src/app/context/Error/ErrorContext.tsx | 18 +++++++++++++----- src/app/page.tsx | 11 +++++++++-- src/app/types/errors.ts | 1 + 7 files changed, 50 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7083d434..b3976930 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,11 +3,11 @@ name: ci on: pull_request: branches: - - '**' + - "**" jobs: lint_test: uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@v0.3.0 with: run-build: true - run-unit-tests: true \ No newline at end of file + run-unit-tests: true diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 96ed64c2..2c9f4030 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,10 +3,10 @@ name: docker_publish on: push: branches: - - 'main' - - 'dev' + - "main" + - "dev" tags: - - '*' + - "*" jobs: lint_test: @@ -14,7 +14,7 @@ jobs: with: run-build: true run-unit-tests: true - + docker_build: needs: [lint_test] runs-on: ubuntu-22.04 diff --git a/src/app/components/Modals/ErrorModal.tsx b/src/app/components/Modals/ErrorModal.tsx index 54660034..20331e28 100644 --- a/src/app/components/Modals/ErrorModal.tsx +++ b/src/app/components/Modals/ErrorModal.tsx @@ -12,6 +12,7 @@ interface ErrorModalProps { errorMessage: string; errorState?: ErrorState; errorTime: Date; + noCancel?: boolean; } export const ErrorModal: React.FC = ({ @@ -20,7 +21,8 @@ export const ErrorModal: React.FC = ({ onRetry, errorMessage, errorState, - errorTime, + noCancel, + // errorTime, // This prop is not used in the component }) => { const { error, retryErrorAction } = useError(); @@ -93,12 +95,14 @@ export const ErrorModal: React.FC = ({

{getErrorMessage()}

- + {!noCancel && ( // Only show the cancel button if noCancel is false or undefined + + )} {onRetry && (
)} -
-

- {maxDecimals(satoshiToBtc(stakingValueSat), 8)} {coinName} +

+
+ +

+ {maxDecimals(satoshiToBtc(stakingValueSat), 8)} {coinName} +

+
+

+ {durationTillNow(startTimestamp, currentTime)}

-

{durationTillNow(startTimestamp, currentTime)}

-
+ + {/* Future data placeholder */} +
{/* we need to center the text without the tooltip add its size 12px and gap 4px, 16/2 = 8px */} -
+

{renderState()}

= ({
- {generateActionButton()} +
{generateActionButton()}
);