Skip to content

Commit

Permalink
Only show copy buttons if data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
axpoems committed Nov 10, 2024
1 parent 5101f1f commit dfa679c
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,12 @@ public TradeDetailsView(TradeDetailsModel model, TradeDetailsController controll
// BTC payment address
btcPaymentAddressTitleLabel = new Label();
btcPaymentAddressDetailsLabel = new Label();
btcPaymentAddressDetailsLabel.getStyleClass().addAll("normal-text");
btcPaymentAddressCopyButton = new BisqMenuItem("copy-grey", "copy-white");
HBox btcPaymentAddressBox = createAndGetTitleAndDetailsBox(btcPaymentAddressTitleLabel,
btcPaymentAddressDetailsLabel, Optional.of(btcPaymentAddressCopyButton));

// Payment account data
paymentAccountDataLabel = new Label();
paymentAccountDataLabel.getStyleClass().addAll("normal-text");
paymentAccountDataCopyButton = new BisqMenuItem("copy-grey", "copy-white");
paymentAccountDataCopyButton.setTooltip(Res.get("bisqEasy.openTrades.tradeDetails.paymentAccountData.copy"));
HBox paymentAccountDataBox = createAndGetTitleAndDetailsBox("bisqEasy.openTrades.tradeDetails.paymentAccountData",
Expand Down Expand Up @@ -256,21 +254,21 @@ protected void onViewAttached() {
assignedMediatorLabel.setText(model.getAssignedMediator());
assignedMediatorBox.setVisible(model.isHasMediatorBeenAssigned());
assignedMediatorBox.setManaged(model.isHasMediatorBeenAssigned());
btcPaymentAddressCopyButton.setVisible(!model.isBtcPaymentDataEmpty());
btcPaymentAddressCopyButton.setManaged(!model.isBtcPaymentDataEmpty());
paymentAccountDataCopyButton.setVisible(!model.isPaymentAccountDataEmpty());
paymentAccountDataCopyButton.setVisible(!model.isPaymentAccountDataEmpty());

if (model.isBtcPaymentDataEmpty()) {
btcPaymentAddressDetailsLabel.getStyleClass().remove("text-fill-grey-dimmed");
btcPaymentAddressDetailsLabel.getStyleClass().remove("text-fill-white");
btcPaymentAddressDetailsLabel.getStyleClass().add(model.isBtcPaymentDataEmpty()
? "text-fill-grey-dimmed"
: "text-fill-white");
}
if (model.isPaymentAccountDataEmpty()) {
paymentAccountDataLabel.getStyleClass().remove("text-fill-grey-dimmed");
paymentAccountDataLabel.getStyleClass().remove("text-fill-white");
paymentAccountDataLabel.getStyleClass().add(model.isPaymentAccountDataEmpty()
? "text-fill-grey-dimmed"
: "text-fill-white");
}
btcPaymentAddressDetailsLabel.getStyleClass().clear();
btcPaymentAddressDetailsLabel.getStyleClass().add(model.isBtcPaymentDataEmpty()
? "text-fill-grey-dimmed"
: "text-fill-white");
btcPaymentAddressDetailsLabel.getStyleClass().add("normal-text");
paymentAccountDataLabel.getStyleClass().clear();
paymentAccountDataLabel.getStyleClass().add(model.isPaymentAccountDataEmpty()
? "text-fill-grey-dimmed"
: "text-fill-white");
paymentAccountDataLabel.getStyleClass().add("normal-text");

closeButton.setOnAction(e -> controller.onClose());
tradersAndRoleCopyButton.setOnAction(e -> ClipboardUtil.copyToClipboard(model.getPeer()));
Expand Down

0 comments on commit dfa679c

Please sign in to comment.