From 2579415ec7619f5344b22355adc711040f653b44 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 13 Jan 2024 11:44:42 +0100 Subject: [PATCH 1/9] Introduce design changes in chats Change layout and margins of common chats. Towards #1541 --- .../controls/AutoCompleteComboBox.java | 2 +- .../desktop/main/content/chat/ChatView.java | 7 +- .../chat/common/pub/CommonPublicChatView.java | 3 +- .../components/ChatMessagesComponent.java | 214 ++++++++++-------- .../components/ChatMessagesListView.java | 16 +- .../content/components/CitationBlock.java | 5 +- .../desktop/src/main/resources/css/chat.css | 2 +- 7 files changed, 143 insertions(+), 106 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/AutoCompleteComboBox.java b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/AutoCompleteComboBox.java index ea167360d4..80a23e3f28 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/AutoCompleteComboBox.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/AutoCompleteComboBox.java @@ -92,6 +92,7 @@ public AutoCompleteComboBox(ObservableList items, String description, @Nullab @Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); + if (item != null && !empty) { if (editor.getText() != null) { skin.getMaterialTextField().update(); @@ -104,7 +105,6 @@ protected void updateItem(T item, boolean empty) { } else { editor.setText(""); } - } }); setAutocompleteItems(items); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatView.java index 2c59992702..3ebfed013f 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatView.java @@ -26,7 +26,7 @@ @Slf4j public class ChatView, M extends ChatModel> extends BaseChatView { protected static final double SIDE_PADDING = 40; - protected static final double CHAT_BOX_MAX_WIDTH = 1440; + protected static final double CHAT_BOX_MAX_WIDTH = 1200; public ChatView(ChatModel model, ChatController controller, @@ -42,9 +42,10 @@ protected void configTitleHBox() { @Override protected void configCenterVBox() { VBox.setVgrow(chatMessagesComponent, Priority.ALWAYS); - centerVBox.getStyleClass().add("bisq-easy-container"); - centerVBox.setMaxWidth(CHAT_BOX_MAX_WIDTH); + titleHBox.setMaxWidth(CHAT_BOX_MAX_WIDTH); centerVBox.getChildren().addAll(titleHBox, Layout.hLine(), chatMessagesComponent); + centerVBox.setAlignment(Pos.CENTER); + centerVBox.getStyleClass().add("bisq-easy-container"); centerVBox.setFillWidth(true); } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java index 72d090a8a0..7f4887068b 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java @@ -27,7 +27,8 @@ import javafx.scene.layout.Priority; public final class CommonPublicChatView extends ChatView { - public CommonPublicChatView(ChatModel model, CommonPublicChatController controller, Pane chatMessagesComponent, Pane channelInfo) { + public CommonPublicChatView(ChatModel model, CommonPublicChatController controller, + Pane chatMessagesComponent, Pane channelInfo) { super(model, controller, chatMessagesComponent, channelInfo); } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java index 5edf230a99..1ca546e88b 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java @@ -61,6 +61,7 @@ import javafx.scene.control.Label; import javafx.scene.input.KeyCode; import javafx.scene.layout.*; +import javafx.scene.paint.Color; import javafx.scene.text.TextAlignment; import javafx.util.StringConverter; import lombok.Getter; @@ -532,17 +533,18 @@ public void setSelectedAccount(Account> selectedAc @Slf4j public static class View extends bisq.desktop.common.view.View { + private final static double CHAT_BOX_MAX_WIDTH = 1200; public final static String EDITED_POST_FIX = " " + Res.get("chat.message.wasEdited"); - private final BisqTextArea inputField; - private final Button sendButton; - - private final ChatMentionPopupMenu userMentionPopup; - private final ChatMentionPopupMenu> channelMentionPopup; - private final Pane userProfileSelectionRoot, messagesListView; - private final Button leaveChannelButton, createOfferButton; - private final VBox emptyMessageList; - private final ChangeListener createOfferButtonHeightListener; + private final BisqTextArea inputField = new BisqTextArea(); + private final Button sendButton = new Button(); + private final Pane messagesListView; + private final VBox emptyMessageList = new VBox(); + private ChatMentionPopupMenu userMentionPopup; + private ChatMentionPopupMenu> channelMentionPopup; + private ChangeListener createOfferButtonHeightListener; + private Pane userProfileSelectionRoot; + private Button leaveChannelButton, createOfferButton; private View(Model model, Controller controller, @@ -552,94 +554,16 @@ private View(Model model, super(new VBox(), model, controller); this.messagesListView = messagesListView; - - inputField = new BisqTextArea(); - inputField.setPromptText(Res.get("chat.message.input.prompt")); - inputField.getStyleClass().addAll("chat-input-field", "normal-text"); - - sendButton = new Button("", ImageUtil.getImageViewById("chat-send")); - sendButton.setId("chat-messages-send-button"); - sendButton.setPadding(new Insets(5)); - sendButton.setMinWidth(31); - sendButton.setMaxWidth(31); - sendButton.setTooltip(new BisqTooltip(Res.get("chat.message.input.send"), true)); - - StackPane.setAlignment(inputField, Pos.CENTER_LEFT); - StackPane.setAlignment(sendButton, Pos.CENTER_RIGHT); - StackPane.setMargin(sendButton, new Insets(0, 5, 0, 0)); - StackPane bottomBoxStackPane = new StackPane(inputField, sendButton); - - userProfileSelection.setMaxComboBoxWidth(165); - userProfileSelection.setConverter(new StringConverter<>() { - @Override - public String toString(UserProfileSelection.ListItem item) { - return item != null ? StringUtils.truncate(item.getUserIdentity().getUserName(), 10) : ""; - } - - @Override - public UserProfileSelection.ListItem fromString(String string) { - return null; - } - }); - userProfileSelectionRoot = userProfileSelection.getRoot(); - userProfileSelectionRoot.setMaxHeight(44); - userProfileSelectionRoot.setMaxWidth(165); - userProfileSelectionRoot.setMinWidth(165); - userProfileSelectionRoot.setId("chat-user-profile-bg"); - - HBox.setHgrow(bottomBoxStackPane, Priority.ALWAYS); - HBox.setMargin(userProfileSelectionRoot, new Insets(0, -20, 0, -8)); - HBox bottomHBox = new HBox(10); - - leaveChannelButton = createAndGetChatButton(Res.get("chat.leave"), 120); - leaveChannelButton.getStyleClass().add("outlined-button"); - - Label noChatsPlaceholderTitle = new Label(Res.get("chat.private.messagebox.noChats.placeholder.title")); - noChatsPlaceholderTitle.getStyleClass().add("large-text"); - noChatsPlaceholderTitle.setTextAlignment(TextAlignment.CENTER); - - Label noChatsPlaceholderDescription = new Label(Res.get("chat.private.messagebox.noChats.placeholder.description")); - noChatsPlaceholderDescription.getStyleClass().add("normal-text"); - noChatsPlaceholderDescription.setTextAlignment(TextAlignment.CENTER); - - emptyMessageList = new VBox(10, noChatsPlaceholderTitle, noChatsPlaceholderDescription); - emptyMessageList.setAlignment(Pos.CENTER); - emptyMessageList.getStyleClass().add("chat-container-placeholder-text"); - VBox.setVgrow(emptyMessageList, Priority.ALWAYS); - - createOfferButton = new Button(Res.get("offer.createOffer")); - createOfferButton.getStyleClass().addAll("create-offer-button", "normal-text"); - createOfferButton.setMinWidth(170); - - bottomHBox.getChildren().addAll(createOfferButton, userProfileSelectionRoot, bottomBoxStackPane, leaveChannelButton); - bottomHBox.getStyleClass().add("bg-grey-5"); - bottomHBox.setAlignment(Pos.CENTER); - bottomHBox.setPadding(new Insets(14, 25, 14, 25)); - VBox.setVgrow(messagesListView, Priority.ALWAYS); - root.getChildren().addAll(emptyMessageList, messagesListView, quotedMessageBlock, bottomHBox); - userMentionPopup = new ChatMentionPopupMenu<>(inputField); - userMentionPopup.setItemDisplayConverter(UserProfile::getUserName); - userMentionPopup.setSelectionHandler(controller::listUserNamesHandler); + setUpEmptyMessageList(); - channelMentionPopup = new ChatMentionPopupMenu<>(inputField); - channelMentionPopup.setItemDisplayConverter(model::getChannelTitle); - channelMentionPopup.setSelectionHandler(controller::listChannelsHandler); + VBox bottomBarContainer = createBottomBar(userProfileSelection); - createOfferButtonHeightListener = new ChangeListener<>() { - @Override - public void changed(ObservableValue observable, Number oldValue, Number newValue) { - if (newValue != null) { - createOfferButton.setMinHeight(inputField.getHeight()); - createOfferButton.setMaxHeight(inputField.getHeight()); - createOfferButton.setPrefHeight(inputField.getHeight()); - } else { - UIThread.runOnNextRenderFrame(() -> inputField.heightProperty().removeListener(createOfferButtonHeightListener)); - } - } - }; - inputField.heightProperty().addListener(createOfferButtonHeightListener); + quotedMessageBlock.setMaxWidth(CHAT_BOX_MAX_WIDTH); + + root.setAlignment(Pos.CENTER); + root.getChildren().addAll(messagesListView, emptyMessageList, quotedMessageBlock, bottomBarContainer); } @Override @@ -704,6 +628,109 @@ protected void onViewDetached() { createOfferButton.setOnAction(null); } + private void setUpEmptyMessageList() { + Label noChatsPlaceholderTitle = new Label(Res.get("chat.private.messagebox.noChats.placeholder.title")); + noChatsPlaceholderTitle.getStyleClass().add("large-text"); + noChatsPlaceholderTitle.setTextAlignment(TextAlignment.CENTER); + + Label noChatsPlaceholderDescription = new Label(Res.get("chat.private.messagebox.noChats.placeholder.description")); + noChatsPlaceholderDescription.getStyleClass().add("normal-text"); + noChatsPlaceholderDescription.setTextAlignment(TextAlignment.CENTER); + + emptyMessageList.setSpacing(10); + emptyMessageList.getChildren().addAll(noChatsPlaceholderTitle, noChatsPlaceholderDescription); + emptyMessageList.setAlignment(Pos.CENTER); + emptyMessageList.getStyleClass().add("chat-container-placeholder-text"); + VBox.setVgrow(emptyMessageList, Priority.ALWAYS); + } + + private VBox createBottomBar(UserProfileSelection userProfileSelection) { + createOfferButton = createAndGetCreateOfferButton(); + setUpUserProfileSelection(userProfileSelection); + HBox sendMessageBox = createSendMessageBox(); + leaveChannelButton = createAndGetChatButton(Res.get("chat.leave"), 120); // TODO: Remove this. Need a better solution for this use-case. + + HBox bottomBar = new HBox(10); + bottomBar.getChildren().addAll(createOfferButton, userProfileSelectionRoot, sendMessageBox, leaveChannelButton); + bottomBar.setMaxWidth(CHAT_BOX_MAX_WIDTH); + //bottomBar.setBackground(new Background(new BackgroundFill(Color.BEIGE, CornerRadii.EMPTY, Insets.EMPTY))); + bottomBar.setPadding(new Insets(14, 25, 14, 25)); + bottomBar.setAlignment(Pos.CENTER); + //HBox.setHgrow(bottomBar, Priority.ALWAYS); + + VBox bottomBarContainer = new VBox(bottomBar); + bottomBarContainer.setAlignment(Pos.CENTER); + //bottomBarContainer.setBackground(new Background(new BackgroundFill(Color.PINK, CornerRadii.EMPTY, Insets.EMPTY))); + return bottomBarContainer; + } + + private HBox createSendMessageBox() { + inputField.setPromptText(Res.get("chat.message.input.prompt")); + inputField.getStyleClass().addAll("chat-input-field", "normal-text"); + setUpInputFieldAtMentions(); + + sendButton.setGraphic(ImageUtil.getImageViewById("chat-send")); + sendButton.setId("chat-messages-send-button"); + sendButton.setPadding(new Insets(5)); + sendButton.setMinWidth(31); + sendButton.setMaxWidth(31); + sendButton.setTooltip(new BisqTooltip(Res.get("chat.message.input.send"), true)); + + HBox sendMessageBox = new HBox(10, inputField, sendButton); + // sendMessageBox.getStyleClass().addAll("chat-input-field", "normal-text"); + // TODO: Change this with design + return sendMessageBox; + } + + private void setUpInputFieldAtMentions() { + userMentionPopup = new ChatMentionPopupMenu<>(inputField); + userMentionPopup.setItemDisplayConverter(UserProfile::getUserName); + userMentionPopup.setSelectionHandler(controller::listUserNamesHandler); + + channelMentionPopup = new ChatMentionPopupMenu<>(inputField); + channelMentionPopup.setItemDisplayConverter(model::getChannelTitle); + channelMentionPopup.setSelectionHandler(controller::listChannelsHandler); + } + + private Button createAndGetCreateOfferButton() { + Button createOfferButton = new Button(Res.get("offer.createOffer")); + createOfferButton.getStyleClass().addAll("create-offer-button", "normal-text"); + createOfferButton.setMinWidth(170); + + createOfferButtonHeightListener = (observable, oldValue, newValue) -> { + if (newValue != null) { + createOfferButton.setMinHeight(inputField.getHeight()); + createOfferButton.setMaxHeight(inputField.getHeight()); + createOfferButton.setPrefHeight(inputField.getHeight()); + } else { + UIThread.runOnNextRenderFrame(() -> inputField.heightProperty().removeListener(createOfferButtonHeightListener)); + } + }; + inputField.heightProperty().addListener(createOfferButtonHeightListener); + return createOfferButton; + } + + private void setUpUserProfileSelection(UserProfileSelection userProfileSelection) { + userProfileSelection.setMaxComboBoxWidth(165); + userProfileSelection.setConverter(new StringConverter<>() { + @Override + public String toString(UserProfileSelection.ListItem item) { + return item != null ? StringUtils.truncate(item.getUserIdentity().getUserName(), 10) : ""; + } + + @Override + public UserProfileSelection.ListItem fromString(String string) { + return null; + } + }); + userProfileSelectionRoot = userProfileSelection.getRoot(); + userProfileSelectionRoot.setMaxHeight(44); + userProfileSelectionRoot.setMaxWidth(165); + userProfileSelectionRoot.setMinWidth(165); + userProfileSelectionRoot.setId("chat-user-profile-bg"); + HBox.setMargin(userProfileSelectionRoot, new Insets(0, -20, 0, -8)); + } + private void createChatDialogEnabledSubscription() { inputField.disableProperty().bind(model.getChatDialogEnabled().not()); sendButton.disableProperty().bind(model.getChatDialogEnabled().not()); @@ -730,6 +757,7 @@ private static Button createAndGetChatButton(String title, double width) { button.setStyle("-fx-label-padding: 0 -30 0 -30; -fx-background-radius: 8; -fx-border-radius: 8;"); button.setMinHeight(34); button.setMinWidth(width); + button.getStyleClass().add("outlined-button"); return button; } } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java index 10b34d2ab8..54ed338115 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java @@ -90,7 +90,6 @@ import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.layout.*; -import javafx.scene.text.Text; import javafx.util.Callback; import javafx.util.Duration; import lombok.EqualsAndHashCode; @@ -692,6 +691,7 @@ private View(Model model, Controller controller) { StackPane.setAlignment(scrollDownBadge, Pos.BOTTOM_RIGHT); StackPane.setMargin(scrollDownBadge, new Insets(0, 25, 20, 0)); + root.setAlignment(Pos.CENTER); root.getChildren().addAll(listView, scrollDownBadge); } @@ -787,12 +787,15 @@ public Callback>, ListCell> call(ListView> list) { return new ListCell<>() { + private final static double CHAT_BOX_MAX_WIDTH = 1200; + private final static double CHAT_MESSAGE_BOX_MAX_WIDTH = 700; + private final ReputationScoreDisplay reputationScoreDisplay; private final Button takeOfferButton, removeOfferButton; private final Label message, userName, dateTime, replyIcon, pmIcon, editIcon, deleteIcon, copyIcon, moreOptionsIcon, supportedLanguages; private final Label deliveryState; - private final Text quotedMessageField; + private final Label quotedMessageField = new Label(); private final BisqTextArea editInputField; private final Button saveEditButton, cancelEditButton; private final VBox mainVBox, quotedMessageVBox; @@ -818,7 +821,7 @@ public ListCell> call(ListView> call(ListView> call(ListView item, bo deliveryState.getTooltip().textProperty().bind(item.messageDeliveryStatusTooltip); editInputField.maxWidthProperty().bind(message.widthProperty()); setGraphic(cellHBox); + setAlignment(Pos.CENTER); } private void buildPeerMessage(ChatMessageListItem item, boolean isBisqEasyPublicChatMessageWithOffer, VBox userProfileIconVbox, ChatMessage chatMessage) { @@ -1397,4 +1403,4 @@ public void dispose() { statusPins.forEach(Pin::unbind); } } -} \ No newline at end of file +} diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/CitationBlock.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/CitationBlock.java index 0ea12d28d6..a61ab08e14 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/CitationBlock.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/CitationBlock.java @@ -129,7 +129,7 @@ public static class View extends bisq.desktop.common.view.View Date: Sat, 13 Jan 2024 12:59:24 +0100 Subject: [PATCH 2/9] Improve chat view bottom bar and list view margins Relates to #1541 Resolves #1542 --- .../components/controls/BisqTextArea.java | 7 +++-- .../components/ChatMessagesComponent.java | 27 +++++++++---------- .../components/ChatMessagesListView.java | 21 ++++++++++++--- .../desktop/src/main/resources/css/chat.css | 24 +++++++---------- 4 files changed, 45 insertions(+), 34 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/BisqTextArea.java b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/BisqTextArea.java index 0433abaf6d..6faf9f04a9 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/BisqTextArea.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/BisqTextArea.java @@ -137,7 +137,10 @@ private void adjustHeight() { } else { selectorScrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); } - setMinHeight(textHeight + INITIAL_HEIGHT); - setMaxHeight(textHeight + INITIAL_HEIGHT); + double newHeight = textHeight + INITIAL_HEIGHT; + setMinHeight(newHeight); + + // Set max height dynamically or remove if not needed + setMaxHeight(Math.min(newHeight, 300)); // FIXME: max width not being applied } } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java index 1ca546e88b..37e99e2a70 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java @@ -52,7 +52,6 @@ import javafx.beans.binding.Bindings; import javafx.beans.property.*; import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; @@ -61,7 +60,6 @@ import javafx.scene.control.Label; import javafx.scene.input.KeyCode; import javafx.scene.layout.*; -import javafx.scene.paint.Color; import javafx.scene.text.TextAlignment; import javafx.util.StringConverter; import lombok.Getter; @@ -648,37 +646,38 @@ private VBox createBottomBar(UserProfileSelection userProfileSelection) { createOfferButton = createAndGetCreateOfferButton(); setUpUserProfileSelection(userProfileSelection); HBox sendMessageBox = createSendMessageBox(); - leaveChannelButton = createAndGetChatButton(Res.get("chat.leave"), 120); // TODO: Remove this. Need a better solution for this use-case. + + // TODO: Remove this. We need a better solution for this use-case. + leaveChannelButton = createAndGetChatButton(Res.get("chat.leave"), 120); HBox bottomBar = new HBox(10); bottomBar.getChildren().addAll(createOfferButton, userProfileSelectionRoot, sendMessageBox, leaveChannelButton); bottomBar.setMaxWidth(CHAT_BOX_MAX_WIDTH); - //bottomBar.setBackground(new Background(new BackgroundFill(Color.BEIGE, CornerRadii.EMPTY, Insets.EMPTY))); - bottomBar.setPadding(new Insets(14, 25, 14, 25)); - bottomBar.setAlignment(Pos.CENTER); - //HBox.setHgrow(bottomBar, Priority.ALWAYS); + bottomBar.setPadding(new Insets(14, 20, 14, 20)); VBox bottomBarContainer = new VBox(bottomBar); bottomBarContainer.setAlignment(Pos.CENTER); - //bottomBarContainer.setBackground(new Background(new BackgroundFill(Color.PINK, CornerRadii.EMPTY, Insets.EMPTY))); return bottomBarContainer; } private HBox createSendMessageBox() { inputField.setPromptText(Res.get("chat.message.input.prompt")); inputField.getStyleClass().addAll("chat-input-field", "normal-text"); + inputField.setPadding(new Insets(5, 0, 5, 5)); + HBox.setHgrow(inputField, Priority.ALWAYS); setUpInputFieldAtMentions(); sendButton.setGraphic(ImageUtil.getImageViewById("chat-send")); sendButton.setId("chat-messages-send-button"); - sendButton.setPadding(new Insets(5)); - sendButton.setMinWidth(31); - sendButton.setMaxWidth(31); + sendButton.setPadding(new Insets(5, 5, 5, 0)); + sendButton.setMinWidth(30); + sendButton.setMaxWidth(30); sendButton.setTooltip(new BisqTooltip(Res.get("chat.message.input.send"), true)); - HBox sendMessageBox = new HBox(10, inputField, sendButton); - // sendMessageBox.getStyleClass().addAll("chat-input-field", "normal-text"); - // TODO: Change this with design + HBox sendMessageBox = new HBox(inputField, sendButton); + sendMessageBox.getStyleClass().add("chat-send-message-box"); + sendMessageBox.setAlignment(Pos.CENTER); + HBox.setHgrow(sendMessageBox, Priority.ALWAYS); return sendMessageBox; } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java index 54ed338115..373e1fea01 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java @@ -202,6 +202,9 @@ public void onActivate() { scrollBarVisiblePin = EasyBind.subscribe(model.scrollBarVisible, scrollBarVisible -> { if (scrollBarVisible != null && scrollBarVisible) { applyScrollValue(1); + view.listView.setPadding(View.LISTVIEW_PADDING_WITH_SCROLLBAR); + } else { + view.listView.setPadding(new Insets(0)); } }); @@ -653,10 +656,10 @@ boolean hasTradeChatOffer(ChatMessage chatMessage) { @Slf4j private static class View extends bisq.desktop.common.view.View { - private final static String EDITED_POST_FIX = " " + Res.get("chat.message.wasEdited"); + public static final Insets LISTVIEW_PADDING_WITH_SCROLLBAR = new Insets(0, 0, 0, 15); + private static final String EDITED_POST_FIX = " " + Res.get("chat.message.wasEdited"); private final ListView> listView; - private final ImageView scrollDownImageView; private final Badge scrollDownBadge; private final BisqTooltip scrollDownTooltip; @@ -676,8 +679,8 @@ private View(Model model, Controller controller) { // https://stackoverflow.com/questions/20621752/javafx-make-listview-not-selectable-via-mouse listView.setSelectionModel(new NoSelectionModel<>()); - VBox.setVgrow(listView, Priority.ALWAYS); + scrollDownImageView = new ImageView(); scrollDownImageView.setCursor(Cursor.HAND); scrollDownTooltip = new BisqTooltip(Res.get("chat.listView.scrollDown")); @@ -741,6 +744,8 @@ protected void onViewAttached() { }); scrollDownImageView.setOnMouseClicked(e -> controller.onScrollToBottom()); + + UIThread.runOnNextRenderFrame(this::adjustPadding); } @Override @@ -782,6 +787,14 @@ private void fadeInScrollDownBadge() { fadeInScrollDownBadgeTimeline.play(); } + private void adjustPadding() { + Optional scrollBar = ListViewUtil.findScrollbar(listView, Orientation.VERTICAL); + scrollBar.ifPresent(bar -> + listView.setPadding( + bar.isVisible() ? LISTVIEW_PADDING_WITH_SCROLLBAR : new Insets(0)) + ); + } + public Callback>, ListCell>> getCellFactory() { return new Callback<>() { @Override @@ -878,7 +891,7 @@ public ListCell> call(ListView Date: Sat, 13 Jan 2024 20:46:06 +0100 Subject: [PATCH 3/9] Change layout to new chat design for private chats Relates to #1514 --- .../bisq/desktop/main/content/chat/priv/PrivateChatsView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/priv/PrivateChatsView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/priv/PrivateChatsView.java index 5c7c0d88f9..9bb8b39823 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/priv/PrivateChatsView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/priv/PrivateChatsView.java @@ -104,14 +104,16 @@ private void addChatBox() { chatHeaderHBox.setAlignment(Pos.CENTER_LEFT); chatHeaderHBox.setPadding(new Insets(15, 30, 15, 30)); chatHeaderHBox.getStyleClass().add("bisq-easy-container-header"); + chatHeaderHBox.setMaxWidth(CHAT_BOX_MAX_WIDTH); VBox.setMargin(chatMessagesComponent, new Insets(0, 30, 15, 30)); VBox.setVgrow(chatMessagesComponent, Priority.ALWAYS); VBox chatVBox = new VBox(chatHeaderHBox, Layout.hLine(), chatMessagesComponent); chatVBox.getStyleClass().add("bisq-easy-container"); + chatVBox.setAlignment(Pos.CENTER); VBox.setVgrow(chatVBox, Priority.ALWAYS); - centerVBox.setMaxWidth(CHAT_BOX_MAX_WIDTH); + centerVBox.setAlignment(Pos.CENTER); centerVBox.setFillWidth(true); centerVBox.getChildren().add(chatVBox); } From 1177193399b275ac3f38192a6d90eb274a9f6f7d Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 13 Jan 2024 20:56:06 +0100 Subject: [PATCH 4/9] Change layout to new chat design in offerbook Relates to #1514 --- .../content/bisq_easy/offerbook/BisqEasyOfferbookView.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index 9ee5f32620..a6c383d381 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -38,7 +38,7 @@ @Slf4j public final class BisqEasyOfferbookView extends BaseChatView { - private static final double CHAT_BOX_MAX_WIDTH = 1440; + private static final double CHAT_BOX_MAX_WIDTH = 1200; // private static double filterPaneHeight; private final BisqEasyOfferbookModel bisqEasyOfferbookModel; @@ -72,6 +72,7 @@ protected void configTitleHBox() { titleHBox.getStyleClass().add("bisq-easy-container-header"); titleHBox.setMinHeight(HEADER_HEIGHT); titleHBox.setMaxHeight(HEADER_HEIGHT); + titleHBox.setMaxWidth(CHAT_BOX_MAX_WIDTH); channelTitle.getStyleClass().add("chat-header-title"); channelTitle.setCursor(Cursor.HAND); @@ -114,7 +115,6 @@ protected void configTitleHBox() { protected void configCenterVBox() { centerVBox.setSpacing(0); centerVBox.setFillWidth(true); - centerVBox.setMaxWidth(CHAT_BOX_MAX_WIDTH); /* filterButton = new Button(Res.get("bisqEasy.topPane.filter")); ImageView filterIcon = ImageUtil.getImageViewById("filter"); @@ -146,6 +146,7 @@ protected void configCenterVBox() { VBox.setVgrow(chatMessagesComponent, Priority.ALWAYS); centerVBox.getChildren().addAll(titleHBox, Layout.hLine(), chatMessagesComponent); centerVBox.getStyleClass().add("bisq-easy-container"); + centerVBox.setAlignment(Pos.CENTER); } @Override From a878ba82fdaeb896f6269014df89252a39269e42 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 13 Jan 2024 21:02:46 +0100 Subject: [PATCH 5/9] Change max size for chat messages --- .../desktop/main/content/components/ChatMessagesListView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java index 373e1fea01..ad0cf4d83b 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java @@ -801,7 +801,7 @@ public Callback>, ListCell> call(ListView> list) { return new ListCell<>() { private final static double CHAT_BOX_MAX_WIDTH = 1200; - private final static double CHAT_MESSAGE_BOX_MAX_WIDTH = 700; + private final static double CHAT_MESSAGE_BOX_MAX_WIDTH = 630; private final ReputationScoreDisplay reputationScoreDisplay; private final Button takeOfferButton, removeOfferButton; From 8d88cfec7e3a549869188d189482a5fb46d5acb4 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:16:18 +0100 Subject: [PATCH 6/9] Set placeholder for common chats --- .../desktop/main/content/chat/ChatUtil.java | 26 +++++++++++++++++++ .../components/ChatMessagesComponent.java | 24 ++++------------- .../components/ChatMessagesListView.java | 15 +++++++++-- i18n/src/main/resources/chat.properties | 2 ++ 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatUtil.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatUtil.java index 756627e970..47139e678d 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatUtil.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/ChatUtil.java @@ -1,7 +1,13 @@ package bisq.desktop.main.content.chat; import bisq.bisq_easy.NavigationTarget; +import bisq.chat.ChatChannelDomain; import bisq.desktop.main.content.chat.common.ChannelTabButtonModel; +import javafx.geometry.Pos; +import javafx.scene.control.Label; +import javafx.scene.layout.Priority; +import javafx.scene.layout.VBox; +import javafx.scene.text.TextAlignment; import java.util.Comparator; import java.util.Map; @@ -28,4 +34,24 @@ public int compare(ChannelTabButtonModel lhs, ChannelTabButtonModel rhs) { public static String getChannelIconId(String channelId) { return "channels-" + channelId.replace(".", "-"); } + + public static VBox createEmptyChatPlaceholder(Label emptyChatPlaceholderTitle, Label emptyChatPlaceholderDescription) { + emptyChatPlaceholderTitle.getStyleClass().add("large-text"); + emptyChatPlaceholderTitle.setTextAlignment(TextAlignment.CENTER); + + emptyChatPlaceholderDescription.getStyleClass().add("normal-text"); + emptyChatPlaceholderDescription.setTextAlignment(TextAlignment.CENTER); + + VBox emptyChatPlaceholder = new VBox(10, emptyChatPlaceholderTitle, emptyChatPlaceholderDescription); + emptyChatPlaceholder.setAlignment(Pos.CENTER); + emptyChatPlaceholder.getStyleClass().add("chat-container-placeholder-text"); + VBox.setVgrow(emptyChatPlaceholder, Priority.ALWAYS); + return emptyChatPlaceholder; + } + + public static boolean isCommonChat(ChatChannelDomain chatChannelDomain) { + return chatChannelDomain.equals(ChatChannelDomain.DISCUSSION) + || chatChannelDomain.equals(ChatChannelDomain.EVENTS) + || chatChannelDomain.equals(ChatChannelDomain.SUPPORT); + } } diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java index 37e99e2a70..b9d911c321 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java @@ -40,6 +40,7 @@ import bisq.desktop.components.controls.BisqTooltip; import bisq.desktop.components.overlay.Popup; import bisq.desktop.main.content.bisq_easy.trade_wizard.TradeWizardController; +import bisq.desktop.main.content.chat.ChatUtil; import bisq.i18n.Res; import bisq.offer.Direction; import bisq.offer.bisq_easy.BisqEasyOffer; @@ -60,7 +61,6 @@ import javafx.scene.control.Label; import javafx.scene.input.KeyCode; import javafx.scene.layout.*; -import javafx.scene.text.TextAlignment; import javafx.util.StringConverter; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -537,7 +537,7 @@ public static class View extends bisq.desktop.common.view.View userMentionPopup; private ChatMentionPopupMenu> channelMentionPopup; private ChangeListener createOfferButtonHeightListener; @@ -554,7 +554,9 @@ private View(Model model, this.messagesListView = messagesListView; VBox.setVgrow(messagesListView, Priority.ALWAYS); - setUpEmptyMessageList(); + emptyMessageList = ChatUtil.createEmptyChatPlaceholder( + new Label(Res.get("chat.private.messagebox.noChats.placeholder.title")), + new Label(Res.get("chat.private.messagebox.noChats.placeholder.description"))); VBox bottomBarContainer = createBottomBar(userProfileSelection); @@ -626,22 +628,6 @@ protected void onViewDetached() { createOfferButton.setOnAction(null); } - private void setUpEmptyMessageList() { - Label noChatsPlaceholderTitle = new Label(Res.get("chat.private.messagebox.noChats.placeholder.title")); - noChatsPlaceholderTitle.getStyleClass().add("large-text"); - noChatsPlaceholderTitle.setTextAlignment(TextAlignment.CENTER); - - Label noChatsPlaceholderDescription = new Label(Res.get("chat.private.messagebox.noChats.placeholder.description")); - noChatsPlaceholderDescription.getStyleClass().add("normal-text"); - noChatsPlaceholderDescription.setTextAlignment(TextAlignment.CENTER); - - emptyMessageList.setSpacing(10); - emptyMessageList.getChildren().addAll(noChatsPlaceholderTitle, noChatsPlaceholderDescription); - emptyMessageList.setAlignment(Pos.CENTER); - emptyMessageList.getStyleClass().add("chat-container-placeholder-text"); - VBox.setVgrow(emptyMessageList, Priority.ALWAYS); - } - private VBox createBottomBar(UserProfileSelection userProfileSelection) { createOfferButton = createAndGetCreateOfferButton(); setUpUserProfileSelection(userProfileSelection); diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java index ad0cf4d83b..6427c00eae 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesListView.java @@ -51,6 +51,7 @@ import bisq.desktop.components.list_view.NoSelectionModel; import bisq.desktop.components.overlay.Popup; import bisq.desktop.main.content.bisq_easy.take_offer.TakeOfferController; +import bisq.desktop.main.content.chat.ChatUtil; import bisq.i18n.Res; import bisq.network.NetworkService; import bisq.network.identity.NetworkId; @@ -663,6 +664,9 @@ private static class View extends bisq.desktop.common.view.View scrollBar = Optional.empty(); private Subscription hasUnreadMessagesPin, showScrolledDownButtonPin; private Timeline fadeInScrollDownBadgeTimeline; @@ -673,8 +677,8 @@ private View(Model model, Controller controller) { listView = new ListView<>(model.getSortedChatMessages()); listView.getStyleClass().add("chat-messages-list-view"); - //Label placeholder = new Label(Res.get("data.noDataAvailable")); - //listView.setPlaceholder(placeholder); + placeholder = ChatUtil.createEmptyChatPlaceholder(placeholderTitle, placeholderDescription); + listView.setCellFactory(getCellFactory()); // https://stackoverflow.com/questions/20621752/javafx-make-listview-not-selectable-via-mouse @@ -746,6 +750,13 @@ protected void onViewAttached() { scrollDownImageView.setOnMouseClicked(e -> controller.onScrollToBottom()); UIThread.runOnNextRenderFrame(this::adjustPadding); + + if (ChatUtil.isCommonChat(model.getChatChannelDomain()) && model.isPublicChannel.get()) { + placeholderTitle.setText(Res.get("chat.messagebox.noChats.placeholder.title")); + placeholderDescription.setText(Res.get("chat.messagebox.noChats.placeholder.description", + model.getSelectedChannel().get().getDisplayString())); + listView.setPlaceholder(placeholder); + } } @Override diff --git a/i18n/src/main/resources/chat.properties b/i18n/src/main/resources/chat.properties index fd43209752..9428fbd1e1 100644 --- a/i18n/src/main/resources/chat.properties +++ b/i18n/src/main/resources/chat.properties @@ -94,6 +94,8 @@ support.reports.description=Channel for incident and fraud report chat.leave=Leave chat chat.leave.warn=Are you sure you want to leave that private channel with ''{0}''.\n\ All data will be deleted if you leave the channel. +chat.messagebox.noChats.placeholder.title=Start the conversation! +chat.messagebox.noChats.placeholder.description=Join the discussion on {0} to share your thoughts and ask questions. ###################################################### From 0e38f90bdbdccff7369f6a59ddaf812bd3a0ce30 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:39:37 +0100 Subject: [PATCH 7/9] Modify searchBox style Relates to #1541 --- .../java/bisq/desktop/components/controls/SearchBox.java | 2 +- .../content/chat/common/pub/CommonPublicChatView.java | 8 ++++---- apps/desktop/desktop/src/main/resources/css/controls.css | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/SearchBox.java b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/SearchBox.java index 22fd082a00..2819875d78 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/SearchBox.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/components/controls/SearchBox.java @@ -98,4 +98,4 @@ private void applyStyle(boolean isFocused) { getStyleClass().remove(activeStyle); } } -} \ No newline at end of file +} diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java index 7f4887068b..d7a74d15b4 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/common/pub/CommonPublicChatView.java @@ -49,10 +49,10 @@ protected void configTitleHBox() { channelDescription.getStyleClass().add("chat-header-description"); searchBox.setMaxWidth(200); - searchBox.setMaxHeight(searchBox.getMinHeight()); - searchBox.setDefaultStyle("bisq-easy-offerbook-search-box"); - searchBox.setActiveStyle("bisq-easy-offerbook-search-box-active"); - searchBox.setActiveIconId("search-green"); + double searchBoxHeight = 29; + searchBox.setMinHeight(searchBoxHeight); + searchBox.setMaxHeight(searchBoxHeight); + searchBox.setPrefHeight(searchBoxHeight); double scale = 1.15; helpButton = BisqIconButton.createIconButton("icon-help"); diff --git a/apps/desktop/desktop/src/main/resources/css/controls.css b/apps/desktop/desktop/src/main/resources/css/controls.css index 7aa1f1578b..ffe4218f84 100644 --- a/apps/desktop/desktop/src/main/resources/css/controls.css +++ b/apps/desktop/desktop/src/main/resources/css/controls.css @@ -868,15 +868,16 @@ ******************************************************************************/ .search-box { - -fx-background-color: -bisq-dark-grey-dim; + -fx-background-color: -bisq-dark-grey-mid; -fx-background-radius: 6; -fx-border-color: transparent; - -fx-border-width: 1; + -fx-border-width: 0; -fx-border-radius: 6; + -fx-padding: 0 0 0 5; } .search-box-active { - -fx-background-color: -bisq-dark-grey-dim; + -fx-background-color: -bisq-dark-grey-lit; } .search-text-field { From b653aed3fb834677351af30f4beb323249493230 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Mon, 15 Jan 2024 21:18:23 +0100 Subject: [PATCH 8/9] Align input text elements and side buttons to the bottom --- .../components/ChatMessagesComponent.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java index b9d911c321..ad3c6f39d9 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/components/ChatMessagesComponent.java @@ -537,10 +537,9 @@ public static class View extends bisq.desktop.common.view.View userMentionPopup; private ChatMentionPopupMenu> channelMentionPopup; - private ChangeListener createOfferButtonHeightListener; private Pane userProfileSelectionRoot; private Button leaveChannelButton, createOfferButton; @@ -558,7 +557,7 @@ private View(Model model, new Label(Res.get("chat.private.messagebox.noChats.placeholder.title")), new Label(Res.get("chat.private.messagebox.noChats.placeholder.description"))); - VBox bottomBarContainer = createBottomBar(userProfileSelection); + VBox bottomBarContainer = createAndGetBottomBar(userProfileSelection); quotedMessageBlock.setMaxWidth(CHAT_BOX_MAX_WIDTH); @@ -628,10 +627,10 @@ protected void onViewDetached() { createOfferButton.setOnAction(null); } - private VBox createBottomBar(UserProfileSelection userProfileSelection) { + private VBox createAndGetBottomBar(UserProfileSelection userProfileSelection) { createOfferButton = createAndGetCreateOfferButton(); setUpUserProfileSelection(userProfileSelection); - HBox sendMessageBox = createSendMessageBox(); + HBox sendMessageBox = createAndGetSendMessageBox(); // TODO: Remove this. We need a better solution for this use-case. leaveChannelButton = createAndGetChatButton(Res.get("chat.leave"), 120); @@ -640,29 +639,31 @@ private VBox createBottomBar(UserProfileSelection userProfileSelection) { bottomBar.getChildren().addAll(createOfferButton, userProfileSelectionRoot, sendMessageBox, leaveChannelButton); bottomBar.setMaxWidth(CHAT_BOX_MAX_WIDTH); bottomBar.setPadding(new Insets(14, 20, 14, 20)); + bottomBar.setAlignment(Pos.BOTTOM_CENTER); VBox bottomBarContainer = new VBox(bottomBar); bottomBarContainer.setAlignment(Pos.CENTER); return bottomBarContainer; } - private HBox createSendMessageBox() { + private HBox createAndGetSendMessageBox() { inputField.setPromptText(Res.get("chat.message.input.prompt")); inputField.getStyleClass().addAll("chat-input-field", "normal-text"); inputField.setPadding(new Insets(5, 0, 5, 5)); + HBox.setMargin(inputField, new Insets(0, 0, 1.5, 0)); HBox.setHgrow(inputField, Priority.ALWAYS); setUpInputFieldAtMentions(); sendButton.setGraphic(ImageUtil.getImageViewById("chat-send")); sendButton.setId("chat-messages-send-button"); - sendButton.setPadding(new Insets(5, 5, 5, 0)); + HBox.setMargin(sendButton, new Insets(0, 0, 5, 0)); sendButton.setMinWidth(30); sendButton.setMaxWidth(30); sendButton.setTooltip(new BisqTooltip(Res.get("chat.message.input.send"), true)); HBox sendMessageBox = new HBox(inputField, sendButton); sendMessageBox.getStyleClass().add("chat-send-message-box"); - sendMessageBox.setAlignment(Pos.CENTER); + sendMessageBox.setAlignment(Pos.BOTTOM_CENTER); HBox.setHgrow(sendMessageBox, Priority.ALWAYS); return sendMessageBox; } @@ -682,16 +683,10 @@ private Button createAndGetCreateOfferButton() { createOfferButton.getStyleClass().addAll("create-offer-button", "normal-text"); createOfferButton.setMinWidth(170); - createOfferButtonHeightListener = (observable, oldValue, newValue) -> { - if (newValue != null) { - createOfferButton.setMinHeight(inputField.getHeight()); - createOfferButton.setMaxHeight(inputField.getHeight()); - createOfferButton.setPrefHeight(inputField.getHeight()); - } else { - UIThread.runOnNextRenderFrame(() -> inputField.heightProperty().removeListener(createOfferButtonHeightListener)); - } - }; - inputField.heightProperty().addListener(createOfferButtonHeightListener); + double height = 45; + createOfferButton.setMinHeight(height); + createOfferButton.setMaxHeight(height); + createOfferButton.setPrefHeight(height); return createOfferButton; } From 9506734adde150e4fa27e28e2d931883f1d4c4f3 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Mon, 15 Jan 2024 21:29:25 +0100 Subject: [PATCH 9/9] Apply searchBox style to Offerbook --- .../bisq_easy/offerbook/BisqEasyOfferbookView.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java index a6c383d381..a38299cedf 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java @@ -92,10 +92,10 @@ protected void configTitleHBox() { HBox.setHgrow(headerTitle, Priority.ALWAYS); searchBox.setMaxWidth(200); - searchBox.setMaxHeight(searchBox.getMinHeight()); - searchBox.setDefaultStyle("bisq-easy-offerbook-search-box"); - searchBox.setActiveStyle("bisq-easy-offerbook-search-box-active"); - searchBox.setActiveIconId("search-green"); + double searchBoxHeight = 29; + searchBox.setMinHeight(searchBoxHeight); + searchBox.setMaxHeight(searchBoxHeight); + searchBox.setPrefHeight(searchBoxHeight); double scale = 1.15; helpButton = BisqIconButton.createIconButton("icon-help");