From 376f5951702691f926bca5e9b285dbaa18a56269 Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Sun, 8 Oct 2023 18:30:26 +0200 Subject: [PATCH] chore(ui): scroll to page top after successful payment --- src/components/Send/index.tsx | 4 +++- src/utils.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Send/index.tsx b/src/components/Send/index.tsx index a10099319..1898219b9 100644 --- a/src/components/Send/index.tsx +++ b/src/components/Send/index.tsx @@ -25,7 +25,7 @@ import { buildCoinjoinRequirementSummary } from '../../hooks/CoinjoinRequirement import { routes } from '../../constants/routes' import { JM_MINIMUM_MAKERS_DEFAULT } from '../../constants/config' -import { SATS, formatSats, isValidNumber } from '../../utils' +import { SATS, formatSats, isValidNumber, scrollToTop } from '../../utils' import { enhanceDirectPaymentErrorMessageIfNecessary, @@ -477,6 +477,8 @@ export default function Send({ wallet }: SendProps) { setIsSweep(false) form.reset() + + scrollToTop() } } } diff --git a/src/utils.ts b/src/utils.ts index de6d44cbe..0f834e035 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -92,3 +92,5 @@ export const toSemVer = (raw?: string): SemVer => { raw, } } + +export const scrollToTop = () => window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })