Center logo and make it clickable to navigate to Analytics

This commit is contained in:
2026-03-02 13:20:52 -07:00
parent bde356face
commit 645b6c2bce
2 changed files with 19 additions and 5 deletions

View File

@@ -9,6 +9,8 @@ import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.example.petshopdesktop.auth.UserSession;
@@ -73,6 +75,9 @@ public class MainLayoutController {
@FXML
private Button btnChat;
@FXML
private ImageView imgLogo;
@FXML
private Label lblUsername;
@@ -166,6 +171,12 @@ public class MainLayoutController {
updateButtons(btnChat);
}
@FXML
void logoClicked(MouseEvent event) {
loadView("analytics-view.fxml");
updateButtons(btnAnalytics);
}
@FXML
void btnLogoutClicked(ActionEvent event) {
UserSession.getInstance().logout();

View File

@@ -8,6 +8,7 @@
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
@@ -21,14 +22,16 @@
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
<children>
<ImageView fitHeight="90.0" fitWidth="90.0" preserveRatio="true">
<image>
<Image url="@images/leons-pet-store-badge.png" />
</image>
<HBox alignment="CENTER">
<ImageView fx:id="imgLogo" fitHeight="90.0" fitWidth="90.0" preserveRatio="true" onMouseClicked="#logoClicked" style="-fx-cursor: hand;">
<image>
<Image url="@images/leons-pet-store-badge.png" />
</image>
</ImageView>
<VBox.margin>
<Insets bottom="15.0" />
</VBox.margin>
</ImageView>
</HBox>
<Label fx:id="lblUsername" text="Name" textFill="WHITE">
<font>
<Font name="System Bold" size="18.0" />