diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 840cca5aad0..de29d3d6736 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -530,7 +530,6 @@ createOffer.useLowerValue=Yes, use my lower value createOffer.priceOutSideOfDeviation=The price you have entered is outside the max. allowed deviation from the market price.\nThe max. allowed deviation is {0} and can be adjusted in the preferences. createOffer.changePrice=Change price createOffer.tac=With publishing this offer I agree to trade with any trader who fulfills the conditions as defined in this screen. -createOffer.currencyForFee=Trade fee createOffer.setDeposit=Set buyer's security deposit (%) createOffer.setDepositAsBuyer=Set my security deposit as buyer (%) createOffer.setDepositForBothTraders=Set both traders' security deposit (%) @@ -2917,9 +2916,6 @@ torNetworkSettingWindow.bridges.info=If Tor is blocked by your internet provider Visit the Tor web page at: https://bridges.torproject.org/bridges to learn more about \ bridges and pluggable transports. -feeOptionWindow.headline=Choose currency for trade fee payment -feeOptionWindow.info=You can choose to pay the trade fee in BSQ or in BTC. If you choose BSQ you appreciate the discounted trade fee. -feeOptionWindow.optionsLabel=Choose currency for trade fee payment feeOptionWindow.useBTC=Use BTC feeOptionWindow.fee={0} (≈ {1}) feeOptionWindow.btcFeeWithFiatAndPercentage={0} (≈ {1} / {2}) diff --git a/desktop/src/main/java/bisq/desktop/bisq.css b/desktop/src/main/java/bisq/desktop/bisq.css index 20a8b7f3a0b..837f4c1c6c1 100644 --- a/desktop/src/main/java/bisq/desktop/bisq.css +++ b/desktop/src/main/java/bisq/desktop/bisq.css @@ -2162,7 +2162,7 @@ textfield */ -fx-text-fill: -bs-rd-font-dark; } -.dao-news-content, .dao-news-section-link, .dao-news-section-link .hyperlink, .dao-launch-version { +.dao-news-content, .dao-news-section-link, .dao-news-section-link .hyperlink { -fx-text-fill: -bs-rd-font-light; -fx-fill: -bs-rd-font-light; } diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DaoLaunchWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DaoLaunchWindow.java deleted file mode 100644 index af11a83d16e..00000000000 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DaoLaunchWindow.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * 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.main.overlays.windows; - -import bisq.desktop.app.BisqAppMain; -import bisq.desktop.components.AutoTooltipToggleButton; -import bisq.desktop.main.overlays.Overlay; - -import bisq.core.locale.GlobalSettings; -import bisq.core.locale.Res; - -import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; - -import javafx.animation.Animation; -import javafx.animation.Interpolator; -import javafx.animation.KeyFrame; -import javafx.animation.KeyValue; -import javafx.animation.Timeline; - -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.Toggle; -import javafx.scene.control.ToggleGroup; -import javafx.scene.image.ImageView; -import javafx.scene.layout.GridPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Priority; -import javafx.scene.layout.VBox; -import javafx.scene.text.TextAlignment; - -import javafx.geometry.HPos; -import javafx.geometry.Insets; -import javafx.geometry.Pos; - -import javafx.beans.property.IntegerProperty; -import javafx.beans.property.SimpleIntegerProperty; - -import javafx.collections.ObservableList; - -import javafx.util.Duration; - -import java.util.ArrayList; - -import lombok.extern.slf4j.Slf4j; - -import static bisq.desktop.util.FormBuilder.addLabel; -import static bisq.desktop.util.FormBuilder.getIconButton; - -@Slf4j -public class DaoLaunchWindow extends Overlay { - private static final double DURATION = 400; - - private ImageView sectionScreenshot; - private ToggleGroup sectionButtonsGroup; - private ArrayList
sections = new ArrayList<>(); - private IntegerProperty currentSectionIndex = new SimpleIntegerProperty(0); - private Label sectionDescriptionLabel; - private Timeline autoPlayTimeline, slideInTimeline, slideOutTimeline; - private Section selectedSection; - private boolean showSlideInAnimation = true; - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Public API - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - public void show() { - width = 1003; - super.show(); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Protected - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - protected void createGridPane() { - super.createGridPane(); - - gridPane.setVgap(0); - gridPane.getColumnConstraints().get(0).setHalignment(HPos.CENTER); - gridPane.setPadding(new Insets(74, 64, 74, 64)); - } - - @Override - protected void addHeadLine() { - Label versionNumber = addLabel(gridPane, ++rowIndex, BisqAppMain.DEFAULT_APP_NAME + " v1.0"); - versionNumber.getStyleClass().add("dao-launch-version"); - GridPane.setColumnSpan(versionNumber, 2); - Label headlineLabel = addLabel(gridPane, ++rowIndex, headLine); - headlineLabel.getStyleClass().add("dao-launch-headline"); - GridPane.setMargin(headlineLabel, new Insets(10, 0, 0, 0)); - GridPane.setColumnSpan(headlineLabel, 2); - } - - @Override - protected void addMessage() { - sections.add(new Section(Res.get("popup.dao.launch.governance.title"), Res.get("popup.dao.launch.governance"), - "dao-screenshot-governance")); - sections.add(new Section(Res.get("popup.dao.launch.trading.title"), Res.get("popup.dao.launch.trading"), - "dao-screenshot-trading")); - sections.add(new Section(Res.get("popup.dao.launch.cheaperFees.title"), Res.get("popup.dao.launch.cheaperFees"), - "dao-screenshot-cheaper-fees")); - - createContent(); - createSlideControls(); - - addListeners(); - - createSlideAnimations(); - startAutoSectionChange(); - } - - @Override - protected void onShow() { - display(); - - new Timeline(new KeyFrame( - Duration.millis(300), - ae -> slideInTimeline.playFrom(Duration.millis(DURATION)) - )).play(); - } - - @Override - protected void addButtons() { - super.addButtons(); - - closeButton.prefWidthProperty().bind(actionButton.widthProperty()); - } - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private - /////////////////////////////////////////////////////////////////////////////////////////// - - private void addListeners() { - currentSectionIndex.addListener((observable, oldValue, newValue) -> { - if (!newValue.equals(oldValue)) { - ObservableList toggles = sectionButtonsGroup.getToggles(); - - Toggle toggleToSelect = toggles.get(newValue.intValue() % toggles.size()); - if (sectionButtonsGroup.getSelectedToggle() != toggleToSelect) - sectionButtonsGroup.selectToggle(toggleToSelect); - } - }); - - sectionButtonsGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> { - if (!newValue.equals(oldValue)) { - int index = ((SectionButton) newValue).index; - selectedSection = sections.get(index); - - if (showSlideInAnimation) - slideInTimeline.playFromStart(); - else - slideOutTimeline.playFromStart(); - - currentSectionIndex.set(index); - } - }); - } - - private void startAutoSectionChange() { - autoPlayTimeline = new Timeline(new KeyFrame( - Duration.seconds(10), - ae -> goToNextSection() - )); - autoPlayTimeline.setCycleCount(Animation.INDEFINITE); - - autoPlayTimeline.play(); - } - - private void createSlideControls() { - sectionButtonsGroup = new ToggleGroup(); - - HBox slideButtons = new HBox(); - slideButtons.setMaxWidth(616); - slideButtons.getStyleClass().add("dao-launch-tab-box"); - - sections.forEach(section -> { - SectionButton sectionButton = new SectionButton(section.title.toUpperCase(), sections.indexOf(section)); - sectionButton.setMaxWidth(Double.MAX_VALUE); - HBox.setHgrow(sectionButton, Priority.ALWAYS); - slideButtons.getChildren().add(sectionButton); - }); - - sectionButtonsGroup.getToggles().get(0).setSelected(true); - - GridPane.setRowIndex(slideButtons, ++rowIndex); - GridPane.setColumnSpan(slideButtons, 2); - GridPane.setHalignment(slideButtons, HPos.CENTER); - GridPane.setHgrow(slideButtons, Priority.NEVER); - gridPane.getChildren().add(slideButtons); - } - - private void createContent() { - HBox slidingContentWithPagingBox = new HBox(); - slidingContentWithPagingBox.setPadding(new Insets(30, 0, 0, 0)); - slidingContentWithPagingBox.setAlignment(Pos.CENTER); - Button prevButton = getIconButton(MaterialDesignIcon.ARROW_LEFT, "dao-launch-paging-button"); - prevButton.setOnAction(event -> { - autoPlayTimeline.stop(); - goToPrevSection(); - }); - Button nextButton = getIconButton(MaterialDesignIcon.ARROW_RIGHT, "dao-launch-paging-button"); - nextButton.setOnAction(event -> { - autoPlayTimeline.stop(); - goToNextSection(); - }); - VBox slidingContent = new VBox(); - slidingContent.setMinWidth(616); - slidingContent.setSpacing(20); - sectionDescriptionLabel = new Label(); - sectionDescriptionLabel.setTextAlignment(TextAlignment.CENTER); - sectionDescriptionLabel.getStyleClass().add("dao-launch-description"); - sectionDescriptionLabel.setMaxWidth(562); - sectionDescriptionLabel.setWrapText(true); - - - selectedSection = sections.get(currentSectionIndex.get()); - - sectionDescriptionLabel.setText(selectedSection.description); - sectionScreenshot = new ImageView(); - sectionScreenshot.setOpacity(0); - sectionScreenshot.setId(selectedSection.imageId); - - slidingContent.setAlignment(Pos.CENTER); - slidingContent.getChildren().addAll(sectionDescriptionLabel, sectionScreenshot); - slidingContentWithPagingBox.getChildren().addAll(prevButton, slidingContent, nextButton); - - GridPane.setRowIndex(slidingContentWithPagingBox, ++rowIndex); - GridPane.setColumnSpan(slidingContentWithPagingBox, 2); - GridPane.setHgrow(slidingContent, Priority.ALWAYS); - gridPane.getChildren().add(slidingContentWithPagingBox); - } - - private void goToPrevSection() { - showSlideInAnimation = false; - - if (currentSectionIndex.get() == 0) - currentSectionIndex.set(sections.size() - 1); - else - currentSectionIndex.set(currentSectionIndex.get() - 1); - } - - private void goToNextSection() { - showSlideInAnimation = true; - currentSectionIndex.set(currentSectionIndex.get() + 1); - } - - private void createSlideAnimations() { - slideInTimeline = new Timeline(); - slideOutTimeline = new Timeline(); - - double imageWidth = 534; - - createSlideAnimation(slideInTimeline, imageWidth); - createSlideAnimation(slideOutTimeline, -imageWidth); - } - - private void createSlideAnimation(Timeline timeline, double imageWidth) { - Interpolator interpolator = Interpolator.EASE_OUT; - ObservableList keyFrames = timeline.getKeyFrames(); - - double endX = -imageWidth; - keyFrames.add(new KeyFrame(Duration.millis(0), - new KeyValue(sectionScreenshot.opacityProperty(), 1, interpolator), - new KeyValue(sectionScreenshot.translateXProperty(), 0, interpolator))); - keyFrames.add(new KeyFrame(Duration.millis(DURATION), - event -> { - sectionDescriptionLabel.setText(selectedSection.description); - sectionScreenshot.setId(selectedSection.imageId); - }, - new KeyValue(sectionScreenshot.opacityProperty(), 0, interpolator), - new KeyValue(sectionScreenshot.translateXProperty(), endX, interpolator))); - - double startX = imageWidth; - - keyFrames.add(new KeyFrame(Duration.millis(DURATION), - new KeyValue(sectionScreenshot.opacityProperty(), 0, interpolator), - new KeyValue(sectionScreenshot.translateXProperty(), startX, interpolator))); - keyFrames.add(new KeyFrame(Duration.millis(DURATION * 2), - new KeyValue(sectionScreenshot.opacityProperty(), 1, interpolator), - new KeyValue(sectionScreenshot.translateXProperty(), 0, interpolator))); - } - - protected double getDuration(double duration) { - return useAnimation && GlobalSettings.getUseAnimations() ? duration : 1; - } - - private class SectionButton extends AutoTooltipToggleButton { - int index; - - SectionButton(String title, int index) { - super(title); - this.index = index; - - this.setToggleGroup(sectionButtonsGroup); - this.getStyleClass().add("slider-section-button"); - - this.selectedProperty().addListener((ov, oldValue, newValue) -> this.setMouseTransparent(newValue)); - - this.setOnAction(event -> { - autoPlayTimeline.stop(); - showSlideInAnimation = true; - }); - } - } - - private class Section { - private String title; - String description; - String imageId; - - Section(String title, String description, String imageId) { - this.title = title; - this.description = description; - this.imageId = imageId; - } - } -} diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/FeeOptionWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/FeeOptionWindow.java deleted file mode 100644 index 58db4405337..00000000000 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/FeeOptionWindow.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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.main.overlays.windows; - -import bisq.desktop.Navigation; -import bisq.desktop.main.MainView; -import bisq.desktop.main.dao.DaoView; -import bisq.desktop.main.dao.wallet.BsqWalletView; -import bisq.desktop.main.dao.wallet.receive.BsqReceiveView; -import bisq.desktop.main.overlays.Overlay; -import bisq.desktop.main.overlays.popups.Popup; -import bisq.desktop.util.FormBuilder; - -import bisq.core.locale.Res; - -import bisq.common.UserThread; -import bisq.common.util.Tuple3; - -import javafx.scene.Scene; -import javafx.scene.control.Label; -import javafx.scene.control.RadioButton; -import javafx.scene.control.TextField; -import javafx.scene.control.Toggle; -import javafx.scene.control.ToggleGroup; -import javafx.scene.input.KeyCode; -import javafx.scene.layout.GridPane; - -import javafx.geometry.HPos; - -import javafx.beans.property.StringProperty; -import javafx.beans.value.ChangeListener; - -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; - -import lombok.extern.slf4j.Slf4j; - -import javax.annotation.Nullable; - -import static bisq.desktop.util.FormBuilder.addLabel; -import static bisq.desktop.util.FormBuilder.addTopLabelRadioButtonRadioButton; - -@Slf4j -public class FeeOptionWindow extends Overlay { - private TextField makerFeeTextField; - private ChangeListener toggleChangeListener; - private Consumer selectionChangedHandler; - private final StringProperty makerFeeWithCodeProperty; - private final boolean isCurrencyForMakerFeeBtc; - private final boolean isBsqForFeeAvailable; - @Nullable - private final String missingBsq; - private final Navigation navigation; - private final Runnable closeHandler; - private ToggleGroup toggleGroup; - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Public API - /////////////////////////////////////////////////////////////////////////////////////////// - - public FeeOptionWindow(StringProperty makerFeeWithCodeProperty, boolean isCurrencyForMakerFeeBtc, - boolean isBsqForFeeAvailable, @Nullable String missingBsq, Navigation navigation, - Runnable closeHandler) { - this.makerFeeWithCodeProperty = makerFeeWithCodeProperty; - this.isCurrencyForMakerFeeBtc = isCurrencyForMakerFeeBtc; - this.isBsqForFeeAvailable = isBsqForFeeAvailable; - this.missingBsq = missingBsq; - this.navigation = navigation; - this.closeHandler = closeHandler; - type = Type.Attention; - } - - public void show() { - if (headLine == null) - headLine = Res.get("feeOptionWindow.headline"); - - width = 968; - createGridPane(); - addHeadLine(); - addContent(); - addButtons(); - addDontShowAgainCheckBox(); - applyStyles(); - display(); - } - - public FeeOptionWindow onSelectionChangedHandler(Consumer selectionChangedHandler) { - this.selectionChangedHandler = selectionChangedHandler; - return this; - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Protected - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - protected void setupKeyHandler(Scene scene) { - if (!hideCloseButton) { - scene.setOnKeyPressed(e -> { - if (e.getCode() == KeyCode.ESCAPE) { - e.consume(); - doClose(); - } - }); - } - } - - @Override - protected void cleanup() { - super.cleanup(); - - if (makerFeeTextField != null) - makerFeeTextField.textProperty().unbind(); - if (toggleGroup != null) - toggleGroup.selectedToggleProperty().removeListener(toggleChangeListener); - } - - private void addContent() { - Label label = addLabel(gridPane, ++rowIndex, Res.get("feeOptionWindow.info")); - GridPane.setColumnSpan(label, 2); - GridPane.setHalignment(label, HPos.LEFT); - - toggleGroup = new ToggleGroup(); - Tuple3 tuple = addTopLabelRadioButtonRadioButton(gridPane, - ++rowIndex, - toggleGroup, - Res.get("feeOptionWindow.optionsLabel"), - "BTC", - "BSQ", 0); - RadioButton radioButtonBTC = tuple.second; - RadioButton radioButtonBSQ = tuple.third; - - makerFeeTextField = FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, - Res.get("createOffer.currencyForFee"), makerFeeWithCodeProperty.get()).second; - - toggleChangeListener = (observable, oldValue, newValue) -> { - final boolean isBtc = newValue == radioButtonBTC; - selectionChangedHandler.accept(isBtc); - - if (!isBsqForFeeAvailable && !isBtc) { - if (missingBsq != null) { - // We don't call hide() because we want to keep the blurred bg - if (stage != null) - stage.hide(); - else - log.warn("Stage is null"); - - cleanup(); - onHidden(); - - new Popup().warning(missingBsq) - .actionButtonTextWithGoTo("navigation.dao.wallet.receive") - .onAction(() -> { - UserThread.runAfter(() -> { - hide(); - navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqReceiveView.class); - }, 100, TimeUnit.MILLISECONDS); - }) - .closeButtonText(Res.get("feeOptionWindow.useBTC")) - .onClose(() -> { - selectionChangedHandler.accept(true); - closeHandler.run(); - }) - .show(); - } - - UserThread.execute(() -> { - toggleGroup.selectToggle(radioButtonBTC); - radioButtonBSQ.setDisable(true); - }); - } - }; - toggleGroup.selectedToggleProperty().addListener(toggleChangeListener); - toggleGroup.selectToggle(!isBsqForFeeAvailable || isCurrencyForMakerFeeBtc ? radioButtonBTC : radioButtonBSQ); - - makerFeeTextField.textProperty().bind(makerFeeWithCodeProperty); - } -}