Skip to content

Commit

Permalink
Merge pull request #2843 from axpoems/imp-completed-table
Browse files Browse the repository at this point in the history
Create new icons for open and copy links
  • Loading branch information
HenrikJannsen authored Sep 22, 2024
2 parents 6353ae9 + 6133feb commit fbe8972
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import bisq.common.data.Pair;
import bisq.desktop.ServiceProvider;
import bisq.desktop.common.Browser;
import bisq.desktop.common.utils.ClipboardUtil;
import bisq.desktop.components.overlay.Popup;
import bisq.desktop.main.content.bisq_easy.open_trades.trade_state.OpenTradesUtils;
import bisq.i18n.Res;
Expand Down Expand Up @@ -115,9 +116,16 @@ private void onExportTrade() {
}

private void openExplorer() {
Browser.open(getBlockExplorerUrl());
}

private void copyExplorerLink() {
ClipboardUtil.copyToClipboard(getBlockExplorerUrl());
}

private String getBlockExplorerUrl() {
ExplorerService.Provider provider = explorerService.getSelectedProvider().get();
String url = provider.getBaseUrl() + provider.getTxPath() + model.getPaymentProof();
Browser.open(url);
return provider.getBaseUrl() + provider.getTxPath() + model.getPaymentProof();
}
}

Expand Down Expand Up @@ -178,7 +186,8 @@ protected void onViewAttached() {
model.getTradeDate(), model.getPrice(), model.getPriceSymbol(), txIdDescriptionAndValue);
if (model.isBlockExplorerLinkVisible()) {
tradeCompletedTable.showBlockExplorerLink();
tradeCompletedTable.getBlockExplorerButton().setOnAction(e -> controller.openExplorer());
tradeCompletedTable.getOpenTxExplorerButton().setOnAction(e -> controller.openExplorer());
tradeCompletedTable.getCopyTxExplorerLinkButton().setOnAction(e -> controller.copyExplorerLink());
}
leaveButton.setOnAction(e -> controller.onLeaveChannel());
exportButton.setOnAction(e -> controller.onExportTrade());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import bisq.common.data.Pair;
import bisq.desktop.ServiceProvider;
import bisq.desktop.common.Browser;
import bisq.desktop.common.utils.ClipboardUtil;
import bisq.desktop.components.overlay.Popup;
import bisq.desktop.main.content.bisq_easy.open_trades.trade_state.OpenTradesUtils;
import bisq.i18n.Res;
Expand Down Expand Up @@ -116,9 +117,16 @@ private void onExportTrade() {
}

private void openExplorer() {
Browser.open(getBlockExplorerUrl());
}

private void copyExplorerLink() {
ClipboardUtil.copyToClipboard(getBlockExplorerUrl());
}

private String getBlockExplorerUrl() {
ExplorerService.Provider provider = explorerService.getSelectedProvider().get();
String url = provider.getBaseUrl() + provider.getTxPath() + model.getPaymentProof();
Browser.open(url);
return provider.getBaseUrl() + provider.getTxPath() + model.getPaymentProof();
}
}

Expand Down Expand Up @@ -179,7 +187,8 @@ protected void onViewAttached() {
model.getTradeDate(), model.getPrice(), model.getPriceSymbol(), txIdDescriptionAndValue);
if (model.isBlockExplorerLinkVisible()) {
tradeCompletedTable.showBlockExplorerLink();
tradeCompletedTable.getBlockExplorerButton().setOnAction(e -> controller.openExplorer());
tradeCompletedTable.getOpenTxExplorerButton().setOnAction(e -> controller.openExplorer());
tradeCompletedTable.getCopyTxExplorerLinkButton().setOnAction(e -> controller.copyExplorerLink());
}
leaveButton.setOnAction(e -> controller.onLeaveChannel());
exportButton.setOnAction(e -> controller.onExportTrade());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import bisq.desktop.common.utils.ImageUtil;
import bisq.desktop.components.containers.Spacer;
import bisq.desktop.components.controls.BisqIconButton;
import bisq.desktop.components.controls.BisqMenuItem;
import bisq.desktop.components.controls.BisqTooltip;
import bisq.desktop.main.content.components.UserProfileDisplay;
import bisq.i18n.Res;
Expand All @@ -39,10 +40,8 @@

