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

Implement a new design for the BisqEasy Offerbook #1657

Merged
merged 28 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
819dd08
Refactor: rename openChatsList to openChatsSelectionList
axpoems Jan 30, 2024
4e0788a
Refactor: Move private methods to the bottom of the file
axpoems Jan 30, 2024
c2c14c3
Clean up offerbook and make it inherit from Chat
axpoems Jan 30, 2024
88707bf
Update setting chat title, channel title and description
axpoems Jan 30, 2024
686f322
Add styles to market selection list header
axpoems Jan 30, 2024
4a5e718
Add MarketChannelItem TableCell factory
axpoems Jan 31, 2024
c8e6d20
Allow market channel selection from tableView
axpoems Jan 31, 2024
d936636
Temporarily adding images to test resolution
axpoems Feb 1, 2024
a89d044
Fix selecting channel onActivate
axpoems Feb 1, 2024
433e58c
Move createOfferButton to the marketSelectionList
axpoems Feb 1, 2024
9e62bd0
Move creation of MarketChannelItems only on class instantiation
axpoems Feb 1, 2024
e504eb0
Make numOffers to be reactive
axpoems Feb 1, 2024
191bd47
Remove comboBoxWithSearch as marketSelector
axpoems Feb 1, 2024
108d9e0
Add search in marketSelectionList
axpoems Feb 1, 2024
4d0f58f
Move DropdownMenu to common controls
axpoems Feb 1, 2024
107aa8d
Add dropdown menu to sort marketSelectorList
axpoems Feb 1, 2024
682bd65
Update DropdownMenu to allow labels
axpoems Feb 2, 2024
4cefe17
Improve tableView style
axpoems Feb 3, 2024
4f63aec
Add fiat market logos
axpoems Feb 3, 2024
b786900
Add optimisations to improve market logo rendering
axpoems Feb 3, 2024
4984213
Fix and unify headers across chat views
axpoems Feb 3, 2024
df0ec9e
Improve resolution of market logos
axpoems Feb 3, 2024
4ae1d08
Add marketLogoPlaceholder when market does not have logo
axpoems Feb 3, 2024
0ce32ec
Add styles to checkbox
axpoems Feb 3, 2024
d8e29ad
Fix styles in subheader controls
axpoems Feb 3, 2024
2a15f71
Improve listView market labels
axpoems Feb 3, 2024
f1d8364
Remove brightness the market logos in listView
axpoems Feb 3, 2024
a989813
Reduce space between DropdownMenu button and popup
axpoems Feb 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static void addAllCss(Scene scene) {
requireNonNull(aClass.getResource("/css/user.css")).toExternalForm(),
requireNonNull(aClass.getResource("/css/bisq_easy.css")).toExternalForm(),
requireNonNull(aClass.getResource("/css/trade_apps.css")).toExternalForm(),
requireNonNull(aClass.getResource("/css/images.css")).toExternalForm());
requireNonNull(aClass.getResource("/css/images.css")).toExternalForm(),
requireNonNull(aClass.getResource("/css/markets.css")).toExternalForm());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.desktop.components.controls;

import bisq.desktop.common.utils.ImageUtil;
import javafx.beans.value.WeakChangeListener;
import javafx.geometry.Bounds;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.stage.PopupWindow;
import javafx.stage.WindowEvent;

