diff --git a/src/main/java/edu/group5/app/App.java b/src/main/java/edu/group5/app/App.java index 8658fb1..3aea332 100644 --- a/src/main/java/edu/group5/app/App.java +++ b/src/main/java/edu/group5/app/App.java @@ -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; @@ -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 diff --git a/src/main/java/edu/group5/app/control/NavigationController.java b/src/main/java/edu/group5/app/control/NavigationController.java index 2c47621..8bbbbb3 100644 --- a/src/main/java/edu/group5/app/control/NavigationController.java +++ b/src/main/java/edu/group5/app/control/NavigationController.java @@ -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; @@ -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; @@ -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); @@ -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(); } /** diff --git a/src/main/java/edu/group5/app/view/aboutuspage/AboutUsView.java b/src/main/java/edu/group5/app/view/aboutuspage/AboutUsView.java new file mode 100644 index 0000000..f25a95e --- /dev/null +++ b/src/main/java/edu/group5/app/view/aboutuspage/AboutUsView.java @@ -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(); + } +}