public class TradeCompletedTable extends VBox {
private final GridPane headerGridPane, bodyGridPane;
// @Getter
// private final BisqMenuItem copyTxIdButton;
@Getter
private final Button blockExplorerButton, copyTxIdButton;
private final BisqMenuItem copyTxIdButton, copyTxExplorerLinkButton, openTxExplorerButton;

public TradeCompletedTable() {
Label title = new Label(Res.get("bisqEasy.tradeCompleted.title"));
Expand All @@ -67,20 +66,21 @@ public TradeCompletedTable() {
valueCol.setPercentWidth(75);
bodyGridPane.getColumnConstraints().add(valueCol);

blockExplorerButton = BisqIconButton.createExternalLinkButton(Res.get("bisqEasy.tradeCompleted.body.txId.explorerLink"), Res.get("bisqEasy.tradeCompleted.body.txId.tooltip"));
blockExplorerButton.getStyleClass().addAll("medium-text", "text-fill-grey-dimmed");
blockExplorerButton.getGraphic().getStyleClass().add("text-fill-grey-dimmed");
blockExplorerButton.setVisible(false);
blockExplorerButton.setManaged(false);

copyTxIdButton = BisqIconButton.createCopyIconButton(BisqTooltip.Style.DEFAULT, "text-fill-grey-dimmed");
copyTxIdButton = new BisqMenuItem("copy-grey", "copy-white");
copyTxIdButton.useIconOnly();
copyTxIdButton.setTooltip(Res.get("bisqEasy.tradeCompleted.body.copy.txId.tooltip"));

/* blockExplorerButton = new BisqMenuItem(Res.get("bisqEasy.tradeCompleted.body.txId.explorerLink")); // TODO: Add icon for external link instead
blockExplorerButton.setTooltip(Res.get("bisqEasy.tradeCompleted.body.txId.tooltip"));*/
copyTxExplorerLinkButton = new BisqMenuItem("link-grey", "link-white");
copyTxExplorerLinkButton.useIconOnly();
copyTxExplorerLinkButton.setTooltip(Res.get("bisqEasy.tradeCompleted.body.copy.explorerLink.tooltip"));
copyTxExplorerLinkButton.setVisible(false);
copyTxExplorerLinkButton.setManaged(false);

/* copyTxIdButton = new BisqMenuItem("copy-grey", "copy-white");
copyTxIdButton.useIconOnly();
copyTxIdButton.setTooltip(Res.get("action.copyToClipboard"));*/
openTxExplorerButton = new BisqMenuItem("open-link-grey","open-link-white");
openTxExplorerButton.useIconOnly();
openTxExplorerButton.setTooltip(Res.get("bisqEasy.tradeCompleted.body.txId.tooltip"));
openTxExplorerButton.setVisible(false);
openTxExplorerButton.setManaged(false);

Region line1 = getLine();
Region line2 = getLine();
Expand Down Expand Up @@ -200,7 +200,7 @@ public void initialize(UserProfile userProfile,
Label txIdValue = new Label(txId);
txIdValue.getStyleClass().addAll("medium-text", "text-fill-green");

HBox txValueBox = new HBox(10, txIdValue, Spacer.fillHBox(), blockExplorerButton, copyTxIdButton);
HBox txValueBox = new HBox(1, txIdValue, Spacer.fillHBox(), copyTxIdButton, copyTxExplorerLinkButton, openTxExplorerButton);
txValueBox.setAlignment(Pos.CENTER_LEFT);
GridPane.setValignment(txIdTitle, VPos.CENTER);
GridPane.setValignment(txIdValue, VPos.CENTER);
Expand All @@ -213,13 +213,16 @@ public void initialize(UserProfile userProfile,
}

public void dispose() {
blockExplorerButton.setOnAction(null);
copyTxIdButton.setOnAction(null);
copyTxExplorerLinkButton.setOnAction(null);
openTxExplorerButton.setOnAction(null);
}

public void showBlockExplorerLink() {
blockExplorerButton.setVisible(true);
blockExplorerButton.setManaged(true);
copyTxExplorerLinkButton.setVisible(true);
copyTxExplorerLinkButton.setManaged(true);
openTxExplorerButton.setVisible(true);
openTxExplorerButton.setManaged(true);
}

private Region getLine() {
Expand Down
23 changes: 23 additions & 0 deletions apps/desktop/desktop/src/main/resources/css/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,29 @@
-fx-image: url("/images/icons/close-mini-green.png");
}

#link-white {
-fx-image: url("/images/icons/link-white.png");
}

#link-grey {
-fx-image: url("/images/icons/link-grey.png");
}

#link-green {
-fx-image: url("/images/icons/link-green.png");
}

#open-link-white {
-fx-image: url("/images/icons/open-link-white.png");
}

