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

Add NEW badge #2895

Merged
merged 2 commits into from
Oct 1, 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 @@ -58,7 +58,8 @@ class LeftNavButton extends Pane implements Toggle {
protected final ObjectProperty<ToggleGroup> toggleGroupProperty = new SimpleObjectProperty<>();
protected final BooleanProperty selectedProperty = new SimpleBooleanProperty();
protected final BooleanProperty highlightedProperty = new SimpleBooleanProperty();
protected final Label label;
@Getter
protected final Label buttonLabel;
protected final Tooltip tooltip;

@Nullable
Expand Down Expand Up @@ -108,12 +109,12 @@ class LeftNavButton extends Pane implements Toggle {
getChildren().add(icon);
}

label = new Label(title);
label.setLayoutX(LABEL_X_POS_EXPANDED);
label.setLayoutY((calculateHeight() - 21) * 0.5);
label.setMouseTransparent(true);
buttonLabel = new Label(title);
buttonLabel.setLayoutX(LABEL_X_POS_EXPANDED);
buttonLabel.setLayoutY((calculateHeight() - 21) * 0.5);
buttonLabel.setMouseTransparent(true);

getChildren().add(label);
getChildren().add(buttonLabel);

if (hasSubmenu) {
verticalExpandIcon = BisqIconButton.createIconButton("nav-arrow-right");
Expand Down Expand Up @@ -150,7 +151,7 @@ class LeftNavButton extends Pane implements Toggle {

hoverProperty().addListener((ov, wasHovered, isHovered) -> {
if (isSelected() || isHighlighted()) return;
Layout.chooseStyleClass(label, "bisq-text-white", "bisq-text-grey-9", isHovered);
Layout.chooseStyleClass(buttonLabel, "bisq-text-white", "bisq-text-grey-9", isHovered);
if (icon != null) {
getChildren().set(0, isHovered ? iconHover : icon);
}
Expand All @@ -174,9 +175,9 @@ void setVerticalExpanded(boolean subMenuExpanded) {
protected void applyStyle() {
boolean isHighlighted = isSelected() || isHighlighted();
Layout.addStyleClass(this, "bisq-dark-bg");
Layout.toggleStyleClass(label, "bisq-text-green", isSelected());
Layout.toggleStyleClass(label, "bisq-text-white", isHighlighted());
Layout.toggleStyleClass(label, "bisq-text-grey-9", !isHighlighted);
Layout.toggleStyleClass(buttonLabel, "bisq-text-green", isSelected());
Layout.toggleStyleClass(buttonLabel, "bisq-text-white", isHighlighted());
Layout.toggleStyleClass(buttonLabel, "bisq-text-grey-9", !isHighlighted);

if (icon != null) {
getChildren().set(0, isSelected() ? iconActive : isHighlighted ? iconHover : icon);
Expand All @@ -190,9 +191,9 @@ public final void setOnAction(Runnable handler) {
public void setHorizontalExpanded(boolean menuExpanded, int duration) {
if (menuExpanded) {
Tooltip.uninstall(this, tooltip);
label.setVisible(true);
label.setManaged(true);
Transitions.fadeIn(label, duration);
buttonLabel.setVisible(true);
buttonLabel.setManaged(true);
Transitions.fadeIn(buttonLabel, duration);
if (hasSubmenu) {
Objects.requireNonNull(verticalExpandCollapseIcon).setVisible(true);
Transitions.fadeIn(verticalExpandCollapseIcon, 3 * duration, 0.4, null);
Expand All @@ -202,9 +203,9 @@ public void setHorizontalExpanded(boolean menuExpanded, int duration) {
if (hasSubmenu) {
Transitions.fadeOut(verticalExpandCollapseIcon, duration / 2, () -> Objects.requireNonNull(verticalExpandCollapseIcon).setVisible(false));
}
Transitions.fadeOut(label, duration, () -> {
label.setVisible(false);
label.setManaged(false);
Transitions.fadeOut(buttonLabel, duration, () -> {
buttonLabel.setVisible(false);
buttonLabel.setManaged(false);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ class LeftNavSubButton extends LeftNavButton {

@Override
protected void applyStyle() {
Layout.chooseStyleClass(label, "bisq-text-green", "bisq-text-grey-9", isSelected());
Layout.chooseStyleClass(buttonLabel, "bisq-text-green", "bisq-text-grey-9", isSelected());
}

@Override
public void setHorizontalExpanded(boolean menuExpanded, int duration) {
if (menuExpanded) {
Tooltip.uninstall(this, tooltip);
Transitions.animateLeftSubNavigation(label, LABEL_X_POS_EXPANDED, duration);
label.setText(fullTitle);
Transitions.animateLeftSubNavigation(buttonLabel, LABEL_X_POS_EXPANDED, duration);
buttonLabel.setText(fullTitle);
} else {
Tooltip.install(this, tooltip);
Transitions.animateLeftSubNavigation(label, LABEL_X_POS_COLLAPSED, duration);
label.setText(fullTitle.substring(0, 1));
Transitions.animateLeftSubNavigation(buttonLabel, LABEL_X_POS_COLLAPSED, duration);
buttonLabel.setText(fullTitle.substring(0, 1));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Label;
import javafx.scene.control.ToggleGroup;
import javafx.scene.image.ImageView;
Expand Down Expand Up @@ -85,6 +86,10 @@ public LeftNavView(LeftNavModel model, LeftNavController controller, VBox networ
LeftNavButton reputation = createNavigationButton(Res.get("navigation.reputation"),
"nav-reputation",
NavigationTarget.REPUTATION, false);
// TODO: Remove in 2.1.2
Label reputationLabel = reputation.getButtonLabel();
reputationLabel.setGraphic(ImageUtil.getImageViewById("new-badge"));
reputationLabel.setContentDisplay(ContentDisplay.RIGHT);

LeftNavButton protocols = createNavigationButton(Res.get("navigation.tradeApps"),
"nav-trade",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
}

.reputation .label {
-fx-font-size: 1.15em;
-fx-line-spacing: 5px;
-fx-wrap-text: true;
}
Expand Down
5 changes: 5 additions & 0 deletions apps/desktop/desktop/src/main/resources/css/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@
-fx-image: url("/images/icons/open-link-green.png");
}

#new-badge {
-fx-image: url("/images/new.png");
}


/* ------------------------------------------------------------------------------------ */
/* Navigation */
/* ------------------------------------------------------------------------------------ */
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