Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fine tune reactions' background styles #2445

Merged
merged 8 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
import bisq.desktop.common.view.Navigation;
import bisq.desktop.common.view.NavigationController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.amount.TradeWizardAmountController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.btc_payment_method.TradeWizardBitcoinPaymentMethodController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.direction.TradeWizardDirectionController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.fiat_payment_method.TradeWizardFiatPaymentMethodController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.payment_methods.TradeWizardPaymentMethodsController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.market.TradeWizardMarketController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.price.TradeWizardPriceController;
import bisq.desktop.main.content.bisq_easy.trade_wizard.review.TradeWizardReviewController;
Expand Down Expand Up @@ -73,8 +72,7 @@ public InitData(boolean isCreateOfferMode) {
private final TradeWizardMarketController tradeWizardMarketController;
private final TradeWizardPriceController tradeWizardPriceController;
private final TradeWizardAmountController tradeWizardAmountController;
private final TradeWizardBitcoinPaymentMethodController tradeWizardBitcoinPaymentMethodController;
private final TradeWizardFiatPaymentMethodController tradeWizardFiatPaymentMethodController;
private final TradeWizardPaymentMethodsController tradeWizardPaymentMethodsController;
private final TradeWizardSelectOfferController tradeWizardSelectOfferController;
private final TradeWizardReviewController tradeWizardReviewController;
private final EventHandler<KeyEvent> onKeyPressedHandler = this::onKeyPressed;
Expand All @@ -99,8 +97,7 @@ public TradeWizardController(ServiceProvider serviceProvider) {
tradeWizardMarketController = new TradeWizardMarketController(serviceProvider, this::onNext);
tradeWizardPriceController = new TradeWizardPriceController(serviceProvider, view.getRoot());
tradeWizardAmountController = new TradeWizardAmountController(serviceProvider, view.getRoot());
tradeWizardBitcoinPaymentMethodController = new TradeWizardBitcoinPaymentMethodController(serviceProvider, view.getRoot(), this::onNext);
tradeWizardFiatPaymentMethodController = new TradeWizardFiatPaymentMethodController(serviceProvider, view.getRoot(), this::onNext);
tradeWizardPaymentMethodsController = new TradeWizardPaymentMethodsController(serviceProvider, view.getRoot(), this::onNext);
tradeWizardSelectOfferController = new TradeWizardSelectOfferController(serviceProvider,
this::onBack,
this::onNext,
Expand Down Expand Up @@ -139,8 +136,7 @@ public void onActivate() {
NavigationTarget.TRADE_WIZARD_DIRECTION,
NavigationTarget.TRADE_WIZARD_MARKET,
NavigationTarget.TRADE_WIZARD_AMOUNT,
NavigationTarget.TRADE_WIZARD_BITCOIN_PAYMENT_METHOD,
NavigationTarget.TRADE_WIZARD_FIAT_PAYMENT_METHOD,
NavigationTarget.TRADE_WIZARD_PAYMENT_METHODS,
NavigationTarget.TRADE_WIZARD_TAKE_OFFER_OFFER,
NavigationTarget.TRADE_WIZARD_REVIEW_OFFER
));
Expand All @@ -155,13 +151,12 @@ public void onActivate() {
tradeWizardMarketController.setDirection(direction);
tradeWizardSelectOfferController.setDirection(direction);
tradeWizardAmountController.setDirection(direction);
tradeWizardBitcoinPaymentMethodController.setDirection(direction);
tradeWizardFiatPaymentMethodController.setDirection(direction);
tradeWizardPaymentMethodsController.setDirection(direction);
tradeWizardPriceController.setDirection(direction);
});
marketPin = EasyBind.subscribe(tradeWizardMarketController.getMarket(), market -> {
tradeWizardSelectOfferController.setMarket(market);
tradeWizardFiatPaymentMethodController.setMarket(market);
tradeWizardPaymentMethodsController.setMarket(market);
tradeWizardPriceController.setMarket(market);
tradeWizardAmountController.setMarket(market);
updateNextButtonDisabledState();
Expand All @@ -184,8 +179,9 @@ public void onActivate() {
isBackButtonHighlighted -> model.getIsBackButtonHighlighted().set(isBackButtonHighlighted));

handleFiatPaymentMethodsUpdate();
tradeWizardBitcoinPaymentMethodController.getBitcoinPaymentMethods().addListener(bitcoinPaymentMethodsListener);
tradeWizardFiatPaymentMethodController.getFiatPaymentMethods().addListener(fiatPaymentMethodsListener);
tradeWizardPaymentMethodsController.getFiatPaymentMethods().addListener(fiatPaymentMethodsListener);
handleBitcoinPaymentMethodsUpdate();
tradeWizardPaymentMethodsController.getBitcoinPaymentMethods().addListener(bitcoinPaymentMethodsListener);
}

@Override
Expand All @@ -199,8 +195,8 @@ public void onDeactivate() {
priceSpecPin.unsubscribe();
selectedBisqEasyOfferPin.unsubscribe();
isBackButtonHighlightedPin.unsubscribe();
tradeWizardBitcoinPaymentMethodController.getBitcoinPaymentMethods().removeListener(bitcoinPaymentMethodsListener);
tradeWizardFiatPaymentMethodController.getFiatPaymentMethods().removeListener(fiatPaymentMethodsListener);
tradeWizardPaymentMethodsController.getFiatPaymentMethods().removeListener(fiatPaymentMethodsListener);
tradeWizardPaymentMethodsController.getBitcoinPaymentMethods().removeListener(bitcoinPaymentMethodsListener);
}

@Override
Expand All @@ -210,17 +206,17 @@ protected void onStartProcessNavigationTarget(NavigationTarget navigationTarget,
tradeWizardReviewController.setDataForCreateOffer(
tradeWizardDirectionController.getDirection().get(),
tradeWizardMarketController.getMarket().get(),
tradeWizardBitcoinPaymentMethodController.getBitcoinPaymentMethods(),
tradeWizardFiatPaymentMethodController.getFiatPaymentMethods(),
tradeWizardPaymentMethodsController.getBitcoinPaymentMethods(),
tradeWizardPaymentMethodsController.getFiatPaymentMethods(),
tradeWizardAmountController.getQuoteSideAmountSpec().get(),
tradeWizardPriceController.getPriceSpec().get()
);
model.getNextButtonText().set(Res.get("bisqEasy.tradeWizard.review.nextButton.createOffer"));
} else {
tradeWizardReviewController.setDataForTakeOffer(tradeWizardSelectOfferController.getSelectedBisqEasyOffer().get(),
tradeWizardAmountController.getQuoteSideAmountSpec().get(),
tradeWizardBitcoinPaymentMethodController.getBitcoinPaymentMethods(),
tradeWizardFiatPaymentMethodController.getFiatPaymentMethods()
tradeWizardPaymentMethodsController.getBitcoinPaymentMethods(),
tradeWizardPaymentMethodsController.getFiatPaymentMethods()
);
model.getNextButtonText().set(Res.get("bisqEasy.tradeWizard.review.nextButton.takeOffer"));
updateNextButtonDisabledState();
Expand Down Expand Up @@ -252,11 +248,8 @@ protected Optional<? extends Controller> createController(NavigationTarget navig
case TRADE_WIZARD_PRICE: {
return Optional.of(tradeWizardPriceController);
}
case TRADE_WIZARD_BITCOIN_PAYMENT_METHOD: {
return Optional.of(tradeWizardBitcoinPaymentMethodController);
}
case TRADE_WIZARD_FIAT_PAYMENT_METHOD: {
return Optional.of(tradeWizardFiatPaymentMethodController);
case TRADE_WIZARD_PAYMENT_METHODS: {
return Optional.of(tradeWizardPaymentMethodsController);
}
case TRADE_WIZARD_AMOUNT: {
return Optional.of(tradeWizardAmountController);
Expand Down Expand Up @@ -333,12 +326,9 @@ private boolean validate(boolean calledFromNext) {
return tradeWizardPriceController.validate();
} else if (model.getSelectedChildTarget().get() == NavigationTarget.TRADE_WIZARD_AMOUNT) {
return tradeWizardAmountController.validate();
} else if (calledFromNext && model.getSelectedChildTarget().get() == NavigationTarget.TRADE_WIZARD_BITCOIN_PAYMENT_METHOD) {
// For PaymentMethod we tolerate to go back without having one selected
return tradeWizardBitcoinPaymentMethodController.validate();
} else if (calledFromNext && model.getSelectedChildTarget().get() == NavigationTarget.TRADE_WIZARD_FIAT_PAYMENT_METHOD) {
} else if (calledFromNext && model.getSelectedChildTarget().get() == NavigationTarget.TRADE_WIZARD_PAYMENT_METHODS) {
// For PaymentMethod we tolerate to go back without having one selected
return tradeWizardFiatPaymentMethodController.validate();
return tradeWizardPaymentMethodsController.validate();
}
return true;
}
Expand All @@ -365,8 +355,7 @@ private void reset() {
tradeWizardMarketController.reset();
tradeWizardPriceController.reset();
tradeWizardAmountController.reset();
tradeWizardBitcoinPaymentMethodController.reset();
tradeWizardFiatPaymentMethodController.reset();
tradeWizardPaymentMethodsController.reset();
tradeWizardSelectOfferController.reset();
tradeWizardReviewController.reset();

Expand Down Expand Up @@ -395,14 +384,14 @@ private void setMainButtonsVisibleState(boolean value) {
}

private void handleFiatPaymentMethodsUpdate() {
ObservableList<FiatPaymentMethod> fiatPaymentMethods = tradeWizardFiatPaymentMethodController.getFiatPaymentMethods();
ObservableList<FiatPaymentMethod> fiatPaymentMethods = tradeWizardPaymentMethodsController.getFiatPaymentMethods();
tradeWizardSelectOfferController.setFiatPaymentMethods(fiatPaymentMethods);
tradeWizardAmountController.setFiatPaymentMethods(fiatPaymentMethods);
tradeWizardReviewController.setFiatPaymentMethods(fiatPaymentMethods);
}

private void handleBitcoinPaymentMethodsUpdate() {
ObservableList<BitcoinPaymentMethod> bitcoinPaymentMethods = tradeWizardBitcoinPaymentMethodController.getBitcoinPaymentMethods();
ObservableList<BitcoinPaymentMethod> bitcoinPaymentMethods = tradeWizardPaymentMethodsController.getBitcoinPaymentMethods();
tradeWizardSelectOfferController.setBitcoinPaymentMethods(bitcoinPaymentMethods);
tradeWizardAmountController.setBitcoinPaymentMethods(bitcoinPaymentMethods);
tradeWizardReviewController.setBitcoinPaymentMethods(bitcoinPaymentMethods);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ private Triple<HBox, Button, List<Label>> getProgressItems() {
priceProgressItemLabel = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.price"));
priceProgressItemLine = getHLine();
Label amount = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.amount"));
Label bitcoinPaymentMethod = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.bitcoinPaymentMethod"));
Label fiatPaymentMethod = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.fiatPaymentMethod"));
Label paymentMethods = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.paymentMethods"));
takeOfferProgressItem = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.takeOffer"));
takeOfferProgressLine = getHLine();
Label review = createAndGetProgressLabel(Res.get("bisqEasy.tradeWizard.progress.review"));
Expand All @@ -231,17 +230,15 @@ private Triple<HBox, Button, List<Label>> getProgressItems() {
getHLine(),
amount,
getHLine(),
bitcoinPaymentMethod,
getHLine(),
fiatPaymentMethod,
paymentMethods,
takeOfferProgressLine,
takeOfferProgressItem,
getHLine(),
review,
Spacer.fillHBox(),
closeButton);

return new Triple<>(hBox, closeButton, new ArrayList<>(List.of(direction, market, amount, bitcoinPaymentMethod, fiatPaymentMethod, takeOfferProgressItem, review)));
return new Triple<>(hBox, closeButton, new ArrayList<>(List.of(direction, market, amount, paymentMethods, takeOfferProgressItem, review)));
}

private Region getHLine() {
Expand Down

This file was deleted.

Loading
Loading