Skip to content

Commit

Permalink
Add highlight when payments filter is active
Browse files Browse the repository at this point in the history
  • Loading branch information
axpoems committed Aug 25, 2024
1 parent fe35e60 commit fcd9b8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class OfferbookListView extends bisq.desktop.common.view.View<VBox, Offer
private static final double COLLAPSED_LIST_WIDTH = BisqEasyOfferbookView.COLLAPSED_LIST_WIDTH;
private static final double HEADER_HEIGHT = BaseChatView.HEADER_HEIGHT;
private static final double LIST_CELL_HEIGHT = BisqEasyOfferbookView.LIST_CELL_HEIGHT;
private static final String ACTIVE_PAYMENT_FILTER_CLASS = "active-payment-filter";

private final Label title;
private final BisqTableView<OfferbookListItem> tableView;
Expand All @@ -74,7 +75,8 @@ public class OfferbookListView extends bisq.desktop.common.view.View<VBox, Offer
private final ListChangeListener<FiatPaymentMethod> listChangeListener;
private DropdownBisqMenuItem buyFromOffers, sellToOffers;
private Label offerDirectionFilterLabel, paymentsFilterLabel;
private Subscription showOfferListExpandedPin, showBuyFromOffersPin, offerListTableViewSelectionPin;
private Subscription showOfferListExpandedPin, showBuyFromOffersPin,
offerListTableViewSelectionPin, activeMarketPaymentsCountPin;

OfferbookListView(OfferbookListModel model, OfferbookListController controller) {
super(new VBox(), model, controller);
Expand Down Expand Up @@ -175,6 +177,16 @@ protected void onViewAttached() {
}
});

activeMarketPaymentsCountPin = EasyBind.subscribe(model.getActiveMarketPaymentsCount(), count -> {
if (count.intValue() != 0) {
if (!paymentsFilterLabel.getStyleClass().contains(ACTIVE_PAYMENT_FILTER_CLASS)) {
paymentsFilterLabel.getStyleClass().add(ACTIVE_PAYMENT_FILTER_CLASS);
}
} else {
paymentsFilterLabel.getStyleClass().remove(ACTIVE_PAYMENT_FILTER_CLASS);
}
});

model.getAvailableMarketPayments().addListener(listChangeListener);
updateMarketPaymentFilters();

Expand All @@ -193,6 +205,7 @@ protected void onViewDetached() {
showOfferListExpandedPin.unsubscribe();
offerListTableViewSelectionPin.unsubscribe();
showBuyFromOffersPin.unsubscribe();
activeMarketPaymentsCountPin.unsubscribe();

model.getAvailableMarketPayments().removeListener(listChangeListener);

Expand Down Expand Up @@ -474,7 +487,7 @@ protected void updateItem(OfferbookListItem item, boolean empty) {
private static final class PaymentMenuItem extends DropdownMenuItem {
private static final PseudoClass SELECTED_PSEUDO_CLASS = PseudoClass.getPseudoClass("selected");

PaymentMenuItem(Label displayLabel) {
private PaymentMenuItem(Label displayLabel) {
super("check-white", "check-white", displayLabel);

getStyleClass().add("dropdown-menu-item");
Expand Down
4 changes: 4 additions & 0 deletions apps/desktop/desktop/src/main/resources/css/bisq_easy.css
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@
-fx-padding: 0 5 0 5;
}

.active-payment-filter {
-fx-text-fill: -fx-light-text-color !important;
}

/* COLLAPSE AND EXPAND COLUMNS */
.collapsed-offer-list-container {
-fx-background-color: -bisq-dark-grey-20;
Expand Down

0 comments on commit fcd9b8f

Please sign in to comment.