Skip to content

Commit 01d3b70

Browse files
committed
frontend: fix tx details behaviour
1. Focus trap to include dialog's header for tx detail dialog. This way, the note input doesn't get auto focused. 2. Changed translations: Send to Sent, and Receive to Received
1 parent 8664a07 commit 01d3b70

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

frontends/web/src/components/dialog/dialog.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type TProps = {
3131
onClose?: () => void;
3232
children: React.ReactNode;
3333
open: boolean;
34+
focusTrapIncludesHeader?: boolean;
3435
};
3536

3637
export const Dialog = ({
@@ -43,6 +44,7 @@ export const Dialog = ({
4344
onClose,
4445
children,
4546
open,
47+
focusTrapIncludesHeader = false,
4648
}: TProps) => {
4749
const [isVisible, setIsVisible] = useState(false);
4850
const [status, setStatus] = useState<'idle' | 'opening' | 'open' | 'closing'>('idle');
@@ -165,7 +167,7 @@ export const Dialog = ({
165167
className={overlayClass}
166168
>
167169
<UseBackButton handler={closeHandler} />
168-
<div className={modalClass}>
170+
<div className={modalClass} ref={focusTrapIncludesHeader ? contentRef : undefined}>
169171
{title && (
170172
<div className={headerClass}>
171173
<h3 className={style.title}>{title}</h3>
@@ -177,7 +179,7 @@ export const Dialog = ({
177179
)}
178180
</div>
179181
)}
180-
<div className={contentClass} ref={contentRef}>
182+
<div className={contentClass} ref={!focusTrapIncludesHeader ? contentRef : undefined}>
181183
<div className={style.content}>{children}</div>
182184
</div>
183185
</div>

frontends/web/src/components/transactions/components/tx-detail-dialog/tx-detail-dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ export const TxDetailsDialog = ({
8787
title={t('transaction.details.title')}
8888
onClose={onClose}
8989
slim
90-
medium>
90+
medium
91+
focusTrapIncludesHeader>
9192
{transactionInfo && (
9293
<div className={styles.container}>
9394
<TxDetailHeader

frontends/web/src/components/transactions/components/tx-detail-dialog/tx-detail-header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ const StatusAndSign = ({
8888
const fromSignToText = () => {
8989
switch (type) {
9090
case 'send':
91-
return t('generic.send');
91+
return t('generic.sent');
9292
case 'receive':
93-
return t('generic.receiveWithoutCoinCode');
93+
return t('generic.received');
9494
case 'send_to_self':
9595
return t('transaction.details.sendToSelf');
9696
}

frontends/web/src/locales/en/app.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@
887887
"paymentRequestNote": "{{name}} payment {{orderId}}",
888888
"receive": "Receive {{coinCode}}",
889889
"receiveWithoutCoinCode": "Receive",
890+
"received": "Received",
890891
"receive_bitcoin": "Receive Bitcoin",
891892
"receive_crypto": "Receive crypto",
892893
"reset": "Reset",
@@ -897,6 +898,7 @@
897898
"sell_bitcoin": "Sell Bitcoin",
898899
"sell_crypto": "Sell crypto",
899900
"send": "Send",
901+
"sent": "Sent",
900902
"spend_bitcoin": "Spend bitcoin",
901903
"spend_crypto": "Spend crypto"
902904
},
@@ -1993,4 +1995,4 @@
19931995
"message": "Please connect your BitBox and tap the side to continue.",
19941996
"title": "Welcome"
19951997
}
1996-
}
1998+
}

0 commit comments

Comments
 (0)