From ca07c234c4bc408e99536ac8edae29b0187cb590 Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Fri, 13 Sep 2024 00:13:51 +0200 Subject: [PATCH 1/8] fix: do not close quick freeze modal while loading --- src/components/Send/ShowUtxos.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Send/ShowUtxos.tsx b/src/components/Send/ShowUtxos.tsx index 51898b344..37738ee09 100755 --- a/src/components/Send/ShowUtxos.tsx +++ b/src/components/Send/ShowUtxos.tsx @@ -212,9 +212,9 @@ const ShowUtxos = ({ isOpen, onCancel, onConfirm, isLoading, utxos, alert }: Sho @@ -274,6 +274,7 @@ const ShowUtxos = ({ isOpen, onCancel, onConfirm, isLoading, utxos, alert }: Sho onCancel()} + disabled={isLoading} className="d-flex flex-1 justify-content-center align-items-center" > From a9f58427c18d419db38b707d88e94f38028ddc13 Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Fri, 13 Sep 2024 00:23:44 +0200 Subject: [PATCH 2/8] fix: remove width of Confirmations component --- src/components/utxo/Confirmations.module.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/utxo/Confirmations.module.css b/src/components/utxo/Confirmations.module.css index 26bbd2ccd..8409d7581 100644 --- a/src/components/utxo/Confirmations.module.css +++ b/src/components/utxo/Confirmations.module.css @@ -1,10 +1,7 @@ .confirmations { - width: 2rem; display: flex; flex-direction: column; justify-content: center; align-items: center; - padding: 0.1rem 0.2rem; - border-radius: 0.2rem; font-size: 0.75rem; } From 288fd98598cd137586ef329228c4ca32b9277f9a Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Fri, 13 Sep 2024 00:35:12 +0200 Subject: [PATCH 3/8] ui(send): monospace font for addresses --- src/components/Send/ShowUtxos.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Send/ShowUtxos.tsx b/src/components/Send/ShowUtxos.tsx index 37738ee09..f22184c05 100755 --- a/src/components/Send/ShowUtxos.tsx +++ b/src/components/Send/ShowUtxos.tsx @@ -78,7 +78,7 @@ const UtxoRow = ({ utxo, onToggle, settings, walletInfo, t }: UtxoRowProps) => { - + ( From 9b752d71594d9ac4b83398814044642944c5249e Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Tue, 17 Sep 2024 13:04:39 +0200 Subject: [PATCH 4/8] ui(send): add description to UTXOs section in confirm modal --- src/components/PaymentConfirmModal.tsx | 7 +++++-- src/i18n/locales/en/translation.json | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/PaymentConfirmModal.tsx b/src/components/PaymentConfirmModal.tsx index 73ce0fd50..6a2677ad0 100644 --- a/src/components/PaymentConfirmModal.tsx +++ b/src/components/PaymentConfirmModal.tsx @@ -69,13 +69,16 @@ const ReviewConsideredUtxos = ({ utxos }: ReviewConsideredUtxosProps) => { return ( - {t('show_utxos.considered_utxos')} + {t('send.confirm_send_modal.label_considered_utxos')} setIsOpen((current) => !current)} /> - + +
+ {t('send.confirm_send_modal.description_considered_utxos')} +
Date: Tue, 17 Sep 2024 13:28:50 +0200 Subject: [PATCH 5/8] ui(send): proper label for UTXOs on sweeps --- src/components/PaymentConfirmModal.tsx | 35 +++++++++++++++----------- src/components/Send/index.tsx | 2 +- src/i18n/locales/en/translation.json | 5 +++- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/components/PaymentConfirmModal.tsx b/src/components/PaymentConfirmModal.tsx index 6a2677ad0..26994a7d7 100644 --- a/src/components/PaymentConfirmModal.tsx +++ b/src/components/PaymentConfirmModal.tsx @@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next' import * as rb from 'react-bootstrap' import Sprite from './Sprite' import Balance from './Balance' -import { useSettings } from '../context/SettingsContext' +import { Settings, useSettings } from '../context/SettingsContext' import { FeeValues, TxFee, useEstimatedMaxCollaboratorFee } from '../hooks/Fees' import { ConfirmModal, ConfirmModalProps } from './Modal' import { AmountSats, BitcoinAddress } from '../libs/JmWalletApi' @@ -11,7 +11,7 @@ import { jarInitial } from './jars/Jar' import { isValidNumber } from '../utils' import styles from './PaymentConfirmModal.module.css' import { Utxos } from '../context/WalletContext' -import { SelectableUtxo, UtxoListDisplay } from './Send/ShowUtxos' +import { UtxoListDisplay } from './Send/ShowUtxos' import Divider from './Divider' const feeRange: (txFee: TxFee, txFeeFactor: number) => [number, number] = (txFee, txFeeFactor) => { @@ -58,18 +58,23 @@ const useMiningFeeText = ({ tx_fees, tx_fees_factor }: Pick> & { + settings: Settings } -const ReviewConsideredUtxos = ({ utxos }: ReviewConsideredUtxosProps) => { + +const ReviewUtxos = ({ settings, availableUtxos, isSweep }: ReviewUtxosProps) => { const { t } = useTranslation() - const settings = useSettings() - const [isOpen, setIsOpen] = useState(false) + const [isOpen, setIsOpen] = useState(availableUtxos.length === 1) + const allUtxosAreUsed = isSweep || availableUtxos.length === 1 return ( - {t('send.confirm_send_modal.label_considered_utxos')} + + {allUtxosAreUsed + ? t('send.confirm_send_modal.label_selected_utxos') + : t('send.confirm_send_modal.label_considered_utxos')} + setIsOpen((current) => !current)} /> @@ -77,10 +82,12 @@ const ReviewConsideredUtxos = ({ utxos }: ReviewConsideredUtxosProps) => {
- {t('send.confirm_send_modal.description_considered_utxos')} + {allUtxosAreUsed + ? t('send.confirm_send_modal.description_selected_utxos', { count: availableUtxos.length }) + : t('send.confirm_send_modal.description_considered_utxos')}
({ ...it, checked: false, selectable: false }))} settings={settings} onToggle={() => { // No-op since these UTXOs are only for review and are not selectable @@ -101,7 +108,7 @@ interface PaymentDisplayInfo { numCollaborators?: number feeConfigValues?: FeeValues showPrivacyInfo?: boolean - consideredUtxos?: Utxos + availableUtxos?: Utxos } interface PaymentConfirmModalProps extends ConfirmModalProps { @@ -118,7 +125,7 @@ export function PaymentConfirmModal({ numCollaborators, feeConfigValues, showPrivacyInfo = true, - consideredUtxos = [], + availableUtxos = [], }, children, ...confirmModalProps @@ -246,8 +253,8 @@ export function PaymentConfirmModal({
)} - {consideredUtxos.length !== 0 && ( - ({ ...it, checked: false, selectable: false }))} /> + {availableUtxos.length > 0 && ( + )} {children && ( diff --git a/src/components/Send/index.tsx b/src/components/Send/index.tsx index 1441aeb91..d1b45358c 100644 --- a/src/components/Send/index.tsx +++ b/src/components/Send/index.tsx @@ -521,7 +521,7 @@ export default function Send({ wallet }: SendProps) { isCoinjoin: showConfirmSendModal.isCoinJoin, numCollaborators: showConfirmSendModal.numCollaborators!, feeConfigValues: { ...feeConfigValues, tx_fees: showConfirmSendModal.txFee }, - consideredUtxos: (walletInfo?.utxosByJar[showConfirmSendModal.sourceJarIndex!] || []) + availableUtxos: (walletInfo?.utxosByJar[showConfirmSendModal.sourceJarIndex!] || []) .filter((utxo) => !utxo.frozen) .sort((a, b) => a.confirmations - b.confirmations), }} diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 4a9eede50..bb10c962e 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -353,7 +353,10 @@ "text_miner_fee_in_targeted_blocks_one": "High priority estimate (next block)", "text_miner_fee_in_targeted_blocks_other": "Using estimate for inclusion in next {{ count }} blocks", "label_considered_utxos": "Considered UTXOs", - "description_considered_utxos": "One or more of the following UTXOs are taken into account to create the transaction." + "description_considered_utxos": "One or more of the following UTXOs will be used to create the transaction: ", + "label_selected_utxos": "Selected UTXOs", + "description_selected_utxos_one": "The following UTXO will used to create the transaction: ", + "description_selected_utxos_other": "The following UTXOs will used to create the transaction: " }, "confirm_abort_modal": { "title": "Abort payment", From 766a0ffca7f0bf9ebec744672a7295f7f42e7d92 Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Tue, 17 Sep 2024 14:09:09 +0200 Subject: [PATCH 6/8] ui(send): improve phrasing in Quick Freeze and Confirm modal --- src/components/PaymentConfirmModal.tsx | 4 ++-- src/components/Send/ShowUtxos.tsx | 9 ++++----- src/components/Send/SourceJarSelector.tsx | 2 +- src/i18n/locales/en/translation.json | 18 ++++++++++-------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/components/PaymentConfirmModal.tsx b/src/components/PaymentConfirmModal.tsx index 26994a7d7..6ff551a38 100644 --- a/src/components/PaymentConfirmModal.tsx +++ b/src/components/PaymentConfirmModal.tsx @@ -73,7 +73,7 @@ const ReviewUtxos = ({ settings, availableUtxos, isSweep }: ReviewUtxosProps) => {allUtxosAreUsed ? t('send.confirm_send_modal.label_selected_utxos') - : t('send.confirm_send_modal.label_considered_utxos')} + : t('send.confirm_send_modal.label_eligible_utxos')}
@@ -84,7 +84,7 @@ const ReviewUtxos = ({ settings, availableUtxos, isSweep }: ReviewUtxosProps) =>
{allUtxosAreUsed ? t('send.confirm_send_modal.description_selected_utxos', { count: availableUtxos.length }) - : t('send.confirm_send_modal.description_considered_utxos')} + : t('send.confirm_send_modal.description_eligible_utxos')}
({ ...it, checked: false, selectable: false }))} diff --git a/src/components/Send/ShowUtxos.tsx b/src/components/Send/ShowUtxos.tsx index f22184c05..98b8c6a6b 100755 --- a/src/components/Send/ShowUtxos.tsx +++ b/src/components/Send/ShowUtxos.tsx @@ -212,7 +212,7 @@ const ShowUtxos = ({ isOpen, onCancel, onConfirm, isLoading, utxos, alert }: Sho ) : ( <> - - {upperUtxos.length > 0 - ? t('show_utxos.show_utxo_subtitle') - : t('show_utxos.show_utxo_subtitle_when_allutxos_are_frozen')} + +
{t('show_utxos.subtitle', { count: selectedUtxos.length })}
+
{t('show_utxos.text_subtitle_addon')}
{alert && ( diff --git a/src/components/Send/SourceJarSelector.tsx b/src/components/Send/SourceJarSelector.tsx index 34a061618..07be79cf9 100644 --- a/src/components/Send/SourceJarSelector.tsx +++ b/src/components/Send/SourceJarSelector.tsx @@ -110,7 +110,7 @@ export const SourceJarSelector = ({ return (
Date: Tue, 17 Sep 2024 14:19:24 +0200 Subject: [PATCH 7/8] send(ui): align confirmation block with divider toggle button --- src/components/Send/ShowUtxos.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/Send/ShowUtxos.tsx b/src/components/Send/ShowUtxos.tsx index 98b8c6a6b..3b76144dd 100755 --- a/src/components/Send/ShowUtxos.tsx +++ b/src/components/Send/ShowUtxos.tsx @@ -35,16 +35,12 @@ interface UtxoRowProps { settings: Settings walletInfo: WalletInfo t: TFunction - // TODO: remove - showBackgroundColor?: boolean } interface UtxoListDisplayProps { utxos: SelectableUtxo[] onToggle: (utxo: SelectableUtxo) => void settings: Settings - // TODO: remove - showBackgroundColor?: boolean } const UtxoRow = ({ utxo, onToggle, settings, walletInfo, t }: UtxoRowProps) => { @@ -113,7 +109,7 @@ type SelectableUtxoTableRowData = SelectableUtxo & Pick Date: Tue, 17 Sep 2024 23:35:33 +0200 Subject: [PATCH 8/8] review(send): plural for utxo label in Payment Confirm Modal --- src/components/PaymentConfirmModal.tsx | 4 ++-- src/i18n/locales/en/translation.json | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/PaymentConfirmModal.tsx b/src/components/PaymentConfirmModal.tsx index 6ff551a38..d5202ad4e 100644 --- a/src/components/PaymentConfirmModal.tsx +++ b/src/components/PaymentConfirmModal.tsx @@ -69,10 +69,10 @@ const ReviewUtxos = ({ settings, availableUtxos, isSweep }: ReviewUtxosProps) => const allUtxosAreUsed = isSweep || availableUtxos.length === 1 return ( - + {allUtxosAreUsed - ? t('send.confirm_send_modal.label_selected_utxos') + ? t('send.confirm_send_modal.label_selected_utxos', { count: availableUtxos.length }) : t('send.confirm_send_modal.label_eligible_utxos')} diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index b4eb6d179..f3698e40b 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -354,9 +354,10 @@ "text_miner_fee_in_targeted_blocks_other": "Using estimate for inclusion in next {{ count }} blocks", "label_eligible_utxos": "Eligible UTXOs", "description_eligible_utxos": "One or more of the following UTXOs will be included in the transaction: ", - "label_selected_utxos": "Selected UTXOs", - "description_selected_utxos_one": "The following UTXO will be included the transaction: ", - "description_selected_utxos_other": "The following UTXOs will be included the transaction: " + "label_selected_utxos_one": "Selected UTXO", + "label_selected_utxos_other": "Selected UTXOs", + "description_selected_utxos_one": "The following UTXO will be included in the transaction: ", + "description_selected_utxos_other": "The following UTXOs will be included in the transaction: " }, "confirm_abort_modal": { "title": "Abort payment",