diff --git a/data/plannedbook.json b/data/plannedbook.json index ed5efeafb84..0594b95f5f9 100644 --- a/data/plannedbook.json +++ b/data/plannedbook.json @@ -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" + } ] } diff --git a/src/main/java/seedu/recipe/ui/MainTabPanel.java b/src/main/java/seedu/recipe/ui/MainTabPanel.java index 1e7eb17dadb..fcf0d387dbe 100644 --- a/src/main/java/seedu/recipe/ui/MainTabPanel.java +++ b/src/main/java/seedu/recipe/ui/MainTabPanel.java @@ -22,17 +22,29 @@ public class MainTabPanel extends UiPart { @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() { @@ -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); + } } diff --git a/src/main/java/seedu/recipe/ui/MainWindow.java b/src/main/java/seedu/recipe/ui/MainWindow.java index f76ac3074c0..c8a49a090f1 100644 --- a/src/main/java/seedu/recipe/ui/MainWindow.java +++ b/src/main/java/seedu/recipe/ui/MainWindow.java @@ -38,6 +38,8 @@ public class MainWindow extends UiPart { private MainTabPanel mainTabPanel; private PlanningListPanel planningListPanel; private RecipeListPanel recipeListPanel; + private RecipeListPanel goalsListPanel; + private RecipeListPanel achievementsListPanel; private ResultDisplay resultDisplay; private HelpWindow helpWindow; @@ -56,6 +58,12 @@ public class MainWindow extends UiPart { @FXML private StackPane recipeListPanelPlaceholder; + @FXML + private StackPane goalsListPanelPlaceholder; + + @FXML + private StackPane achievementsListPanelPlaceholder; + @FXML private StackPane resultDisplayPlaceholder; @@ -123,11 +131,17 @@ void fillInnerParts() { ObservableList recipeList = logic.getFilteredRecipeList(); recipeListPanel = new RecipeListPanel(recipeList); - //using recipe list as stub for planning list, to be editted later todo ObservableList 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 goalsList = logic.getFilteredRecipeList(); + goalsListPanel = new RecipeListPanel(goalsList); + + ObservableList achievementsList = logic.getFilteredRecipeList(); + achievementsListPanel = new RecipeListPanel(achievementsList); + + mainTabPanel = new MainTabPanel(recipeListPanel, planningListPanel, goalsListPanel, achievementsListPanel); mainTabPanelPlaceholder.getChildren().add(mainTabPanel.getRoot()); resultDisplay = new ResultDisplay(); @@ -196,6 +210,12 @@ private void handleSwitchTab(Tab tab) { case PLANNING: showPlanningTab(); break; + case GOALS: + showGoalsTab(); + break; + case ACHIEVEMENT: + showAchievementsTab(); + break; default: break; } @@ -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(); + } } diff --git a/src/main/java/seedu/recipe/ui/tab/Tab.java b/src/main/java/seedu/recipe/ui/tab/Tab.java index e33ce961832..127eb2e4715 100644 --- a/src/main/java/seedu/recipe/ui/tab/Tab.java +++ b/src/main/java/seedu/recipe/ui/tab/Tab.java @@ -5,5 +5,7 @@ */ public enum Tab { RECIPES, - PLANNING + PLANNING, + GOALS, + ACHIEVEMENT } diff --git a/src/main/resources/view/MainTabPanel.fxml b/src/main/resources/view/MainTabPanel.fxml index 774d4a41f71..7509c853393 100644 --- a/src/main/resources/view/MainTabPanel.fxml +++ b/src/main/resources/view/MainTabPanel.fxml @@ -31,6 +31,28 @@ + + + + + + + + + + + + + + + + + + + +