Add support/help links on the UI - question mark links

This commit is contained in:
xyzmaker123 2022-01-27 15:30:39 +01:00
parent 19d6b2607c
commit feb6af1e7a
No known key found for this signature in database
GPG Key ID: 47689699B7B0AAFC
4 changed files with 60 additions and 26 deletions

View File

@ -17,19 +17,28 @@
package bisq.desktop.components;
import bisq.desktop.util.GUIUtil;
import de.jensd.fx.fontawesome.AwesomeDude;
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 class TitledGroupBg extends Pane {
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 @@ public class TitledGroupBg extends Pane {
label.getStyleClass().add("titled-group-bg-label-active");
}
public String getText() {
return text.get();
}
public StringProperty textProperty() {
return text;
}
@ -77,8 +87,14 @@ public class TitledGroupBg extends Pane {
this.text.set(text);
}
public Label getLabel() {
return label;
}
public void setupHelpUrl(String helpUrl) {
if (helpIcon == null) {
helpIcon = new Label();
AwesomeDude.setIcon(helpIcon, AwesomeIcon.QUESTION_SIGN, "1.2em");
helpIcon.getStyleClass().add("show-hand");
box.getChildren().add(helpIcon);
}
helpIcon.setOnMouseClicked(e -> GUIUtil.openWebPage(helpUrl));
}
}

View File

@ -174,8 +174,14 @@ public class DepositView extends ActivatableView<VBox, Void> {
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.setupHelpUrl("https://docs.bisq.network/getting-started.html#fund-your-bisq-wallet");
qrCodeImageView = new ImageView();
qrCodeImageView.getStyleClass().add("qr-code");

View File

@ -78,6 +78,7 @@ import org.bitcoinj.core.Coin;
import javax.inject.Inject;
import javax.inject.Named;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
@ -136,6 +137,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
private final AccountAgeWitnessService accountAgeWitnessService;
private final SignedWitnessService signedWitnessService;
private TitledGroupBg titledGroupBg;
private AutocompleteComboBox<TradeCurrency> currencyComboBox;
private AutocompleteComboBox<PaymentMethod> paymentMethodComboBox;
private AutoTooltipButton createOfferButton;
@ -187,7 +189,12 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
public void initialize() {
root.setPadding(new Insets(15, 15, 5, 15));
final TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 2, Res.get("offerbook.availableOffers"));
titledGroupBg = addTitledGroupBg(
root,
gridRow,
2,
Res.get("offerbook.availableOffers")
);
titledGroupBg.getStyleClass().add("last");
HBox offerToolsBox = new HBox();
@ -336,6 +343,10 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
@Override
protected void activate() {
titledGroupBg.setupHelpUrl(model.getDirection() == OfferDirection.SELL
? "https://docs.bisq.network/intro.html#in-a-nutshell"
: "https://docs.bisq.network/getting-started.html#take-an-offer");
currencyComboBox.setCellFactory(GUIUtil.getTradeCurrencyCellFactory(Res.get("shared.oneOffer"),
Res.get("shared.multipleOffers"),
(model.getDirection() == OfferDirection.BUY ? model.getSellOfferCounts() : model.getBuyOfferCounts())));

View File

@ -412,17 +412,17 @@ public class FormBuilder {
}
public static Tuple2<Label, TextField> 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<Label, TextField> 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);
@ -439,9 +439,9 @@ public class FormBuilder {
}
public static Tuple2<Label, TextFieldWithCopyIcon> 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");
@ -885,9 +885,9 @@ public class FormBuilder {
public static Tuple3<Label, InputTextField, ToggleButton> addTopLabelInputTextFieldSlideToggleButtonRight(GridPane gridPane,
int rowIndex,
String title,
String toggleButtonTitle) {
int rowIndex,
String title,
String toggleButtonTitle) {
InputTextField inputTextField = new InputTextField();
Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, inputTextField, 0);
@ -2399,3 +2399,4 @@ public class FormBuilder {
return tableView;
}
}