From 995e8ab7f0e62e84496bb7340873acc2bc52d46a Mon Sep 17 00:00:00 2001 From: Manolis Mandrapilias <70536101+moneymanolis@users.noreply.github.com> Date: Tue, 14 Feb 2023 18:49:33 +0100 Subject: [PATCH] UIUX: change rbf popup if spectrum connection is used (#2203) --- .../specter/templates/includes/tx-row.html | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/src/cryptoadvance/specter/templates/includes/tx-row.html b/src/cryptoadvance/specter/templates/includes/tx-row.html index b28da5e3d..3d17d7868 100644 --- a/src/cryptoadvance/specter/templates/includes/tx-row.html +++ b/src/cryptoadvance/specter/templates/includes/tx-row.html @@ -410,34 +410,42 @@ } // TODO: get fee diff from specter newFee += 2; - txDataPopup.innerHTML = ` -
-
-

${rbfType == 'cancel' ? '{{ _("Cancel") }}' : '{{ _("Speed up transaction") }}'}

-

{{ _("You can") }} ${rbfType == 'cancel' ? `{{ _("cancel") }}` : `{{ _("speed up") }}`} {{ _("the transaction by increasing its fee rate") }}${rbfType == 'cancel' ? ` {{ _("and sending the funds back to yourself") }}` : ''}:

- - sat/vbyte - - - {{ _("Advanced") }} {% if show_advanced_settings %}▼{% else %}▶{% endif %} - -
-
- `; - txDataPopup.querySelector('.toggle_advanced_rbf').onclick = () => { - let advancedButton = txDataPopup.querySelector('.toggle_advanced_rbf') - let advancedSettings = txDataPopup.querySelector('.advanced_rbf') - if (advancedSettings.classList.contains('hidden')) { - advancedSettings.classList.remove('hidden') - advancedButton.innerHTML = `{{ _("Advanced") }} ▼`; - } else { - advancedSettings.classList.add('hidden') - advancedButton.innerHTML = `{{ _("Advanced") }} ▶`; + txDataPopup.innerHTML = + `{% if specter.node.alias == "spectrum_node" %} +
+

RBF not supported yet with Spectrum

+

If you have to use RBF, you still can. Your transactions have the RBF flag and you can use Specter with Bitcoin Core to speed up or cancel.

+
+ {% else %} +
+
+

${rbfType == 'cancel' ? '{{ _("Cancel") }}' : '{{ _("Speed up transaction") }}'}

+

{{ _("You can") }} ${rbfType == 'cancel' ? `{{ _("cancel") }}` : `{{ _("speed up") }}`} {{ _("the transaction by increasing its fee rate") }}${rbfType == 'cancel' ? ` {{ _("and sending the funds back to yourself") }}` : ''}:

+ + sat/vbyte + + + {{ _("Advanced") }} {% if show_advanced_settings %}▼{% else %}▶{% endif %} + +
+
+ {% endif %}`; + let advanceToggle = txDataPopup.querySelector('.toggle_advanced_rbf') + if (advanceToggle) { + txDataPopup.querySelector('.toggle_advanced_rbf').onclick = () => { + let advancedButton = txDataPopup.querySelector('.toggle_advanced_rbf') + let advancedSettings = txDataPopup.querySelector('.advanced_rbf') + if (advancedSettings.classList.contains('hidden')) { + advancedSettings.classList.remove('hidden') + advancedButton.innerHTML = `{{ _("Advanced") }} ▼`; + } else { + advancedSettings.classList.add('hidden') + advancedButton.innerHTML = `{{ _("Advanced") }} ▶`; + } } - } - + } showPageOverlay('tx-popup'); }