-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: made UserPageView and added connection to controllers and testd…
…ata in MainView
- Loading branch information
MatheaGjerde
committed
Mar 15, 2026
1 parent
e6a2d09
commit 06c135b
Showing
7 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/main/java/edu/group5/app/view/userpage/UserPageView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| package edu.group5.app.view.userpage; | ||
|
|
||
| import edu.group5.app.control.HeaderController; | ||
| import edu.group5.app.model.user.Customer; | ||
| import edu.group5.app.view.Header; | ||
| import javafx.geometry.Insets; | ||
| import javafx.geometry.Pos; | ||
| import javafx.scene.control.Label; | ||
| import javafx.scene.image.Image; | ||
| import javafx.scene.image.ImageView; | ||
| import javafx.scene.layout.BorderPane; | ||
| import javafx.scene.layout.HBox; | ||
| import javafx.scene.layout.Pane; | ||
| import javafx.scene.layout.VBox; | ||
| import javafx.scene.text.Text; | ||
|
|
||
|
|
||
| public class UserPageView extends BorderPane { | ||
| private final Customer customer; | ||
|
|
||
| public UserPageView(HeaderController headerController, Customer customer) { | ||
| this.customer = customer; | ||
| getStylesheets().add(getClass().getResource("/userpage/userpage.css").toExternalForm()); | ||
|
|
||
| Header headerView = new Header(headerController); | ||
| setTop(headerView); | ||
|
|
||
| VBox content = new VBox(30); | ||
| content.setPadding(new Insets(40)); | ||
| content.getChildren().addAll(createProfileSection(), createCausesSection(), createDonationsSection()); | ||
| setCenter(content); | ||
| } | ||
| private HBox createProfileSection() { | ||
| ImageView avatar = new ImageView(new Image(getClass().getResourceAsStream("/userpage/account_circle.png"))); | ||
| avatar.setFitWidth(150); | ||
| avatar.setFitHeight(150); | ||
| avatar.setPreserveRatio(true); | ||
| avatar.setId("avatar"); | ||
|
|
||
| Text name = new Text(customer.getFirstName() + " " + customer.getLastName()); | ||
| name.setId("profile-name"); | ||
|
|
||
| Label email = new Label(customer.getEmail()); | ||
| email.getStyleClass().add("profile-info"); | ||
|
|
||
| Label location = new Label("Trondheim, Norway"); | ||
| location.getStyleClass().add("profile-info"); | ||
|
|
||
| VBox info = new VBox(10, name, email, location); | ||
| info.setAlignment(Pos.CENTER_LEFT); | ||
|
|
||
| HBox profile = new HBox(40, avatar, info); | ||
| profile.setAlignment(Pos.CENTER_LEFT); | ||
| return profile; | ||
| } | ||
| private VBox createCausesSection() { | ||
| Text title = new Text("YOUR SUPPORTED CAUSES"); | ||
| title.getStyleClass().add("section-title"); | ||
|
|
||
| Pane causesPlaceholder = new Pane(); | ||
| causesPlaceholder.getStyleClass().add("section-box"); | ||
|
|
||
| return new VBox(10, title, causesPlaceholder); | ||
| } | ||
| private VBox createDonationsSection() { | ||
| Text title = new Text("PREVIOUS DONATIONS"); | ||
| title.getStyleClass().add("section-title"); | ||
|
|
||
| Pane donationsPlaceholder = new Pane(); | ||
| donationsPlaceholder.getStyleClass().add("section-box"); | ||
|
|
||
| return new VBox(10, title, donationsPlaceholder); | ||
| } | ||
|
|
||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #profile-name { | ||
| -fx-font-size: 28px; | ||
| -fx-font-weight: bold; | ||
| } | ||
| .profile-info { | ||
| -fx-font-size: 16px; | ||
| -fx-text-fill: #444; | ||
| } | ||
| .section-title { | ||
| -fx-font-size: 14px; | ||
| -fx-font-weight: bold; | ||
| -fx-fill: #888; | ||
| } | ||
| .section-box { | ||
| -fx-background-color: #ddd; | ||
| -fx-pref-height: 120px; | ||
| -fx-pref-width: 700px; | ||
| -fx-background-radius: 6; | ||
| } |