Skip to content

Commit

Permalink
Feat: Frontpage sliced and decied
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Apr 15, 2026
1 parent 9df6f3a commit 89e3382
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import ntnu.systemutvikling.team6.controller.components.BaseController;
import ntnu.systemutvikling.team6.controller.components.LoaderScene;
import ntnu.systemutvikling.team6.controller.components.NavbarFooterController;
import ntnu.systemutvikling.team6.controller.components.OrganizationCardController;
import ntnu.systemutvikling.team6.controller.components.*;
import ntnu.systemutvikling.team6.database.DatabaseConnection;
import ntnu.systemutvikling.team6.database.Readers.CharitySelect;
import ntnu.systemutvikling.team6.database.Readers.DonationSelect;
Expand All @@ -31,25 +29,29 @@
* it, or click on the featured charity to see more details about it. It also has buttons to switch
* to the charity page and the donation page for the featured charity
*/
public class FrontpageController extends BaseController implements NavbarFooterController {
public class FrontpageController extends BaseController{
@FXML private Charity featuredCharity;
@FXML private FlowPane cardsContainer;
@FXML private Label Carosel_Organisasjon;
@FXML private Label Carosel_Beskrivelse;
@FXML private Label Total_Orgnisasjon;
@FXML private Label Total_Donations;
@FXML private Label PreApproved_Percentage;
@FXML private TextField frontSearchField;

@FXML private CheckBox verifiedFilter;
@FXML private CheckBox childrenFilter;
@FXML private CheckBox healthFilter;
@FXML private CheckBox emergencyAidFilter;
@FXML private NavbarController navbarController;
@FXML private FooterController footerController;

private List<Charity> allCharities = new ArrayList<>();



@Override
protected void authTokenisSet(){

navbarController.setAuthToken(authToken);
}

/**
Expand Down Expand Up @@ -126,22 +128,6 @@ public void handleCategoryFilterChange(ActionEvent event) {
displayCharities(getFilteredCharities());
}

/**
* This method is used to search for charities based on the input in the search field.
*
* @param event is the event that triggered the search.
*/
@FXML
public void handleFrontSearch(ActionEvent event) {
String query = frontSearchField.getText().trim();

if (query.isEmpty()) {
return;
}

LoaderScene.LoadScene("availableOrganization", event, null, query);
}

/**
* This method is used to filter the charities based on the selected filters.
*
Expand Down
135 changes: 4 additions & 131 deletions helpmehelpapplication/src/main/resources/fxml/frontPage.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -33,59 +33,8 @@
<children>
<HBox alignment="CENTER" style="-fx-background-color: #2f8f8b;" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<children>
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" percentWidth="30.0" prefWidth="100.0" />
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" percentWidth="30.0" prefWidth="100.0" />
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fitHeight="54.0" fitWidth="67.0" pickOnBounds="true" preserveRatio="true" translateX="10.0">
<image>
<Image url="@../images/Logo.png" />
</image>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</ImageView>
<Label text="Help" textFill="WHITE" translateX="100.0">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
<Label text="Me" textFill="#c8e6c9" translateX="145.0">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
<Label text="Help" textFill="WHITE" translateX="176.0">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
<StackPane prefHeight="150.0" prefWidth="200.0" GridPane.columnIndex="1">
<children>
<TextField minHeight="-Infinity" prefWidth="200.0" promptText="Search" style="-fx-background-radius: 15;" fx:id="frontSearchField" onAction="#handleFrontSearch" />
<Rectangle arcHeight="40.0" arcWidth="40.0" fill="#1f4fd8" height="34.0" stroke="TRANSPARENT" strokeType="INSIDE" translateX="132.0" width="120.0" StackPane.alignment="CENTER_RIGHT">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Rectangle>
<Label text="Login" textAlignment="CENTER" textFill="WHITE" translateX="87.0" StackPane.alignment="CENTER_RIGHT">
<font>
<Font name="System Bold" size="14.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
</children>
</StackPane>
</children>
</GridPane>
<!-- Pull in the navbar from components with its own controller -->
<fx:include fx:id="navbar" source="components/navbar.fxml"/>
</children>
</HBox>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.rowIndex="1">
Expand Down Expand Up @@ -300,83 +249,7 @@
</HBox>
</children>
</VBox>
<HBox alignment="BOTTOM_CENTER" prefHeight="12.0" prefWidth="800.0" style="-fx-background-color: #2f8f8b;" GridPane.rowIndex="2">
<children>
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="60.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<Rectangle fill="#2f8f8b" height="130.0" stroke="TRANSPARENT" strokeType="INSIDE" translateY="1.0" width="800.0" />
<Label text="Help" textFill="WHITE" translateX="80.0" StackPane.alignment="CENTER_LEFT">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Label text="Me" textFill="#c8e6c9" translateX="145.0" StackPane.alignment="CENTER_LEFT">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Label text="Help" textFill="WHITE" translateX="192.0" StackPane.alignment="CENTER_LEFT">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Rectangle fill="WHITE" height="90.0" stroke="TRANSPARENT" strokeType="INSIDE" translateX="-120.0" width="2.0" />
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" translateX="-40.0" StackPane.alignment="CENTER_LEFT">
<children>
<Label text="About us" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
<Label text="Something else" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
<Label text="Third link" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
</children>
</VBox>
</children>
</StackPane>
<StackPane alignment="CENTER_RIGHT" prefHeight="150.0" prefWidth="200.0" GridPane.columnIndex="1">
<children>
<ImageView fitHeight="71.0" fitWidth="161.0" pickOnBounds="true" preserveRatio="true" translateX="-60.0" translateY="-30.0">
<image>
<Image url="@../images/img.png" />
</image>
</ImageView>
<Label maxWidth="200.0" text="All data is consistently updated and reverified" textAlignment="CENTER" textFill="WHITE" translateY="30.0" wrapText="true">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
</children>
</StackPane>
</children>
</GridPane>
</children>
</HBox>
<!-- Pull in the navbar from components with its own controller -->
<fx:include fx:id="footer" source="components/footer.fxml"/>
</children>
</GridPane>

0 comments on commit 89e3382

Please sign in to comment.