public class DropdownMenu extends HBox {
private final Label label = new Label();
private final ImageView defaultIcon, activeIcon;
private final ContextMenu contextMenu = new ContextMenu();
private ImageView buttonIcon;

public DropdownMenu(String defaultIconId, String activeIconId, boolean useIconOnly) {
defaultIcon = ImageUtil.getImageViewById(defaultIconId);
activeIcon = ImageUtil.getImageViewById(activeIconId);

buttonIcon = defaultIcon;

getChildren().addAll(label, buttonIcon);

getStyleClass().add("dropdown-menu");
contextMenu.getStyleClass().add("dropdown-menu-popup");

if (useIconOnly) {
double size = 29;
setMaxSize(size, size);
setMinSize(size, size);
setPrefSize(size, size);
setAlignment(Pos.CENTER);
} else {
setSpacing(5);
setAlignment(Pos.CENTER_RIGHT);
setPadding(new Insets(0, 5, 0, 0));
}

attachListeners();
}

public void setLabel(String text) {
label.setText(text);
}

private void toggleContextMenu() {
if (!contextMenu.isShowing()) {
contextMenu.setAnchorLocation(PopupWindow.AnchorLocation.WINDOW_TOP_RIGHT);
Bounds bounds = this.localToScreen(this.getBoundsInLocal());
double x = bounds.getMaxX();
double y = bounds.getMaxY() + 5;
contextMenu.show(this, x, y);
} else {
contextMenu.hide();
}
}

public void addMenuItems(MenuItem... items) {
contextMenu.getItems().addAll(items);
}

public void clearMenuItems() {
contextMenu.getItems().clear();
}

private void attachListeners() {
setOnMouseClicked(event -> toggleContextMenu());
setOnMouseExited(e -> updateIcon(contextMenu.isShowing() ? activeIcon : defaultIcon));
setOnMouseEntered(e -> updateIcon(activeIcon));

sceneProperty().addListener(new WeakChangeListener<>((observable, oldScene, newScene) -> {
if (newScene != null) {
newScene.windowProperty().addListener(new WeakChangeListener<>((obs, oldWindow, newWindow) -> {
if (newWindow != null) {
newWindow.addEventHandler(WindowEvent.WINDOW_HIDING, e -> contextMenu.hide());
}
}));
}
}));

contextMenu.setOnShowing(e -> {
getStyleClass().add("dropdown-menu-active");
updateIcon(activeIcon);
});
contextMenu.setOnHidden(e -> {
getStyleClass().remove("dropdown-menu-active");
updateIcon(defaultIcon);
});
}

private void updateIcon(ImageView newIcon) {
if (buttonIcon != newIcon) {
getChildren().remove(buttonIcon);
buttonIcon = newIcon;
getChildren().add(buttonIcon);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ public void allowVerticalScrollbar() {
getStyleClass().remove("hide-vertical-scrollbar");
}

public void hideHorizontalScrollbar() {
getStyleClass().add("force-hide-horizontal-scrollbar");
}

public void allowHorizontalScrollbar() {
getStyleClass().remove("force-hide-horizontal-scrollbar");
}

public void removeListeners() {
if (listChangeListener != null) {
getItems().removeListener(listChangeListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private View(Model model, Controller controller) {
root.setMaxHeight(HEIGHT);
root.setAlignment(Pos.CENTER_LEFT);
root.setPadding(new Insets(0, 30, 0, 30));
root.getStyleClass().add("bisq-easy-container-header");
root.getStyleClass().add("chat-container-header");

tradeId = getElements(Res.get("bisqEasy.tradeState.header.tradeId"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static Triple<Label, HBox, VBox> getContainer(String headline, Node conte
HBox header = new HBox(10, headlineLabel);
header.setAlignment(Pos.CENTER_LEFT);
header.setPadding(new Insets(15, 30, 15, 30));
header.getStyleClass().add("bisq-easy-container-header");
header.getStyleClass().add("chat-container-header");

VBox.setMargin(content, new Insets(0, 30, 15, 30));
VBox vBox = new VBox(header, Layout.hLine(), content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private View(Model model, Controller controller) {
root.setMaxHeight(HEIGHT);
root.setAlignment(Pos.CENTER_LEFT);
root.setPadding(new Insets(0, 30, 0, 30));
root.getStyleClass().add("bisq-easy-container-header");
root.getStyleClass().add("chat-container-header");

peerDescription = new Label();
peerDescription.getStyleClass().add("bisq-easy-open-trades-header-description");
Expand Down
Loading
Loading