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

View File

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