diff --git a/core/src/main/java/bisq/core/util/SimpleMarkdownParser.java b/core/src/main/java/bisq/core/util/SimpleMarkdownParser.java new file mode 100644 index 00000000000..84c0517d18b --- /dev/null +++ b/core/src/main/java/bisq/core/util/SimpleMarkdownParser.java @@ -0,0 +1,82 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.core.util; + +import java.util.ArrayList; +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +public class SimpleMarkdownParser { + private enum MarkdownParsingState { + TEXT, + LINK_TEXT, + LINK_HREF + } + + // Simple parser without correctness validation, currently supports only links + public static List parse(String markdown) { + List items = new ArrayList<>(); + StringBuilder sb = new StringBuilder(); + StringBuilder sb2 = new StringBuilder(); + + MarkdownParsingState state = MarkdownParsingState.TEXT; + + for (int i = 0; i < markdown.length(); i++) { + char c = markdown.charAt(i); + if (c == '[') { + if (sb.length() > 0) { + items.add(new TextNode(sb.toString())); + sb = new StringBuilder(); + } + state = MarkdownParsingState.LINK_TEXT; + } else if (c == '(') { + state = MarkdownParsingState.LINK_HREF; + } else if (c == ')') { + state = MarkdownParsingState.TEXT; + items.add(new HyperlinkNode(sb.toString(), sb2.toString())); + sb = new StringBuilder(); + sb2 = new StringBuilder(); + } else if (c != ']') { + if (state == MarkdownParsingState.LINK_HREF) { + sb2.append(c); + } else { + sb.append(c); + } + } + } + if (sb.length() > 0) { + items.add(new TextNode(sb.toString())); + } + return items; + } + + public static class MarkdownNode {} + + @AllArgsConstructor + public static class HyperlinkNode extends MarkdownNode { + @Getter private final String text; + @Getter private final String href; + } + + @AllArgsConstructor + public static class TextNode extends MarkdownNode { + @Getter private final String text; + } +} diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index eaf885ea13b..c60e4e76a24 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -924,6 +924,8 @@ portfolio.pending.tradePeriodInfo=After the first blockchain confirmation, the t portfolio.pending.tradePeriodWarning=If the period is exceeded both traders can open a dispute. portfolio.pending.tradeNotCompleted=Trade not completed in time (until {0}) portfolio.pending.tradeProcess=Trade process +portfolio.pending.stillNotResolved=If your issue remains unsolved, you can request support in our [Matrix chatroom](https://bisq.chat).\n\n\ + Also see [trading rules](https://bisq.wiki/Trading_rules) and [dispute resolution](https://bisq.wiki/Dispute_resolution) for reference. portfolio.pending.openAgainDispute.msg=If you are not sure that the message to the mediator or arbitrator arrived \ (e.g. if you did not get a response after 1 day) feel free to open a dispute again with Cmd/Ctrl+o. You can also ask \ for additional help on the Bisq forum at [HYPERLINK:https://bisq.community]. @@ -946,9 +948,6 @@ portfolio.pending.error.depositTxNotConfirmed=The deposit transaction is not con For further help please contact the Bisq support channel at the Bisq Matrix Space. portfolio.pending.support.headline.getHelp=Need help? -portfolio.pending.support.text.getHelp=If you have any problems you can try to contact the trade peer in the trade \ - chat or ask the Bisq community at https://bisq.community. \ - If your issue still isn't resolved, you can request more help from a mediator. portfolio.pending.support.button.getHelp=Open Trader Chat portfolio.pending.support.headline.halfPeriodOver=Check payment portfolio.pending.support.headline.periodOver=Trade period is over diff --git a/core/src/test/java/bisq/core/util/SimpleMarkdownParserTest.java b/core/src/test/java/bisq/core/util/SimpleMarkdownParserTest.java new file mode 100644 index 00000000000..51c90a7fe3e --- /dev/null +++ b/core/src/test/java/bisq/core/util/SimpleMarkdownParserTest.java @@ -0,0 +1,31 @@ +package bisq.core.util; + +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class SimpleMarkdownParserTest { + + @Test + public void testParse() { + String text = "Take a look at the trade process" + + " [here](https://docs.bisq.network/getting-started.html#4-send-payment)." + + " \n\nIf you have any problems you can try to contact the trade peer in the trade chat."; + + List result = SimpleMarkdownParser.parse(text); + + assertEquals(3, result.size()); + + SimpleMarkdownParser.TextNode item0 = (SimpleMarkdownParser.TextNode) result.get(0); + assertEquals("Take a look at the trade process ", item0.getText()); + + SimpleMarkdownParser.HyperlinkNode item1 = (SimpleMarkdownParser.HyperlinkNode) result.get(1); + assertEquals(item1.getText(), "here"); + assertEquals(item1.getHref(), "https://docs.bisq.network/getting-started.html#4-send-payment"); + + SimpleMarkdownParser.TextNode item2 = (SimpleMarkdownParser.TextNode) result.get(2); + assertEquals(". \n\nIf you have any problems you can try to contact the trade peer in the trade chat.", item2.getText()); + } +} diff --git a/desktop/src/main/java/bisq/desktop/bisq.css b/desktop/src/main/java/bisq/desktop/bisq.css index 837f4c1c6c1..6ec01b80390 100644 --- a/desktop/src/main/java/bisq/desktop/bisq.css +++ b/desktop/src/main/java/bisq/desktop/bisq.css @@ -609,6 +609,10 @@ tree-table-view:focused { -fx-font-size: 0.769em; } +.medium-text { + -fx-font-size: 0.846em; +} + .normal-text { -fx-font-size: 0.923em; } diff --git a/desktop/src/main/java/bisq/desktop/components/AutoTooltipTableColumn.java b/desktop/src/main/java/bisq/desktop/components/AutoTooltipTableColumn.java index aa6cb17af20..7adf217c50c 100644 --- a/desktop/src/main/java/bisq/desktop/components/AutoTooltipTableColumn.java +++ b/desktop/src/main/java/bisq/desktop/components/AutoTooltipTableColumn.java @@ -18,8 +18,8 @@ package bisq.desktop.components; import bisq.desktop.components.controlsfx.control.PopOver; +import bisq.desktop.util.FormBuilder; -import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; import javafx.scene.Node; @@ -48,8 +48,7 @@ public void setTitle(String title) { } public void setTitleWithHelpText(String title, String help) { - helpIcon = new Label(); - AwesomeDude.setIcon(helpIcon, AwesomeIcon.QUESTION_SIGN, "1em"); + helpIcon = FormBuilder.getSmallIcon(AwesomeIcon.QUESTION_SIGN); helpIcon.setOpacity(0.4); helpIcon.setOnMouseEntered(e -> popoverWrapper.showPopOver(() -> createInfoPopOver(help))); helpIcon.setOnMouseExited(e -> popoverWrapper.hidePopOver()); diff --git a/desktop/src/main/java/bisq/desktop/components/SimpleMarkdownLabel.java b/desktop/src/main/java/bisq/desktop/components/SimpleMarkdownLabel.java new file mode 100644 index 00000000000..8a7750e2ad0 --- /dev/null +++ b/desktop/src/main/java/bisq/desktop/components/SimpleMarkdownLabel.java @@ -0,0 +1,61 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.desktop.components; + +import bisq.desktop.util.GUIUtil; + +import bisq.core.util.SimpleMarkdownParser; + +import javafx.scene.Node; +import javafx.scene.control.Hyperlink; +import javafx.scene.text.Text; +import javafx.scene.text.TextFlow; + +import java.util.List; +import java.util.stream.Collectors; + +public class SimpleMarkdownLabel extends TextFlow { + + public SimpleMarkdownLabel(String markdown) { + super(); + getStyleClass().add("markdown-label"); + if (markdown != null) { + updateContent(markdown); + } + } + + public void updateContent(String markdown) { + List items = SimpleMarkdownParser + .parse(markdown) + .stream() + .map(node -> { + if (node instanceof SimpleMarkdownParser.HyperlinkNode) { + var item = ((SimpleMarkdownParser.HyperlinkNode) node); + Hyperlink hyperlink = new Hyperlink(item.getText()); + hyperlink.setOnAction(e -> GUIUtil.openWebPage(item.getHref())); + return hyperlink; + } else { + var item = ((SimpleMarkdownParser.TextNode) node); + return new Text(item.getText()); + } + }) + .collect(Collectors.toList()); + + getChildren().setAll(items); + } +} diff --git a/desktop/src/main/java/bisq/desktop/components/TitledGroupBg.java b/desktop/src/main/java/bisq/desktop/components/TitledGroupBg.java index 1b53e3ed41b..f29c483759e 100644 --- a/desktop/src/main/java/bisq/desktop/components/TitledGroupBg.java +++ b/desktop/src/main/java/bisq/desktop/components/TitledGroupBg.java @@ -17,19 +17,28 @@ package bisq.desktop.components; +import bisq.desktop.util.FormBuilder; +import bisq.desktop.util.GUIUtil; + +import de.jensd.fx.fontawesome.AwesomeIcon; + import javafx.scene.control.Label; import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.geometry.Insets; +import javafx.geometry.Pos; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; public class TitledGroupBg extends Pane { + private final HBox box; private final Label label; private final StringProperty text = new SimpleStringProperty(); + private Label helpIcon; /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -39,13 +48,18 @@ public TitledGroupBg() { GridPane.setMargin(this, new Insets(-10, -10, -10, -10)); GridPane.setColumnSpan(this, 2); + box = new HBox(); + box.setSpacing(4); + box.setLayoutX(4); + box.setLayoutY(-8); + box.setPadding(new Insets(0, 7, 0, 5)); + box.setAlignment(Pos.CENTER_LEFT); + label = new AutoTooltipLabel(); label.textProperty().bind(text); - label.setLayoutX(4); - label.setLayoutY(-8); - label.setPadding(new Insets(0, 7, 0, 5)); setActive(); - getChildren().add(label); + box.getChildren().add(label); + getChildren().add(box); } public void setInactive() { @@ -65,10 +79,6 @@ private void setActive() { label.getStyleClass().add("titled-group-bg-label-active"); } - public String getText() { - return text.get(); - } - public StringProperty textProperty() { return text; } @@ -77,8 +87,13 @@ public void setText(String text) { this.text.set(text); } - public Label getLabel() { - return label; - } + public void setHelpUrl(String helpUrl) { + if (helpIcon == null) { + helpIcon = FormBuilder.getSmallIcon(AwesomeIcon.QUESTION); + helpIcon.getStyleClass().addAll("show-hand", "highlight"); + box.getChildren().add(helpIcon); + } + helpIcon.setOnMouseClicked(e -> GUIUtil.openWebPage(helpUrl)); + } } diff --git a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java index e291ad99618..0972531a176 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java @@ -174,8 +174,14 @@ public void initialize() { tableView.getSortOrder().add(usageColumn); tableView.setItems(sortedList); - titledGroupBg = addTitledGroupBg(gridPane, gridRow, 4, Res.get("funds.deposit.fundWallet")); + titledGroupBg = addTitledGroupBg( + gridPane, + gridRow, + 4, + Res.get("funds.deposit.fundWallet") + ); titledGroupBg.getStyleClass().add("last"); + titledGroupBg.setHelpUrl("https://bisq.wiki/Funding_your_wallet"); qrCodeImageView = new ImageView(); qrCodeImageView.getStyleClass().add("qr-code"); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java index 770d47e2ce4..894719ae3b5 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java @@ -136,6 +136,7 @@ public class OfferBookView extends ActivatableViewAndModel currencyComboBox; private AutocompleteComboBox paymentMethodComboBox; private AutoTooltipButton createOfferButton; @@ -187,7 +188,12 @@ public class OfferBookView extends ActivatableViewAndModel firstHalfOverWarnTextSupplier = () -> ""; private Supplier periodOverWarnTextSupplier = () -> ""; - TradeStepInfo(TitledGroupBg titledGroupBg, Label label, AutoTooltipButton button) { + TradeStepInfo(TitledGroupBg titledGroupBg, + SimpleMarkdownLabel label, + AutoTooltipButton button, + SimpleMarkdownLabel footerLabel) { this.titledGroupBg = titledGroupBg; this.label = label; this.button = button; + this.footerLabel = footerLabel; GridPane.setColumnIndex(button, 0); setState(State.SHOW_GET_HELP_BUTTON); @@ -103,7 +108,7 @@ public void setState(State state) { case SHOW_GET_HELP_BUTTON: // grey button titledGroupBg.setText(Res.get("portfolio.pending.support.headline.getHelp")); - label.setText(Res.get("portfolio.pending.support.text.getHelp")); + label.updateContent(""); button.setText(Res.get("portfolio.pending.support.button.getHelp").toUpperCase()); button.setId(null); button.getStyleClass().remove("action-button"); @@ -112,7 +117,7 @@ public void setState(State state) { case IN_MEDIATION_SELF_REQUESTED: // red button titledGroupBg.setText(Res.get("portfolio.pending.mediationRequested")); - label.setText(Res.get("portfolio.pending.disputeOpenedMyUser", Res.get("portfolio.pending.communicateWithMediator"))); + label.updateContent(Res.get("portfolio.pending.disputeOpenedMyUser", Res.get("portfolio.pending.communicateWithMediator"))); button.setText(Res.get("portfolio.pending.mediationRequested").toUpperCase()); button.setId("open-dispute-button"); button.getStyleClass().remove("action-button"); @@ -121,7 +126,7 @@ public void setState(State state) { case IN_MEDIATION_PEER_REQUESTED: // red button titledGroupBg.setText(Res.get("portfolio.pending.mediationRequested")); - label.setText(Res.get("portfolio.pending.disputeOpenedByPeer", Res.get("portfolio.pending.communicateWithMediator"))); + label.updateContent(Res.get("portfolio.pending.disputeOpenedByPeer", Res.get("portfolio.pending.communicateWithMediator"))); button.setText(Res.get("portfolio.pending.mediationRequested").toUpperCase()); button.setId("open-dispute-button"); button.getStyleClass().remove("action-button"); @@ -130,7 +135,7 @@ public void setState(State state) { case MEDIATION_RESULT: // green button titledGroupBg.setText(Res.get("portfolio.pending.mediationResult.headline")); - label.setText(Res.get("portfolio.pending.mediationResult.info.noneAccepted")); + label.updateContent(Res.get("portfolio.pending.mediationResult.info.noneAccepted")); button.setText(Res.get("portfolio.pending.mediationResult.button").toUpperCase()); button.setId(null); button.getStyleClass().add("action-button"); @@ -139,7 +144,7 @@ public void setState(State state) { case MEDIATION_RESULT_SELF_ACCEPTED: // green button deactivated titledGroupBg.setText(Res.get("portfolio.pending.mediationResult.headline")); - label.setText(Res.get("portfolio.pending.mediationResult.info.selfAccepted")); + label.updateContent(Res.get("portfolio.pending.mediationResult.info.selfAccepted")); button.setText(Res.get("portfolio.pending.mediationResult.button").toUpperCase()); button.setId(null); button.getStyleClass().add("action-button"); @@ -148,7 +153,7 @@ public void setState(State state) { case MEDIATION_RESULT_PEER_ACCEPTED: // green button titledGroupBg.setText(Res.get("portfolio.pending.mediationResult.headline")); - label.setText(Res.get("portfolio.pending.mediationResult.info.peerAccepted")); + label.updateContent(Res.get("portfolio.pending.mediationResult.info.peerAccepted")); button.setText(Res.get("portfolio.pending.mediationResult.button").toUpperCase()); button.setId(null); button.getStyleClass().add("action-button"); @@ -157,7 +162,7 @@ public void setState(State state) { case IN_REFUND_REQUEST_SELF_REQUESTED: // red button titledGroupBg.setText(Res.get("portfolio.pending.refundRequested")); - label.setText(Res.get("portfolio.pending.disputeOpenedMyUser", Res.get("portfolio.pending.communicateWithArbitrator"))); + label.updateContent(Res.get("portfolio.pending.disputeOpenedMyUser", Res.get("portfolio.pending.communicateWithArbitrator"))); button.setText(Res.get("portfolio.pending.refundRequested").toUpperCase()); button.setId("open-dispute-button"); button.getStyleClass().remove("action-button"); @@ -166,7 +171,7 @@ public void setState(State state) { case IN_REFUND_REQUEST_PEER_REQUESTED: // red button titledGroupBg.setText(Res.get("portfolio.pending.refundRequested")); - label.setText(Res.get("portfolio.pending.disputeOpenedByPeer", Res.get("portfolio.pending.communicateWithArbitrator"))); + label.updateContent(Res.get("portfolio.pending.disputeOpenedByPeer", Res.get("portfolio.pending.communicateWithArbitrator"))); button.setText(Res.get("portfolio.pending.refundRequested").toUpperCase()); button.setId("open-dispute-button"); button.getStyleClass().remove("action-button"); @@ -175,7 +180,7 @@ public void setState(State state) { case WARN_HALF_PERIOD: // orange button titledGroupBg.setText(Res.get("portfolio.pending.support.headline.halfPeriodOver")); - label.setText(firstHalfOverWarnTextSupplier.get()); + label.updateContent(firstHalfOverWarnTextSupplier.get()); button.setText(Res.get("portfolio.pending.support.button.getHelp").toUpperCase()); button.setId(null); button.getStyleClass().remove("action-button"); @@ -184,7 +189,7 @@ public void setState(State state) { case WARN_PERIOD_OVER: // red button titledGroupBg.setText(Res.get("portfolio.pending.support.headline.periodOver")); - label.setText(periodOverWarnTextSupplier.get()); + label.updateContent(periodOverWarnTextSupplier.get()); button.setText(Res.get("portfolio.pending.openSupport").toUpperCase()); button.setId("open-dispute-button"); button.getStyleClass().remove("action-button"); @@ -195,6 +200,7 @@ public void setState(State state) { titledGroupBg.setVisible(false); label.setVisible(false); button.setVisible(false); + footerLabel.setVisible(false); } if (trade != null && trade.getPayoutTx() != null) { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java index 379ae4da8c9..39f6e94f9d3 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/TradeSubView.java @@ -18,6 +18,7 @@ package bisq.desktop.main.portfolio.pendingtrades; import bisq.desktop.components.AutoTooltipButton; +import bisq.desktop.components.SimpleMarkdownLabel; import bisq.desktop.components.TitledGroupBg; import bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView; import bisq.desktop.main.portfolio.pendingtrades.steps.TradeWizardItem; @@ -26,7 +27,6 @@ import bisq.core.locale.Res; import bisq.core.trade.model.bisq_v1.Trade; -import javafx.scene.control.Label; import javafx.scene.control.Separator; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.GridPane; @@ -43,7 +43,7 @@ import lombok.extern.slf4j.Slf4j; import static bisq.desktop.util.FormBuilder.addButtonAfterGroup; -import static bisq.desktop.util.FormBuilder.addMultilineLabel; +import static bisq.desktop.util.FormBuilder.addSimpleMarkdownLabel; import static bisq.desktop.util.FormBuilder.addTitledGroupBg; @Slf4j @@ -102,11 +102,14 @@ private void buildViews() { addWizards(); - TitledGroupBg titledGroupBg = addTitledGroupBg(leftGridPane, leftGridPaneRowIndex, 1, "", 30); + TitledGroupBg titledGroupBg = addTitledGroupBg(leftGridPane, ++leftGridPaneRowIndex, 1, "", 10); titledGroupBg.getStyleClass().add("last"); - Label label = addMultilineLabel(leftGridPane, leftGridPaneRowIndex, "", 30); + + SimpleMarkdownLabel label = addSimpleMarkdownLabel(leftGridPane, ++leftGridPaneRowIndex); AutoTooltipButton button = (AutoTooltipButton) addButtonAfterGroup(leftGridPane, ++leftGridPaneRowIndex, ""); - tradeStepInfo = new TradeStepInfo(titledGroupBg, label, button); + SimpleMarkdownLabel footerLabel = addSimpleMarkdownLabel(leftGridPane, ++leftGridPaneRowIndex, Res.get("portfolio.pending.stillNotResolved"), 10); + footerLabel.getStyleClass().add("medium-text"); + tradeStepInfo = new TradeStepInfo(titledGroupBg, label, button, footerLabel); } void showItem(TradeWizardItem item) { @@ -132,7 +135,7 @@ void addWizardsToGridPane(TradeWizardItem tradeWizardItem) { void addLineSeparatorToGridPane() { final Separator separator = new Separator(Orientation.VERTICAL); - separator.setMinHeight(22); + separator.setMinHeight(10); GridPane.setMargin(separator, new Insets(0, 0, 0, 13)); GridPane.setHalignment(separator, HPos.LEFT); GridPane.setRowIndex(separator, leftGridPaneRowIndex++); diff --git a/desktop/src/main/java/bisq/desktop/theme-dark.css b/desktop/src/main/java/bisq/desktop/theme-dark.css index cf7742aa230..01946ad3749 100644 --- a/desktop/src/main/java/bisq/desktop/theme-dark.css +++ b/desktop/src/main/java/bisq/desktop/theme-dark.css @@ -542,3 +542,9 @@ .offer-disabled .label { -bs-text-color: -bs-color-gray-bbb; } + +.markdown-label, +.markdown-label * { + -fx-text-fill: -bs-text-color; + -fx-fill: -bs-text-color; +} diff --git a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java index c8b9a254adb..5429bd50cf6 100644 --- a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java @@ -37,6 +37,7 @@ import bisq.desktop.components.InfoTextField; import bisq.desktop.components.InputTextField; import bisq.desktop.components.PasswordTextField; +import bisq.desktop.components.SimpleMarkdownLabel; import bisq.desktop.components.TextFieldWithCopyIcon; import bisq.desktop.components.TextFieldWithIcon; import bisq.desktop.components.TitledGroupBg; @@ -186,6 +187,23 @@ public static Tuple3 addLabelWithSubText(GridPane gridPane, } + /////////////////////////////////////////////////////////////////////////////////////////// + // Simple Markdown Label + /////////////////////////////////////////////////////////////////////////////////////////// + public static SimpleMarkdownLabel addSimpleMarkdownLabel(GridPane gridPane, int rowIndex) { + return addSimpleMarkdownLabel(gridPane, rowIndex, null, 0); + } + + public static SimpleMarkdownLabel addSimpleMarkdownLabel(GridPane gridPane, int rowIndex, String markdown, double top) { + SimpleMarkdownLabel label = new SimpleMarkdownLabel(markdown); + + GridPane.setRowIndex(label, rowIndex); + GridPane.setMargin(label, new Insets(top, 0, 0, 0)); + gridPane.getChildren().add(label); + + return label; + } + /////////////////////////////////////////////////////////////////////////////////////////// // Multiline Label /////////////////////////////////////////////////////////////////////////////////////////// @@ -394,17 +412,17 @@ public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, } public static Tuple2 addConfirmationLabelTextField(GridPane gridPane, - int rowIndex, - String title1, - String title2) { + int rowIndex, + String title1, + String title2) { return addConfirmationLabelTextField(gridPane, rowIndex, title1, title2, 0); } public static Tuple2 addConfirmationLabelTextField(GridPane gridPane, - int rowIndex, - String title1, - String title2, - double top) { + int rowIndex, + String title1, + String title2, + double top) { Label label1 = addLabel(gridPane, rowIndex, title1); label1.getStyleClass().add("confirmation-label"); TextField label2 = new BisqTextField(title2); @@ -421,9 +439,9 @@ public static Tuple2 addConfirmationLabelTextField(GridPane gr } public static Tuple2 addConfirmationLabelLabelWithCopyIcon(GridPane gridPane, - int rowIndex, - String title1, - String title2) { + int rowIndex, + String title1, + String title2) { Label label1 = addLabel(gridPane, rowIndex, title1); label1.getStyleClass().add("confirmation-label"); TextFieldWithCopyIcon label2 = new TextFieldWithCopyIcon("confirmation-value"); @@ -867,9 +885,9 @@ public static Tuple3 addTopLabelInputTextFi public static Tuple3 addTopLabelInputTextFieldSlideToggleButtonRight(GridPane gridPane, - int rowIndex, - String title, - String toggleButtonTitle) { + int rowIndex, + String title, + String toggleButtonTitle) { InputTextField inputTextField = new InputTextField(); Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, inputTextField, 0); @@ -2312,6 +2330,14 @@ public static Label getIcon(AwesomeIcon icon) { return label; } + public static Label getIcon(AwesomeIcon icon, String fontSize) { + return getIconForLabel(icon, new Label(), fontSize); + } + + public static Label getSmallIcon(AwesomeIcon icon) { + return getIcon(icon, "1em"); + } + public static Label getIconForLabel(AwesomeIcon icon, Label label, String fontSize) { AwesomeDude.setIcon(label, icon, fontSize); return label; @@ -2381,3 +2407,4 @@ public static TableView addTableViewWithHeader(GridPane gridPane, return tableView; } } +