Skip to content

Commit

Permalink
Feat: Frontpage is now 100% navigiaontal on has some working buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Mar 13, 2026
1 parent 6b64e7f commit 6afdd4e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void initialize() {

OrganizationCardController cardController = loader.getController();

System.out.println("Added Name: " + ch.getName() + " Added Description: " + ch.getDescription());
cardController.setOrganization(ch.getName(), ch.getDescription());
// System.out.println("Added Name: " + ch.getName() + " Added Description: " + ch.getDescription());
cardController.setOrganization(ch);

cardsContainer.getChildren().add(card);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
package ntnu.systemutvikling.team6.controller;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import ntnu.systemutvikling.team6.HmHApplication;
import ntnu.systemutvikling.team6.models.Charity;

import java.io.IOException;
import java.util.Objects;

public class OrganizationCardController {

@FXML private Label organizationName;

@FXML private Label organizationDescription;

public void setOrganization(String name, String description) {
organizationName.setText(name);
organizationDescription.setText(description);
private Charity charity;

public void setOrganization(Charity charity) {
this.charity = charity;

organizationName.setText(charity.getName());
organizationDescription.setText(charity.getDescription());
}

/* EVENTS */
public void switchToCharityPage(ActionEvent event){
try {
FXMLLoader fxmlLoader =
new FXMLLoader(HmHApplication.class.getResource("/fxml/charityPage.fxml"));
Parent root = fxmlLoader.load();
CharityPageController controller = fxmlLoader.getController();
controller.setCharity(charity);

Stage stage = (Stage) ((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setFullScreen(true);
stage.show();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void switchToDonationPage(ActionEvent event){
CharityPageController.loadNewScene(event, charity);
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>

<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="240.0" prefWidth="380.0" spacing="12.0" style="-fx-background-color: white; -fx-background-radius: 20; -fx-border-radius: 20; -fx-border-color: #3b82f6; -fx-border-width: 2;" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ntnu.systemutvikling.team6.controller.OrganizationCardController">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="240.0" prefWidth="380.0" spacing="12.0" style="-fx-background-color: white; -fx-background-radius: 20; -fx-border-radius: 20; -fx-border-color: #3b82f6; -fx-border-width: 2;" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ntnu.systemutvikling.team6.controller.OrganizationCardController">
<padding>
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0" />
</padding>
Expand All @@ -30,8 +27,8 @@
<Region prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="12.0">
<children>
<Button mnemonicParsing="false" prefWidth="110.0" style="-fx-background-color: #2e7d32; -fx-background-radius: 16; -fx-text-fill: white; -fx-font-weight: bold;" text="Donate" />
<Button mnemonicParsing="false" prefWidth="110.0" style="-fx-background-color: #2563eb; -fx-background-radius: 16; -fx-text-fill: white; -fx-font-weight: bold;" text="View details" />
<Button mnemonicParsing="false" onAction="#switchToDonationPage" prefWidth="110.0" style="-fx-background-color: #2e7d32; -fx-background-radius: 16; -fx-text-fill: white; -fx-font-weight: bold;" text="Donate" />
<Button mnemonicParsing="false" onAction="#switchToCharityPage" prefWidth="110.0" style="-fx-background-color: #2563eb; -fx-background-radius: 16; -fx-text-fill: white; -fx-font-weight: bold;" text="View details" />
</children>
</HBox>
</children>
Expand Down

0 comments on commit 6afdd4e

Please sign in to comment.