From 14fdd7a141f1166ddbb2a2938f60a3bff3e08ffa Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Wed, 17 Jul 2024 22:16:12 +0200 Subject: [PATCH] frontend/dialog: remove disableEscape param, use onClose instead If onClose is undefined, there is on close button, and ESC should then also not work, and vice versa. This also fixes some dialogs that could be escaped via ESC that shouldn't have, like the BB02 backup check dialog. --- frontends/web/src/components/dialog/dialog.tsx | 6 ++---- frontends/web/src/routes/account/receive/receive-bb01.tsx | 1 - frontends/web/src/routes/account/receive/receive.tsx | 3 +-- frontends/web/src/routes/buy/pocket.tsx | 1 - 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/frontends/web/src/components/dialog/dialog.tsx b/frontends/web/src/components/dialog/dialog.tsx index fe8b877d00..f6cfe11401 100644 --- a/frontends/web/src/components/dialog/dialog.tsx +++ b/frontends/web/src/components/dialog/dialog.tsx @@ -28,7 +28,6 @@ type TProps = { large?: boolean; slim?: boolean; centered?: boolean; - disableEscape?: boolean; onClose?: (e?: Event) => void; children: React.ReactNode; open: boolean; @@ -41,7 +40,6 @@ export const Dialog = ({ large, slim, centered, - disableEscape, onClose, children, open, @@ -169,10 +167,10 @@ export const Dialog = ({ if (!renderDialog) { return; } - if (!disableEscape) { + if (onClose !== undefined) { deactivate(true); } - }, [renderDialog, disableEscape, deactivate])); + }, [renderDialog, onClose, deactivate])); useEffect(() => { if (open) { diff --git a/frontends/web/src/routes/account/receive/receive-bb01.tsx b/frontends/web/src/routes/account/receive/receive-bb01.tsx index 361e509575..c91ba7cdcb 100644 --- a/frontends/web/src/routes/account/receive/receive-bb01.tsx +++ b/frontends/web/src/routes/account/receive/receive-bb01.tsx @@ -252,7 +252,6 @@ export const Receive = ({
{account && <> diff --git a/frontends/web/src/routes/account/receive/receive.tsx b/frontends/web/src/routes/account/receive/receive.tsx index 741dd2f67c..10f4b394f7 100644 --- a/frontends/web/src/routes/account/receive/receive.tsx +++ b/frontends/web/src/routes/account/receive/receive.tsx @@ -291,9 +291,8 @@ export const Receive = ({ { setVerifying(false); } : undefined} diff --git a/frontends/web/src/routes/buy/pocket.tsx b/frontends/web/src/routes/buy/pocket.tsx index b64f028a21..ca9ce56d3f 100644 --- a/frontends/web/src/routes/buy/pocket.tsx +++ b/frontends/web/src/routes/buy/pocket.tsx @@ -245,7 +245,6 @@ export const Pocket = ({ code }: TProps) => {
{t('buy.pocket.verifyBitBox02')}