Skip to content

Commit

Permalink
Update[AboutUsPage]: Update AboutUs page by moving the construction o…
Browse files Browse the repository at this point in the history
…f the pop-up into a new class, increassing Seperation of concern
  • Loading branch information
Fredrik Marjoni committed Apr 20, 2026
1 parent 3b3376f commit df0905e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 28 deletions.
3 changes: 2 additions & 1 deletion src/main/java/edu/group5/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.group5.app.model.user.UserService;
import edu.group5.app.model.wrapper.DbWrapper;
import edu.group5.app.model.wrapper.OrgApiWrapper;
import edu.group5.app.view.aboutuspage.AboutUsView;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
Expand Down Expand Up @@ -82,7 +83,7 @@ public void init() {
OrganizationService organizationService = new OrganizationService(organizationRepository, orgScraper);
this.root = new BorderPane();
this.appState = new AppState();
this.nav = new NavigationController(root, appState, userService, donationService, organizationService, getHostServices());
this.nav = new NavigationController(root, appState, userService, donationService, organizationService, this.getHostServices());
}

@Override
Expand Down
35 changes: 8 additions & 27 deletions src/main/java/edu/group5/app/control/NavigationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import edu.group5.app.model.user.UserService;
import edu.group5.app.utils.ParameterValidator;
import edu.group5.app.view.Header;
import edu.group5.app.view.aboutuspage.AboutUsView;
import edu.group5.app.view.causespage.CausesPageView;
import edu.group5.app.view.donationpage.DonationPageView;
import edu.group5.app.view.donationpage.PaymentCompletePageView;
Expand Down Expand Up @@ -39,7 +40,7 @@ public class NavigationController {
private final LoginHeader loginHeader;

private final AppState appState;
private HostServices hostServices;
private final HostServices hostServices;

private final AuthController authController;
private final DonationController donationController;
Expand All @@ -57,8 +58,8 @@ public NavigationController(BorderPane root, AppState appState, UserService user
this.root = root;
this.header = new Header(this);
this.loginHeader = new LoginHeader();
this.hostServices = hostServices;
this.appState = appState;
this.hostServices = hostServices;

this.authController = new AuthController(appState, this, userService);
this.donationController = new DonationController(appState, this, donationService);
Expand Down Expand Up @@ -129,32 +130,12 @@ public void showDonationPage() {
root.setCenter(new DonationPageView(this, donationController));
}

/**
* Displays an "About Us" dialog with information about the application and its developers.
* The dialog includes a description of the app's mission and a hyperlink to the project's GitHub repository
*/
public void showAboutUsPage() {
Alert aboutUs = new Alert(Alert.AlertType.INFORMATION);
aboutUs.setTitle("About us");
aboutUs.setHeaderText("Help Me Help - About Us");

Label description = new Label(
"Help Me Help is a charity donation application designed to connect donors with organizations in need. " +
"Our mission is to make it easy for people to support causes they care about and make a positive impact in the world.\n\n" +
"This application was developed by Team 5 as part of a IDATT1005 course project at NTNU spring 2026."
);
description.setWrapText(true);
description.maxWidthProperty().bind(aboutUs.getDialogPane().widthProperty().subtract(40));

Hyperlink websiteLink = new Hyperlink("For more information about the project, visit our GitHub repository");
websiteLink.setOnAction(e -> hostServices.showDocument("https://git.ntnu.no/Group-5/Help-Me-Help"));

VBox content = new VBox(10, description, websiteLink);
content.setPrefWidth(420);

aboutUs.getDialogPane().setContentText(null);
aboutUs.getDialogPane().setContent(content);

// Optional: single Close button instead of OK
aboutUs.getButtonTypes().setAll(ButtonType.CLOSE);

aboutUs.showAndWait();
new AboutUsView(hostServices).displayAboutUs();
}

/**
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/edu/group5/app/view/aboutuspage/AboutUsView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package edu.group5.app.view.aboutuspage;

import edu.group5.app.utils.ParameterValidator;
import javafx.application.HostServices;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

/**
* A view for displaying information about the "Help Me Help" application and its creators.
* The view is presented as an informational dialog that includes a description of the app's mission
* and a hyperlink to the project's GitHub repository for more details. This page serves to provide
* users with background information about the application and its development team.
*/
public class AboutUsView {
private HostServices hostServices;

public AboutUsView(HostServices hostServices) {
ParameterValidator.objectChecker(hostServices, "HostServices");
this.hostServices = hostServices;
}

/**
* Displays the "About Us" information in an alert dialog.
*/
public void displayAboutUs() {
Alert aboutUs = new Alert(Alert.AlertType.INFORMATION);
aboutUs.setTitle("About us");
aboutUs.setHeaderText("Help Me Help - About Us");

Label description = new Label(
"Help Me Help is a charity donation application designed to connect donors with organizations in need. " +
"Our mission is to make it easy for people to support causes they care about and make a positive impact in the world.\n\n" +
"This application was developed by Team 5 as part of a IDATT1005 course project at NTNU spring 2026."
);
description.setWrapText(true);
description.maxWidthProperty().bind(aboutUs.getDialogPane().widthProperty().subtract(40));

Hyperlink websiteLink = new Hyperlink("For more information about the project, visit our GitHub repository");
websiteLink.setOnAction(e -> hostServices.showDocument("https://git.ntnu.no/Group-5/Help-Me-Help"));

VBox content = new VBox(10, description, websiteLink);
content.setPrefWidth(420);

aboutUs.getDialogPane().setContentText(null);
aboutUs.getDialogPane().setContent(content);

// Optional: single Close button instead of OK
aboutUs.getButtonTypes().setAll(ButtonType.CLOSE);

aboutUs.showAndWait();
}
}

0 comments on commit df0905e

Please sign in to comment.