add insufficient inputs feedback label

This commit is contained in:
Craig Raw 2021-04-19 09:29:19 +02:00
parent 42b96e042b
commit 7b856f32a2
3 changed files with 21 additions and 5 deletions

2
drongo

@ -1 +1 @@
Subproject commit 891499aff04b69f53bf143464001b96b44a0ec53 Subproject commit 1aeaacaf59484c76d5bf485dabb4a632c5230032

View file

@ -14,10 +14,7 @@ import com.sparrowwallet.drongo.wallet.UtxoSelector;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.CurrencyRate; import com.sparrowwallet.sparrow.CurrencyRate;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.control.CoinTextFormatter; import com.sparrowwallet.sparrow.control.*;
import com.sparrowwallet.sparrow.control.CopyableTextField;
import com.sparrowwallet.sparrow.control.FiatLabel;
import com.sparrowwallet.sparrow.control.QRScanDialog;
import com.sparrowwallet.sparrow.event.BitcoinUnitChangedEvent; import com.sparrowwallet.sparrow.event.BitcoinUnitChangedEvent;
import com.sparrowwallet.sparrow.event.ExchangeRatesUpdatedEvent; import com.sparrowwallet.sparrow.event.ExchangeRatesUpdatedEvent;
import com.sparrowwallet.sparrow.event.FiatCurrencySelectedEvent; import com.sparrowwallet.sparrow.event.FiatCurrencySelectedEvent;
@ -59,6 +56,9 @@ public class PaymentController extends WalletFormController implements Initializ
@FXML @FXML
private FiatLabel fiatAmount; private FiatLabel fiatAmount;
@FXML
private Label amountStatus;
@FXML @FXML
private ToggleButton maxButton; private ToggleButton maxButton;
@ -141,6 +141,11 @@ public class PaymentController extends WalletFormController implements Initializ
sendController.utxoLabelSelectionProperty().addListener((observable, oldValue, newValue) -> { sendController.utxoLabelSelectionProperty().addListener((observable, oldValue, newValue) -> {
maxButton.setText("Max" + newValue); maxButton.setText("Max" + newValue);
}); });
amountStatus.managedProperty().bind(amountStatus.visibleProperty());
amountStatus.setVisible(sendController.isInsufficientInputs());
sendController.insufficientInputsProperty().addListener((observable, oldValue, newValue) -> {
amountStatus.setVisible(newValue);
});
Optional<Tab> firstTab = sendController.getPaymentTabs().getTabs().stream().findFirst(); Optional<Tab> firstTab = sendController.getPaymentTabs().getTabs().stream().findFirst();
if(firstTab.isPresent()) { if(firstTab.isPresent()) {

View file

@ -56,6 +56,17 @@
</ComboBox> </ComboBox>
<Label style="-fx-pref-width: 15" /> <Label style="-fx-pref-width: 15" />
<FiatLabel fx:id="fiatAmount" /> <FiatLabel fx:id="fiatAmount" />
<Label fx:id="amountStatus" text="Insufficient">
<tooltip>
<Tooltip text="Insufficient confirmed transaction value" />
</tooltip>
<graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="EXCLAMATION_CIRCLE" styleClass="failure" />
</graphic>
<padding>
<Insets left="10" />
</padding>
</Label>
<Region style="-fx-pref-width: 20" /> <Region style="-fx-pref-width: 20" />
<ToggleButton fx:id="maxButton" text="Max" onAction="#setMaxInput" /> <ToggleButton fx:id="maxButton" text="Max" onAction="#setMaxInput" />
</Field> </Field>