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

More improvements on chat design #1589

Merged
merged 9 commits into from
Jan 18, 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 @@ -92,6 +92,7 @@ public AutoCompleteComboBox(ObservableList<T> 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();
Expand All @@ -104,7 +105,6 @@ protected void updateItem(T item, boolean empty) {
} else {
editor.setText("");
}

}
});
setAutocompleteItems(items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ private void applyStyle(boolean isFocused) {
getStyleClass().remove(activeStyle);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -91,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");
Expand All @@ -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");
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@Slf4j
public class ChatView<V extends ChatView<V, M>, 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<V, M> controller,
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import javafx.scene.layout.Priority;

public final class CommonPublicChatView extends ChatView<CommonPublicChatView, CommonPublicChatModel> {
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);
}

Expand All @@ -48,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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading