diff --git a/internal/app/handlers/page_handler.go b/internal/app/handlers/page_handler.go
index 95716d1..53d2ac5 100755
--- a/internal/app/handlers/page_handler.go
+++ b/internal/app/handlers/page_handler.go
@@ -58,7 +58,18 @@ func HomePage(ctx *gin.Context) {
return
}
- page = templates.HomePage(true, viewedRecipes, madeRecipes, recipeOfTheWeek)
+ if bytes, err := ctx.Cookie("search-filters"); err != nil {
+ fmt.Printf("ERROR: Failed to get search-filter cookie. %s\n", err.Error())
+ page = templates.HomePage(true, viewedRecipes, madeRecipes, recipeOfTheWeek, nil)
+ } else {
+ var filters domainRecipe.SearchFilters
+ if err := json.Unmarshal([]byte(bytes), &filters); err != nil {
+ fmt.Printf("ERROR: Failed to unmarshal search-filter cookie. %s\n", err.Error())
+ page = templates.HomePage(true, viewedRecipes, madeRecipes, recipeOfTheWeek, nil)
+ } else {
+ page = templates.HomePage(true, viewedRecipes, madeRecipes, recipeOfTheWeek, &filters)
+ }
+ }
} else {
// Get the recipe of the week
recipeOfTheWeek, err := deps.RecipeService.GetRecipeOfTheWeek(nil)
@@ -70,7 +81,18 @@ func HomePage(ctx *gin.Context) {
return
}
- page = templates.HomePage(false, nil, nil, recipeOfTheWeek)
+ if bytes, err := ctx.Cookie("search-filters"); err != nil {
+ fmt.Printf("ERROR: Failed to get search-filter cookie. %s\n", err.Error())
+ page = templates.HomePage(false, nil, nil, recipeOfTheWeek, nil)
+ } else {
+ var filters domainRecipe.SearchFilters
+ if err := json.Unmarshal([]byte(bytes), &filters); err != nil {
+ fmt.Printf("ERROR: Failed to unmarshal search-filter cookie. %s\n", err.Error())
+ page = templates.HomePage(false, nil, nil, recipeOfTheWeek, nil)
+ } else {
+ page = templates.HomePage(false, nil, nil, recipeOfTheWeek, &filters)
+ }
+ }
}
title := "Potion - Home"
diff --git a/internal/templates/pages/home.templ b/internal/templates/pages/home.templ
index 6d79d3c..d636b42 100644
--- a/internal/templates/pages/home.templ
+++ b/internal/templates/pages/home.templ
@@ -5,132 +5,126 @@ import "github.com/haydenhargreaves/Potion/internal/domain/server"
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
templ introSection() {
-
- Welcome to your ultimate recipe hub! Whether you're a seasoned chef or just starting your culinary adventure,
- we're here to inspire. Explore thousands of delicious recipes, from quick weeknight dinners to gourmet delights,
- all at your fingertips. Find exactly what you're craving with our powerful search and intuitive filters, or
- browse our trending dishes for fresh ideas.
-
+ Welcome to your ultimate recipe hub! Whether you're a seasoned chef or just starting your culinary adventure,
+ we're here to inspire. Explore thousands of delicious recipes, from quick weeknight dinners to gourmet delights,
+ all at your fingertips. Find exactly what you're craving with our powerful search and intuitive filters, or
+ browse our trending dishes for fresh ideas.
+
- Our 'Recipe of the Week' is the cream of the crop! We handpick it by looking at what recipes
- our community loves most. This isn't just about how many people view a recipe; it's also about
- how many times it's been made, liked, reviewed, and its average rating, all combined to find
- the true fan favorite of the week. It's our way of highlighting the best recipes that truly
- resonate with our users!
-
+ Our 'Recipe of the Week' is the cream of the crop! We handpick it by looking at what recipes
+ our community loves most. This isn't just about how many people view a recipe; it's also about
+ how many times it's been made, liked, reviewed, and its average rating, all combined to find
+ the true fan favorite of the week. It's our way of highlighting the best recipes that truly
+ resonate with our users!
+ You have not viewed any recipes. There is nothing to show. You have not made any recipes. There is nothing to show. You have not viewed any recipes. There is nothing to show. You have not made any recipes. There is nothing to show.
- Have a unique recipe idea? Want to share your culinary masterpiece with the world?
- It's time to bring your creations to life!
-
+ Have a unique recipe idea? Want to share your culinary masterpiece with the world?
+ It's time to bring your creations to life!
+
- Discover Your Next Favorite Meal
-
-
+ Discover Your Next Favorite Meal
+
+ Recently viewed
- if loggedIn {
- Make again
- if loggedIn {
- Recently viewed
+ if loggedIn {
+ Make again
+ if loggedIn {
+
- Unleash Your Inner Chef!
-
-
+ Unleash Your Inner Chef!
+
+