Skip to content

Commit

Permalink
Improve visibility of messages with scroll down indicator
Browse files Browse the repository at this point in the history
* Apply a gradient buffer when scroll down icon is shown to make a
  smooth disappearance and improve experience.
* Change icons to better fit the scroll down icon and number of messages
  indicator in the chat window.

Resolves bisq-network#1776
  • Loading branch information
axpoems committed Mar 18, 2024
1 parent e22d69a commit 617b28a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ private static class View extends bisq.desktop.common.view.View<StackPane, Model
private final BisqTooltip scrollDownTooltip;
private final Label placeholderTitle = new Label("");
private final Label placeholderDescription = new Label("");
private final Pane scrollDownBackground;
private Optional<ScrollBar> scrollBar = Optional.empty();
private Subscription hasUnreadMessagesPin, showScrolledDownButtonPin;
private Timeline fadeInScrollDownBadgeTimeline;
Expand All @@ -774,22 +775,25 @@ private View(Model model, Controller controller) {
listView.setSelectionModel(new NoSelectionModel<>());
VBox.setVgrow(listView, Priority.ALWAYS);

scrollDownImageView = new ImageView();
scrollDownBackground = new Pane();
scrollDownBackground.getStyleClass().add("scroll-down-bg");

scrollDownImageView = new ImageView();
scrollDownBadge = new Badge(scrollDownImageView);
scrollDownBadge.setMaxSize(25, 25);
scrollDownBadge.getStyleClass().add("chat-messages-badge");
scrollDownBadge.setPosition(Pos.BOTTOM_RIGHT);
scrollDownBadge.setBadgeInsets(new Insets(20, 10, 0, 50));
scrollDownBadge.setBadgeInsets(new Insets(20, 10, -2, 55));
scrollDownBadge.setCursor(Cursor.HAND);

scrollDownTooltip = new BisqTooltip(Res.get("chat.listView.scrollDown"));
Tooltip.install(scrollDownBadge, scrollDownTooltip);

StackPane.setAlignment(scrollDownBadge, Pos.BOTTOM_CENTER);
StackPane.setMargin(scrollDownBadge, new Insets(0, 0, 10, 0));
StackPane.setAlignment(scrollDownBackground, Pos.BOTTOM_CENTER);
StackPane.setMargin(scrollDownBackground, new Insets(0, 15, 0, 0));
root.setAlignment(Pos.CENTER);
root.getChildren().addAll(listView, scrollDownBadge);
root.getChildren().addAll(listView, scrollDownBackground, scrollDownBadge);
}

@Override
Expand All @@ -809,6 +813,9 @@ protected void onViewAttached() {
}
});

scrollDownBackground.visibleProperty().bind(model.getShowScrolledDownButton());
scrollDownBackground.managedProperty().bind(model.getShowScrolledDownButton());

scrollDownBadge.textProperty().bind(model.numUnReadMessages);

scrollDownBadge.setOpacity(0);
Expand Down Expand Up @@ -853,6 +860,8 @@ protected void onViewAttached() {
protected void onViewDetached() {
scrollBar.ifPresent(scrollbar -> scrollbar.valueProperty().unbindBidirectional(model.getScrollValue()));
model.scrollBarVisible.unbind();
scrollDownBackground.visibleProperty().unbind();
scrollDownBackground.managedProperty().unbind();
scrollDownBadge.textProperty().unbind();
hasUnreadMessagesPin.unsubscribe();
showScrolledDownButtonPin.unsubscribe();
Expand Down
7 changes: 7 additions & 0 deletions apps/desktop/desktop/src/main/resources/css/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@
-fx-underline: true;
}

.scroll-down-bg {
-fx-min-height: 38;
-fx-max-height: 38;
-fx-pref-height: 38;
-fx-background-color: linear-gradient(to top, rgba(28, 28, 28, 1) 0%, rgba(28, 28, 28, 0.9) 40%, rgba(28, 28, 28, 0) 100%); /* -bisq-dark-grey-20 */
}

.chat-messages-badge.bisq-badge .badge-pane {
-fx-background-color: transparent;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 617b28a

Please sign in to comment.