mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 22:45:21 +01:00
Add more context to buy BSQ button
This commit is contained in:
parent
9e2be92787
commit
5527208894
3 changed files with 40 additions and 20 deletions
|
@ -41,11 +41,15 @@ public class HyperlinkWithIcon extends Hyperlink {
|
||||||
this(text, AwesomeIcon.INFO_SIGN);
|
this(text, AwesomeIcon.INFO_SIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HyperlinkWithIcon(String text, AwesomeIcon awesomeIcon) {
|
public HyperlinkWithIcon(String text, String fontSize) {
|
||||||
|
this(text, AwesomeIcon.INFO_SIGN, fontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HyperlinkWithIcon(String text, AwesomeIcon awesomeIcon, String fontSize) {
|
||||||
super(text);
|
super(text);
|
||||||
|
|
||||||
Label icon = new Label();
|
Label icon = new Label();
|
||||||
AwesomeDude.setIcon(icon, awesomeIcon);
|
AwesomeDude.setIcon(icon, awesomeIcon, fontSize);
|
||||||
icon.setMinWidth(20);
|
icon.setMinWidth(20);
|
||||||
icon.setOpacity(0.7);
|
icon.setOpacity(0.7);
|
||||||
icon.getStyleClass().addAll("hyperlink", "no-underline");
|
icon.getStyleClass().addAll("hyperlink", "no-underline");
|
||||||
|
@ -55,6 +59,10 @@ public class HyperlinkWithIcon extends Hyperlink {
|
||||||
setIcon(icon);
|
setIcon(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HyperlinkWithIcon(String text, AwesomeIcon awesomeIcon) {
|
||||||
|
this(text, awesomeIcon, "1.231em");
|
||||||
|
}
|
||||||
|
|
||||||
public HyperlinkWithIcon(String text, GlyphIcons icon) {
|
public HyperlinkWithIcon(String text, GlyphIcons icon) {
|
||||||
this(text, icon, null);
|
this(text, icon, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
private TitledGroupBg payFundsTitledGroupBg, setDepositTitledGroupBg, paymentTitledGroupBg;
|
private TitledGroupBg payFundsTitledGroupBg, setDepositTitledGroupBg, paymentTitledGroupBg;
|
||||||
protected TitledGroupBg amountTitledGroupBg;
|
protected TitledGroupBg amountTitledGroupBg;
|
||||||
private BusyAnimation waitingForFundsSpinner;
|
private BusyAnimation waitingForFundsSpinner;
|
||||||
private AutoTooltipButton nextButton, cancelButton1, cancelButton2, placeOfferButton, buyBsqButton;
|
private AutoTooltipButton nextButton, cancelButton1, cancelButton2, placeOfferButton;
|
||||||
private Button priceTypeToggleButton;
|
private Button priceTypeToggleButton;
|
||||||
private InputTextField fixedPriceTextField, marketBasedPriceTextField, triggerPriceInputTextField;
|
private InputTextField fixedPriceTextField, marketBasedPriceTextField, triggerPriceInputTextField;
|
||||||
protected InputTextField amountTextField, minAmountTextField, volumeTextField, buyerSecurityDepositInputTextField;
|
protected InputTextField amountTextField, minAmountTextField, volumeTextField, buyerSecurityDepositInputTextField;
|
||||||
|
@ -153,7 +153,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
private ComboBox<PaymentAccount> paymentAccountsComboBox;
|
private ComboBox<PaymentAccount> paymentAccountsComboBox;
|
||||||
private ComboBox<TradeCurrency> currencyComboBox;
|
private ComboBox<TradeCurrency> currencyComboBox;
|
||||||
private ImageView qrCodeImageView;
|
private ImageView qrCodeImageView;
|
||||||
private VBox currencySelection, fixedPriceBox, percentagePriceBox, currencyTextFieldBox, triggerPriceVBox;
|
private VBox currencySelection, fixedPriceBox, percentagePriceBox, currencyTextFieldBox, triggerPriceVBox, buyBsqBox;
|
||||||
private HBox fundingHBox, firstRowHBox, secondRowHBox, placeOfferBox, amountValueCurrencyBox,
|
private HBox fundingHBox, firstRowHBox, secondRowHBox, placeOfferBox, amountValueCurrencyBox,
|
||||||
priceAsPercentageValueCurrencyBox, volumeValueCurrencyBox, priceValueCurrencyBox,
|
priceAsPercentageValueCurrencyBox, volumeValueCurrencyBox, priceValueCurrencyBox,
|
||||||
minAmountValueCurrencyBox, advancedOptionsBox, triggerPriceHBox;
|
minAmountValueCurrencyBox, advancedOptionsBox, triggerPriceHBox;
|
||||||
|
@ -270,8 +270,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
tradeFeeInBtcToggle.setManaged(false);
|
tradeFeeInBtcToggle.setManaged(false);
|
||||||
tradeFeeInBsqToggle.setVisible(false);
|
tradeFeeInBsqToggle.setVisible(false);
|
||||||
tradeFeeInBsqToggle.setManaged(false);
|
tradeFeeInBsqToggle.setManaged(false);
|
||||||
buyBsqButton.setVisible(false);
|
buyBsqBox.setVisible(false);
|
||||||
buyBsqButton.setManaged(false);
|
buyBsqBox.setManaged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Label popOverLabel = OfferViewUtil.createPopOverLabel(Res.get("createOffer.triggerPrice.tooltip"));
|
Label popOverLabel = OfferViewUtil.createPopOverLabel(Res.get("createOffer.triggerPrice.tooltip"));
|
||||||
|
@ -405,9 +405,8 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
cancelButton1.setVisible(false);
|
cancelButton1.setVisible(false);
|
||||||
cancelButton1.setManaged(false);
|
cancelButton1.setManaged(false);
|
||||||
cancelButton1.setOnAction(null);
|
cancelButton1.setOnAction(null);
|
||||||
buyBsqButton.setVisible(false);
|
buyBsqBox.setVisible(false);
|
||||||
buyBsqButton.setManaged(false);
|
buyBsqBox.setManaged(false);
|
||||||
buyBsqButton.setOnAction(null);
|
|
||||||
|
|
||||||
tradeFeeInBtcToggle.setMouseTransparent(true);
|
tradeFeeInBtcToggle.setMouseTransparent(true);
|
||||||
tradeFeeInBsqToggle.setMouseTransparent(true);
|
tradeFeeInBsqToggle.setMouseTransparent(true);
|
||||||
|
@ -896,7 +895,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
tradeFeeInBtcToggle.setVisible(newValue);
|
tradeFeeInBtcToggle.setVisible(newValue);
|
||||||
tradeFeeInBsqToggle.setVisible(newValue);
|
tradeFeeInBsqToggle.setVisible(newValue);
|
||||||
if (model.isShowBuyBsqHint()) {
|
if (model.isShowBuyBsqHint()) {
|
||||||
buyBsqButton.setVisible(newValue);
|
buyBsqBox.setVisible(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1102,10 +1101,10 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
|
|
||||||
Tuple2<AutoTooltipButton, VBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
|
Tuple2<AutoTooltipButton, VBox> buyBsqButtonBox = OfferViewUtil.createBuyBsqButtonBox(
|
||||||
navigation, preferences);
|
navigation, preferences);
|
||||||
buyBsqButton = buyBsqButtonBox.first;
|
buyBsqBox = buyBsqButtonBox.second;
|
||||||
buyBsqButton.setVisible(false);
|
buyBsqBox.setVisible(false);
|
||||||
|
|
||||||
advancedOptionsBox.getChildren().addAll(getBuyerSecurityDepositBox(), getTradeFeeFieldsBox(), buyBsqButtonBox.second);
|
advancedOptionsBox.getChildren().addAll(getBuyerSecurityDepositBox(), getTradeFeeFieldsBox(), buyBsqBox);
|
||||||
|
|
||||||
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane, ++gridRow,
|
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane, ++gridRow,
|
||||||
Res.get("shared.nextStep"), Res.get("shared.cancel"));
|
Res.get("shared.nextStep"), Res.get("shared.cancel"));
|
||||||
|
|
|
@ -20,6 +20,7 @@ package bisq.desktop.main.offer.bisq_v1;
|
||||||
import bisq.desktop.Navigation;
|
import bisq.desktop.Navigation;
|
||||||
import bisq.desktop.components.AutoTooltipButton;
|
import bisq.desktop.components.AutoTooltipButton;
|
||||||
import bisq.desktop.components.AutoTooltipLabel;
|
import bisq.desktop.components.AutoTooltipLabel;
|
||||||
|
import bisq.desktop.components.HyperlinkWithIcon;
|
||||||
import bisq.desktop.main.MainView;
|
import bisq.desktop.main.MainView;
|
||||||
import bisq.desktop.main.offer.offerbook.OfferBookView;
|
import bisq.desktop.main.offer.offerbook.OfferBookView;
|
||||||
import bisq.desktop.main.overlays.popups.Popup;
|
import bisq.desktop.main.overlays.popups.Popup;
|
||||||
|
@ -33,6 +34,7 @@ import bisq.common.util.Tuple2;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
|
||||||
import javafx.geometry.HPos;
|
import javafx.geometry.HPos;
|
||||||
|
@ -88,21 +90,32 @@ public class OfferViewUtil {
|
||||||
var buyBsqButton = new AutoTooltipButton(buyBsqText);
|
var buyBsqButton = new AutoTooltipButton(buyBsqText);
|
||||||
buyBsqButton.getStyleClass().add("action-button");
|
buyBsqButton.getStyleClass().add("action-button");
|
||||||
buyBsqButton.getStyleClass().add("tiny-button");
|
buyBsqButton.getStyleClass().add("tiny-button");
|
||||||
buyBsqButton.setOnAction(e -> new Popup().headLine(buyBsqText)
|
buyBsqButton.setOnAction(e -> openBuyBsqOfferBook(navigation, preferences)
|
||||||
|
);
|
||||||
|
|
||||||
|
var info = new AutoTooltipLabel("BSQ is colored BTC that helps fund Bisq developers.");
|
||||||
|
var learnMore = new HyperlinkWithIcon("Learn More");
|
||||||
|
learnMore.setOnAction(e -> new Popup().headLine(buyBsqText)
|
||||||
.information(Res.get("createOffer.buyBsq.popupMessage"))
|
.information(Res.get("createOffer.buyBsq.popupMessage"))
|
||||||
.actionButtonText(buyBsqText)
|
.actionButtonText(buyBsqText)
|
||||||
.buttonAlignment(HPos.CENTER)
|
.buttonAlignment(HPos.CENTER)
|
||||||
.onAction(() -> {
|
.onAction(() -> openBuyBsqOfferBook(navigation, preferences)).show());
|
||||||
preferences.setSellScreenCurrencyCode("BSQ");
|
|
||||||
navigation.navigateTo(
|
|
||||||
MainView.class, SellOfferView.class, OfferBookView.class);
|
|
||||||
}).show());
|
|
||||||
|
|
||||||
final VBox buyBsqButtonVBox = new VBox(buyBsqButton);
|
final HBox buyBsqBox = new HBox(buyBsqButton, info, learnMore);
|
||||||
|
buyBsqBox.setAlignment(Pos.BOTTOM_LEFT);
|
||||||
|
buyBsqBox.setSpacing(10);
|
||||||
|
|
||||||
|
final VBox buyBsqButtonVBox = new VBox(buyBsqBox);
|
||||||
buyBsqButtonVBox.setAlignment(Pos.BOTTOM_LEFT);
|
buyBsqButtonVBox.setAlignment(Pos.BOTTOM_LEFT);
|
||||||
buyBsqButtonVBox.setPadding(new Insets(0, 0, 0, -20));
|
buyBsqButtonVBox.setPadding(new Insets(0, 0, 0, -20));
|
||||||
VBox.setMargin(buyBsqButton, new Insets(0, 0, 4, 0));
|
VBox.setMargin(buyBsqButton, new Insets(0, 0, 4, 0));
|
||||||
|
|
||||||
return new Tuple2<>(buyBsqButton, buyBsqButtonVBox);
|
return new Tuple2<>(buyBsqButton, buyBsqButtonVBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void openBuyBsqOfferBook(Navigation navigation, Preferences preferences) {
|
||||||
|
preferences.setSellScreenCurrencyCode("BSQ");
|
||||||
|
navigation.navigateTo(
|
||||||
|
MainView.class, SellOfferView.class, OfferBookView.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue