Skip to content

Commit

Permalink
Merge pull request #118 from tharshita/master
Browse files Browse the repository at this point in the history
added goals and achievement tabs with recipe stubs
  • Loading branch information
YuuTon9 authored Apr 1, 2020
2 parents 32ab8e9 + 30bcde6 commit e0c0124
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 5 deletions.
16 changes: 15 additions & 1 deletion data/plannedbook.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{
"plannedRecipes" : [ ]
"plannedRecipes" : [ {
"recipes" : [ {
"name" : "Asian BBQ Chicken 2",
"time" : "15",
"isFavourite" : false,
"grains" : [ ],
"vegetables" : [ "1.0tbsp, garlic & ginger (finely chopped)" ],
"proteins" : [ "100.0g, chicken breast" ],
"fruits" : [ ],
"others" : [ "2.0tbsp, char siew sauce", "1.0tsp, honey", "1.0tsp, rice vinegar", "1.0tsp, Salt & pepper", "0.5tsp, sesame oil", "50.0g, sugarspiceeverythingnice" ],
"steps" : [ "In a bowl, mix all the ingredients to create marinade. Mix the chicken with the marinade.", "Pan sear the chicken from both sides.", "edited step 3", "hi" ],
"goals" : [ "Bulk like the Hulk" ]
} ],
"date" : "2020-05-19"
} ]
}
22 changes: 21 additions & 1 deletion src/main/java/seedu/recipe/ui/MainTabPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,29 @@ public class MainTabPanel extends UiPart<Region> {
@FXML
private StackPane planningListPanelPlaceholder;

@FXML
private StackPane goalsListPanelPlaceholder;

@FXML
private StackPane achievementsListPanelPlaceholder;


@FXML
private TabPane mainTabPanel;

public MainTabPanel(RecipeListPanel recipeListPanel, PlanningListPanel planningListPanel) {
//TODO: change last argument's RecipeListPanel to AchievementsListPanel once class is created
public MainTabPanel(RecipeListPanel recipeListPanel, PlanningListPanel planningListPanel,
RecipeListPanel goalsListPanel, RecipeListPanel achievementsListPanel) {
super(FXML);

recipeListPanelPlaceholder.getChildren().add(recipeListPanel.getRoot());

planningListPanelPlaceholder.getChildren().add(planningListPanel.getRoot());

goalsListPanelPlaceholder.getChildren().add(goalsListPanel.getRoot());

achievementsListPanelPlaceholder.getChildren().add(achievementsListPanel.getRoot());

}

protected void switchToRecipesTab() {
Expand All @@ -42,4 +54,12 @@ protected void switchToRecipesTab() {
protected void switchToPlanningTab() {
this.mainTabPanel.getSelectionModel().select(1);
}

protected void switchToGoalsTab() {
this.mainTabPanel.getSelectionModel().select(2);
}

protected void switchToAchievementsTab() {
this.mainTabPanel.getSelectionModel().select(3);
}
}
38 changes: 36 additions & 2 deletions src/main/java/seedu/recipe/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class MainWindow extends UiPart<Stage> {
private MainTabPanel mainTabPanel;
private PlanningListPanel planningListPanel;
private RecipeListPanel recipeListPanel;
private RecipeListPanel goalsListPanel;
private RecipeListPanel achievementsListPanel;
private ResultDisplay resultDisplay;
private HelpWindow helpWindow;

Expand All @@ -56,6 +58,12 @@ public class MainWindow extends UiPart<Stage> {
@FXML
private StackPane recipeListPanelPlaceholder;

@FXML
private StackPane goalsListPanelPlaceholder;

@FXML
private StackPane achievementsListPanelPlaceholder;

@FXML
private StackPane resultDisplayPlaceholder;

Expand Down Expand Up @@ -123,11 +131,17 @@ void fillInnerParts() {
ObservableList<Recipe> recipeList = logic.getFilteredRecipeList();
recipeListPanel = new RecipeListPanel(recipeList);

//using recipe list as stub for planning list, to be editted later todo
ObservableList<PlannedRecipe> plannedList = logic.getFilteredPlannedList();
planningListPanel = new PlanningListPanel(plannedList);

mainTabPanel = new MainTabPanel(recipeListPanel, planningListPanel);
//using recipe list as stub for goalslist and achievements, to be edited later todo
ObservableList<Recipe> goalsList = logic.getFilteredRecipeList();
goalsListPanel = new RecipeListPanel(goalsList);

ObservableList<Recipe> achievementsList = logic.getFilteredRecipeList();
achievementsListPanel = new RecipeListPanel(achievementsList);

mainTabPanel = new MainTabPanel(recipeListPanel, planningListPanel, goalsListPanel, achievementsListPanel);
mainTabPanelPlaceholder.getChildren().add(mainTabPanel.getRoot());

resultDisplay = new ResultDisplay();
Expand Down Expand Up @@ -196,6 +210,12 @@ private void handleSwitchTab(Tab tab) {
case PLANNING:
showPlanningTab();
break;
case GOALS:
showGoalsTab();
break;
case ACHIEVEMENT:
showAchievementsTab();
break;
default:
break;
}
Expand Down Expand Up @@ -246,4 +266,18 @@ private void showRecipesTab() {
private void showPlanningTab() {
mainTabPanel.switchToPlanningTab();
}

/**
* Switch to goals tab.
*/
private void showGoalsTab() {
mainTabPanel.switchToGoalsTab();
}

/**
* Switch to achievements tab.
*/
private void showAchievementsTab() {
mainTabPanel.switchToAchievementsTab();
}
}
4 changes: 3 additions & 1 deletion src/main/java/seedu/recipe/ui/tab/Tab.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
*/
public enum Tab {
RECIPES,
PLANNING
PLANNING,
GOALS,
ACHIEVEMENT
}
22 changes: 22 additions & 0 deletions src/main/resources/view/MainTabPanel.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@
</VBox>
</content>
</Tab>
<Tab text="Goals">
<content>
<VBox fx:id="goalList" styleClass="pane-with-border" minWidth="340" prefWidth="340"
VBox.vgrow="ALWAYS">
<padding>
<Insets top="5" right="5" bottom="5" left="5"/>
</padding>
<StackPane fx:id="goalsListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>
</content>
</Tab>
<Tab text="Achievements">
<content>
<VBox fx:id="achievementList" styleClass="pane-with-border" minWidth="340" prefWidth="340"
VBox.vgrow="ALWAYS">
<padding>
<Insets top="5" right="5" bottom="5" left="5"/>
</padding>
<StackPane fx:id="achievementsListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>
</content>
</Tab>
</tabs>
</TabPane>
</VBox>

0 comments on commit e0c0124

Please sign in to comment.