#open-link-grey {
-fx-image: url("/images/icons/open-link-grey.png");
}

#open-link-green {
-fx-image: url("/images/icons/open-link-green.png");
}

/* ------------------------------------------------------------------------------------ */
/* Navigation */
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions i18n/src/main/resources/bisq_easy.properties
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ bisqEasy.tradeState.info.buyer.phase3b.info.ln=Transfers via the Lightning Netwo
Occasionally, payments may fail and need to be retried.
bisqEasy.tradeState.info.buyer.phase3b.confirmButton.ln=Confirm receipt
bisqEasy.tradeState.info.buyer.phase3b.tradeLogMessage.ln={0} has confirmed to have received the Bitcoin payment
bisqEasy.tradeState.info.buyer.phase3b.headline.MAIN_CHAIN=The seller has started the Bitcoin payment
bisqEasy.tradeState.info.buyer.phase3b.info.MAIN_CHAIN=As soon the Bitcoin transaction is visible in the Bitcoin network you will see the payment. \
After 1 blockchain confirmation the payment can be considered as completed.
bisqEasy.tradeState.info.buyer.phase3b.balance=Received Bitcoin
bisqEasy.tradeState.info.buyer.phase3b.balance.prompt=Waiting for blockchain data...

Expand All @@ -844,7 +847,8 @@ bisqEasy.tradeState.info.seller.phase3a.sendBtc=Send {0} to the buyer
bisqEasy.tradeState.info.seller.phase3a.baseAmount=Amount to send
bisqEasy.tradeState.info.seller.phase3a.qrCodeDisplay.openWindow=Open larger display
bisqEasy.tradeState.info.seller.phase3a.qrCodeDisplay.window.title=Scan QR Code for trade ''{0}''

bisqEasy.tradeState.info.seller.phase3b.headline.MAIN_CHAIN=Waiting for blockchain confirmation
bisqEasy.tradeState.info.seller.phase3b.info.MAIN_CHAIN=The Bitcoin payment require at least 1 blockchain confirmation to be considered complete.
bisqEasy.tradeState.info.seller.phase3b.balance=Bitcoin payment
bisqEasy.tradeState.info.seller.phase3b.balance.prompt=Waiting for blockchain data...

Expand Down Expand Up @@ -887,10 +891,6 @@ bisqEasy.tradeState.info.seller.phase3b.info.ln=Transfers via the Lightning Netw
as communication will no longer be possible afterward.
bisqEasy.tradeState.info.seller.phase3b.confirmButton.ln=Complete trade

bisqEasy.tradeState.info.seller.phase4.headline=Trade was successfully completed
bisqEasy.tradeState.info.seller.phase4.quoteAmount=You have received
bisqEasy.tradeState.info.seller.phase4.baseAmount=You have sold


######################################################
# Trade Completed Table
Expand All @@ -910,8 +910,9 @@ bisqEasy.tradeCompleted.body.date=Date
bisqEasy.tradeCompleted.body.tradePrice=Trade price
bisqEasy.tradeCompleted.body.tradeFee=Trade fee
bisqEasy.tradeCompleted.body.tradeFee.value=No trade fees in Bisq Easy
bisqEasy.tradeCompleted.body.txId.tooltip=Open transaction in block explorer
bisqEasy.tradeCompleted.body.txId.explorerLink=Open block explorer
bisqEasy.tradeCompleted.body.copy.txId.tooltip=Copy transaction ID to clipboard
bisqEasy.tradeCompleted.body.copy.explorerLink.tooltip=Copy block explorer transaction link
bisqEasy.tradeCompleted.body.txId.tooltip=Open block explorer transaction


################################################################################
Expand Down

0 comments on commit fbe8972

Please sign in to comment.