diff --git a/pom.xml b/pom.xml index a888bc6..0021470 100644 --- a/pom.xml +++ b/pom.xml @@ -17,8 +17,6 @@ - - org.openjfx javafx-controls @@ -31,7 +29,6 @@ ${javafx.version} - org.junit.jupiter junit-jupiter @@ -42,7 +39,7 @@ com.fasterxml.jackson.core jackson-databind - 2.17.0 + 2.18.3 @@ -61,37 +58,24 @@ - - org.openjfx javafx-maven-plugin 0.0.8 app.Main + + + + - org.apache.maven.plugins maven-surefire-plugin 3.5.4 - - - org.openjfx - javafx-maven-plugin - 0.0.8 - - app.Main - - - - - - - \ No newline at end of file diff --git a/src/main/java/domain/user/User.java b/src/main/java/domain/user/User.java index 5d471cc..e423710 100644 --- a/src/main/java/domain/user/User.java +++ b/src/main/java/domain/user/User.java @@ -7,7 +7,7 @@ public class User { private String userName; private String phoneNumber; - private final String eMail; + private String eMail; private String password; private Long id; @@ -87,6 +87,47 @@ public String getPassword() { */ public long getID() { return id; } + /** + * Sets the username of this user. + * @param userName the new username; must not be null or blank + */ + public void setUsername(String userName) { + if (userName == null || userName.isBlank()) { + throw new IllegalArgumentException("Username has to be filled in"); + } + this.userName = userName; + } + + /** + * Sets the phone number of this user. + * @param phoneNumber the new phone number; must be exactly 8 digits + */ + public void setPhoneNumber(String phoneNumber) { + if (phoneNumber == null || phoneNumber.isBlank() || phoneNumber.length() != 8) { + throw new IllegalArgumentException("Fill in a phonenumber with 8 digits"); + } + this.phoneNumber = phoneNumber; + } + + /** + * Sets the email address of this user. + * @param eMail the new email address; must be a valid email format + */ + public void setEmail(String eMail) { + if (!isValidEmail(eMail)) { + throw new IllegalArgumentException("Invalid email address: " + eMail); + } + this.eMail = eMail.trim(); + } + + /** + * Sets the password hash of this user. + * @param password the new hashed password + */ + public void setPassword(String password) { + this.password = password; + } + /** * Sets the ID for this user. * diff --git a/src/main/java/persistence/dao/DonationDao.java b/src/main/java/persistence/dao/DonationDao.java index c4893ec..dcf6cb1 100644 --- a/src/main/java/persistence/dao/DonationDao.java +++ b/src/main/java/persistence/dao/DonationDao.java @@ -276,6 +276,6 @@ private String mapRowSimple(ResultSet rs) throws SQLException { */ private String mapRowFavorite(ResultSet rs) throws SQLException { return rs.getString("name") - + " (" + rs.getInt("donation_count") + " donasjoner)"; + + " (" + rs.getInt("donation_count") + " donations)"; } } diff --git a/src/main/java/ui/controller/NavbarController.java b/src/main/java/ui/controller/NavbarController.java index 0be90c5..af0d65f 100644 --- a/src/main/java/ui/controller/NavbarController.java +++ b/src/main/java/ui/controller/NavbarController.java @@ -4,6 +4,7 @@ import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.Label; import javafx.scene.layout.HBox; import ui.Page; import util.SessionManager; @@ -23,6 +24,8 @@ public class NavbarController { private Button orgBtn; @FXML private Button signInBtn; + @FXML + private Label logoLabel; /** * Sets the navigation callback. @@ -56,6 +59,7 @@ public void setActivePage(Page page) { /** * Navigates to the home page. */ + @FXML public void goHome() { onNavigate.accept(Page.HOME); } @@ -63,6 +67,7 @@ public void goHome() { /** * Navigates to the sign in page or profile page depending on authentication state. */ + @FXML public void goToSignIn() { if (SessionManager.isSignedIn()) { onNavigate.accept(Page.PROFILE); @@ -74,10 +79,12 @@ public void goToSignIn() { /** * Navigates to the organizations page. */ + @FXML public void goToOrganizations() { onNavigate.accept(Page.ORGANIZATIONS); } + /** * Updates the sign in button text based on the user's authentication state. * Shows "My Profile" if signed in, "Sign In" otherwise. @@ -90,6 +97,14 @@ public void updateAuthButton() { } } + /** + * Navigates to the home page. + */ + @FXML + private void handleLogoClick() { + onNavigate.accept(Page.HOME); + } + /** * Hides the navbar. */ diff --git a/src/main/java/ui/controller/OrganizationDetailController.java b/src/main/java/ui/controller/OrganizationDetailController.java index b741862..39b2e92 100644 --- a/src/main/java/ui/controller/OrganizationDetailController.java +++ b/src/main/java/ui/controller/OrganizationDetailController.java @@ -73,6 +73,8 @@ public void setOrganization(Organization org, OrganizationDetails details) { } else { logoImageView.setVisible(false); } + System.out.println("Beskrivelse: " + details.getDescription()); + System.out.println("Lengde: " + details.getDescription().length()); } /** diff --git a/src/main/resources/css/Global.css b/src/main/resources/css/Global.css index 7a2eeac..e0253c6 100644 --- a/src/main/resources/css/Global.css +++ b/src/main/resources/css/Global.css @@ -121,7 +121,7 @@ } .logo-label { - -fx-font-size: 22px; + -fx-font-size: 32px; -fx-font-family: "Times New Roman"; -fx-text-fill: white; -fx-font-weight: bold; diff --git a/src/main/resources/view/Home.fxml b/src/main/resources/view/Home.fxml index 342e975..0730328 100644 --- a/src/main/resources/view/Home.fxml +++ b/src/main/resources/view/Home.fxml @@ -9,7 +9,7 @@ - +
@@ -25,7 +25,6 @@