From 693ac373a7df8f57ac1f59744d7dc48bada85d62 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Wed, 25 Jun 2025 18:02:33 -0700 Subject: [PATCH 1/3] (FIX): Fixed the logout endpoint, just going to direct home. --- internal/app/handlers/auth_handler.go | 2 + internal/templates/pages/profile.templ | 53 +++++++++++++---------- internal/templates/pages/profile_templ.go | 11 +++-- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/internal/app/handlers/auth_handler.go b/internal/app/handlers/auth_handler.go index b4b536b..1733250 100644 --- a/internal/app/handlers/auth_handler.go +++ b/internal/app/handlers/auth_handler.go @@ -57,7 +57,9 @@ func GoogleCallback(ctx *gin.Context) { // Logout removes the token from the user's browser. Effectively "logging them out." Routes that // require authentication will require the user to sign back in before accessing them again. +// This route will direct the user back to the home page. func Logout(ctx *gin.Context) { // TODO: Use same values as the GoogleCallback function ctx.SetCookie("jwt_token", "", -1, "/", "localhost", false, true) + ctx.Redirect(http.StatusSeeOther, "/v1/web/home") } diff --git a/internal/templates/pages/profile.templ b/internal/templates/pages/profile.templ index 0902f75..c8735e2 100644 --- a/internal/templates/pages/profile.templ +++ b/internal/templates/pages/profile.templ @@ -4,34 +4,39 @@ import "github.com/haydenhargreaves/Potion/internal/templates/components" import "github.com/haydenhargreaves/Potion/internal/domain/user" templ userDetailsSection(user domain.User) { -
-
- -
-

{ user.Name }

-

{ user.Email }

-
-
-
+
+
+ +
+

{ user.Name }

+

{ user.Email }

+
+
+
} templ logoutSection() { -
- -
+
+ + Logout + +
} templ ProfilePage(user domain.User) { -@components.Navbar(" profile") -
-
- @userDetailsSection(user) - @logoutSection() -
-
+ @components.Navbar(" profile") +
+
+ @userDetailsSection(user) + @logoutSection() +
+
} diff --git a/internal/templates/pages/profile_templ.go b/internal/templates/pages/profile_templ.go index 361d9cc..c67af74 100644 --- a/internal/templates/pages/profile_templ.go +++ b/internal/templates/pages/profile_templ.go @@ -37,10 +37,9 @@ func userDetailsSection(user domain.User) templ.Component { return templ_7745c5c3_Err } var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs( - user.ImageUrl) + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(user.ImageUrl) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 10, Col: 19} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 11, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -53,7 +52,7 @@ func userDetailsSection(user domain.User) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(user.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 12, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 14, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -66,7 +65,7 @@ func userDetailsSection(user domain.User) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(user.Email) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 13, Col: 48} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 15, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -101,7 +100,7 @@ func logoutSection() templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
Logout
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } From cf0e291dd9395e5a0f121f01b99ca338367fbb59 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Wed, 25 Jun 2025 18:23:47 -0700 Subject: [PATCH 2/3] (FEAT): Implemented a route constants domain file. This file contains route constants so they can be changed dynamically. However, they do not support changes to the router, those are still manual. --- internal/app/handlers/auth_handler.go | 2 +- internal/app/handlers/page_handler.go | 2 +- internal/app/server/server.go | 10 +- internal/domain/recipe/recipe.go | 0 internal/domain/recipe/repository.go | 0 internal/domain/recipe/service.go | 0 internal/domain/server/routes.go | 20 ++ internal/templates/components/navbar.templ | 21 +- internal/templates/pages/home.templ | 251 ++++++++++++--------- internal/templates/pages/login.templ | 4 +- internal/templates/pages/profile.templ | 9 +- 11 files changed, 187 insertions(+), 132 deletions(-) delete mode 100644 internal/domain/recipe/recipe.go delete mode 100644 internal/domain/recipe/repository.go delete mode 100644 internal/domain/recipe/service.go create mode 100644 internal/domain/server/routes.go diff --git a/internal/app/handlers/auth_handler.go b/internal/app/handlers/auth_handler.go index 1733250..6b28357 100644 --- a/internal/app/handlers/auth_handler.go +++ b/internal/app/handlers/auth_handler.go @@ -61,5 +61,5 @@ func GoogleCallback(ctx *gin.Context) { func Logout(ctx *gin.Context) { // TODO: Use same values as the GoogleCallback function ctx.SetCookie("jwt_token", "", -1, "/", "localhost", false, true) - ctx.Redirect(http.StatusSeeOther, "/v1/web/home") + ctx.Redirect(http.StatusSeeOther, domain.WEB_HOME) } diff --git a/internal/app/handlers/page_handler.go b/internal/app/handlers/page_handler.go index 7f3c12c..71368e0 100644 --- a/internal/app/handlers/page_handler.go +++ b/internal/app/handlers/page_handler.go @@ -40,7 +40,7 @@ func CreatePage(ctx *gin.Context) { func ProfilePage(ctx *gin.Context) { // If not logged in, direct to the login page if !domain.IsLoggedIn(ctx) { - ctx.Redirect(http.StatusSeeOther, "/v1/web/login") + ctx.Redirect(http.StatusSeeOther, domain.WEB_LOGIN) return } diff --git a/internal/app/server/server.go b/internal/app/server/server.go index 291bc4c..c891e49 100644 --- a/internal/app/server/server.go +++ b/internal/app/server/server.go @@ -124,14 +124,14 @@ func (s *Server) Setup() *Server { s.Router.Use(JwtAuthMiddleWare(jwtSecret)) // Redirect index to home page: Update this as needed - s.Router.GET("/", func(ctx *gin.Context) { ctx.Redirect(http.StatusSeeOther, "/v1/web/home") }) + s.Router.GET("/", func(ctx *gin.Context) { ctx.Redirect(http.StatusSeeOther, domain.WEB_HOME) }) // Wrap all routes with a version - router_v1 := s.Router.Group("/v1") + router_v1 := s.Router.Group(domain.VERSION) // Domain specific routers - router_web := router_v1.Group("/web") - router_api := router_v1.Group("/api") + router_web := router_v1.Group(domain.WEB) + router_api := router_v1.Group(domain.API) // Static routes router_web.Static("/static", "./web/static") @@ -151,8 +151,8 @@ func (s *Server) Setup() *Server { }) // WEB router endpoints + router_web.GET("/", func(ctx *gin.Context) { ctx.Redirect(http.StatusSeeOther, domain.WEB_HOME) }) router_web.GET("/login", handlers.LoginPage) - router_web.GET("/", func(ctx *gin.Context) { ctx.Redirect(http.StatusSeeOther, "/v1/web/home") }) router_web.GET("/home", handlers.HomePage) router_web.GET("/favorites", handlers.FavoritesPage) router_web.GET("/create", handlers.CreatePage) diff --git a/internal/domain/recipe/recipe.go b/internal/domain/recipe/recipe.go deleted file mode 100644 index e69de29..0000000 diff --git a/internal/domain/recipe/repository.go b/internal/domain/recipe/repository.go deleted file mode 100644 index e69de29..0000000 diff --git a/internal/domain/recipe/service.go b/internal/domain/recipe/service.go deleted file mode 100644 index e69de29..0000000 diff --git a/internal/domain/server/routes.go b/internal/domain/server/routes.go new file mode 100644 index 0000000..2e7d279 --- /dev/null +++ b/internal/domain/server/routes.go @@ -0,0 +1,20 @@ +package domain + +// Sub-routes +const VERSION = "/v1" +const WEB = VERSION + "/web" +const API = VERSION + "/api" + +// Web prefixed routes +const WEB_LOGIN = WEB + "/login" +const WEB_INDEX = WEB +const WEB_HOME = WEB + "/home" +const WEB_FAVORITES = WEB + "/favorites" +const WEB_CREATE = WEB + "/create" +const WEB_PROFIlE = WEB + "/profile" +const WEB_LIST = WEB + "/list" + +// API prefixed routes +const API_AUTH_LOGIN = API + "/auth/login" +const API_AUTH_CALLBACK = API + "/auth/callback" +const API_AUTH_LOGOUT = API + "/auth/logout" diff --git a/internal/templates/components/navbar.templ b/internal/templates/components/navbar.templ index b1560a5..ac23cc1 100644 --- a/internal/templates/components/navbar.templ +++ b/internal/templates/components/navbar.templ @@ -1,6 +1,7 @@ package components import "strings" +import "github.com/haydenhargreaves/Potion/internal/domain/server" templ hamburgerMenu() { } @@ -67,11 +68,11 @@ templ Navbar(current string) {

Potion

+ } templ searchSection() { -
- @components.BannerText("Craving Something Specific?") -
- @searchBar() - @components.FilterDropdown() -
-
+
+ @components.BannerText("Craving Something Specific?") +
+ @searchBar() + @components.FilterDropdown() +
+
} templ highlightSection(liked bool) { -
- @components.BannerText("Recipe of the Week!") -

- 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! -

-
- @components.RecipeCardLarge(false) -
-
+
+ @components.BannerText("Recipe of the Week!") +

+ 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! +

+
+ @components.RecipeCardLarge(false) +
+
} templ listsSection() { -
- @components.BannerText("Take Another Look.") -
-

Recently viewed

-
- @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) - @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) - @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) - @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) - @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) - @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) -
-

Make again

-
- @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) - @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) - @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) - @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) - @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) - @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) -
-
-
+
+ @components.BannerText("Take Another Look.") +
+

Recently viewed

+
+ @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) + @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) + @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) + @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) + @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) + @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) +
+

Make again

+
+ @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) + @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) + @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) + @components.RecipeCardSmall("Avocado Toast", "Breakfast - 15 min", "Hayden Hargreaves", true) + @components.RecipeCardSmall("Fried Chicken", "Dinner - 120 min", "Hayden Hargreaves", false) + @components.RecipeCardSmall("Classic Butter Chicken", "Dinner - 60 min", "Hayden Hargreaves", false) +
+
+
} templ ctaSection() { -
-

- Unleash Your Inner Chef! -

-

- Have a unique recipe idea? Want to share your culinary masterpiece with the world? - It's time to bring your creations to life! -

- +

+ Unleash Your Inner Chef! +

+

+ Have a unique recipe idea? Want to share your culinary masterpiece with the world? + It's time to bring your creations to life! +

+
- Create Your Recipe! - -
+ text-lg md:text-2xl font-bold uppercase tracking-wide" + > + Create Your Recipe! + + } templ HomePage() { -@components.Navbar("home") -
-
- @introSection() - @searchSection() - @highlightSection(false) - @listsSection() - @ctaSection() -
-
+ @components.Navbar("home") +
+
+ @introSection() + @searchSection() + @highlightSection(false) + @listsSection() + @ctaSection() +
+
} diff --git a/internal/templates/pages/login.templ b/internal/templates/pages/login.templ index 45b028a..dd9cb45 100644 --- a/internal/templates/pages/login.templ +++ b/internal/templates/pages/login.templ @@ -1,5 +1,7 @@ package templates +import "github.com/haydenhargreaves/Potion/internal/domain/server" + templ LoginPage() {
@@ -15,7 +17,7 @@ templ LoginPage() {
diff --git a/internal/templates/pages/profile.templ b/internal/templates/pages/profile.templ index c8735e2..2480b9b 100644 --- a/internal/templates/pages/profile.templ +++ b/internal/templates/pages/profile.templ @@ -1,9 +1,10 @@ package templates import "github.com/haydenhargreaves/Potion/internal/templates/components" -import "github.com/haydenhargreaves/Potion/internal/domain/user" +import domain "github.com/haydenhargreaves/Potion/internal/domain/server" +import domain_user"github.com/haydenhargreaves/Potion/internal/domain/user" -templ userDetailsSection(user domain.User) { +templ userDetailsSection(user domain_user.User) {
Logout @@ -29,7 +30,7 @@ templ logoutSection() { } -templ ProfilePage(user domain.User) { +templ ProfilePage(user domain_user.User) { @components.Navbar(" profile")
Date: Wed, 25 Jun 2025 21:11:39 -0700 Subject: [PATCH 3/3] (FIX): Fixed the Google domain bug. --- internal/app/server/server.go | 4 +- internal/domain/server/routes.go | 24 ++++++------ internal/templates/components/navbar_templ.go | 31 +++++++-------- internal/templates/pages/home_templ.go | 26 ++++++++++--- internal/templates/pages/login_templ.go | 17 ++++++++- internal/templates/pages/profile_templ.go | 38 +++++++++++++------ 6 files changed, 93 insertions(+), 47 deletions(-) diff --git a/internal/app/server/server.go b/internal/app/server/server.go index c891e49..7f3e608 100644 --- a/internal/app/server/server.go +++ b/internal/app/server/server.go @@ -58,8 +58,10 @@ func (s *Server) ConfigureAuth() *Server { panic("Could not load env file") } + redirect_domain := os.Getenv("DOMAIN") + var ( - redirectUrl string = "http://localhost:3000/v1/api/auth/callback" + redirectUrl string = fmt.Sprintf("%s%s", redirect_domain, domain.API_AUTH_CALLBACK) clientId string = os.Getenv("GOOGLE_CLIENT_ID") clientSecret string = os.Getenv("GOOGLE_CLIENT_SECRET") scope []string = []string{ diff --git a/internal/domain/server/routes.go b/internal/domain/server/routes.go index 2e7d279..48c96a6 100644 --- a/internal/domain/server/routes.go +++ b/internal/domain/server/routes.go @@ -2,19 +2,19 @@ package domain // Sub-routes const VERSION = "/v1" -const WEB = VERSION + "/web" -const API = VERSION + "/api" +const WEB = "/web" +const API = "/api" // Web prefixed routes -const WEB_LOGIN = WEB + "/login" -const WEB_INDEX = WEB -const WEB_HOME = WEB + "/home" -const WEB_FAVORITES = WEB + "/favorites" -const WEB_CREATE = WEB + "/create" -const WEB_PROFIlE = WEB + "/profile" -const WEB_LIST = WEB + "/list" +const WEB_LOGIN = VERSION + WEB + "/login" +const WEB_INDEX = VERSION + WEB +const WEB_HOME = VERSION + WEB + "/home" +const WEB_FAVORITES = VERSION + WEB + "/favorites" +const WEB_CREATE = VERSION + WEB + "/create" +const WEB_PROFIlE = VERSION + WEB + "/profile" +const WEB_LIST = VERSION + WEB + "/list" // API prefixed routes -const API_AUTH_LOGIN = API + "/auth/login" -const API_AUTH_CALLBACK = API + "/auth/callback" -const API_AUTH_LOGOUT = API + "/auth/logout" +const API_AUTH_LOGIN = VERSION + API + "/auth/login" +const API_AUTH_CALLBACK = VERSION + API + "/auth/callback" +const API_AUTH_LOGOUT = VERSION + API + "/auth/logout" diff --git a/internal/templates/components/navbar_templ.go b/internal/templates/components/navbar_templ.go index f04ba9d..d2a2eef 100644 --- a/internal/templates/components/navbar_templ.go +++ b/internal/templates/components/navbar_templ.go @@ -9,6 +9,7 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import "strings" +import "github.com/haydenhargreaves/Potion/internal/domain/server" func hamburgerMenu() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -35,23 +36,23 @@ func hamburgerMenu() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = dropdownLink("Home", "/v1/web/home").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = dropdownLink("Home", domain.WEB_HOME).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = dropdownLink("Favorites", "/v1/web/favorites").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = dropdownLink("Favorites", domain.WEB_FAVORITES).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = dropdownLink("Create", "/v1/web/create").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = dropdownLink("Create", domain.WEB_CREATE).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = dropdownLink("Profile", "/v1/web/profile").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = dropdownLink("Profile", domain.WEB_PROFIlE).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = dropdownLink("Shopping List", "/v1/web/list").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = dropdownLink("Shopping List", domain.WEB_LIST).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -91,7 +92,7 @@ func navLink(current, name, url string) templ.Component { var templ_7745c5c3_Var3 templ.SafeURL templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(url)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 38, Col: 28} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 39, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -119,7 +120,7 @@ func navLink(current, name, url string) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 41, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 42, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -161,7 +162,7 @@ func dropdownLink(name, url string) templ.Component { var templ_7745c5c3_Var6 templ.SafeURL templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(url)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 46, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 47, Col: 41} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -174,7 +175,7 @@ func dropdownLink(name, url string) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 47, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 48, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -216,7 +217,7 @@ func listIcon(current, name, url string) templ.Component { var templ_7745c5c3_Var9 templ.SafeURL templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(url)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 52, Col: 28} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 53, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -270,23 +271,23 @@ func Navbar(current string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = navLink(current, "Home", "/v1/web/home").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = navLink(current, "Home", domain.WEB_HOME).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = navLink(current, "Favorites", "/v1/web/favorites").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = navLink(current, "Favorites", domain.WEB_FAVORITES).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = navLink(current, "Create", "/v1/web/create").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = navLink(current, "Create", domain.WEB_CREATE).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = navLink(current, "Profile", "/v1/web/profile").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = navLink(current, "Profile", domain.WEB_PROFIlE).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = listIcon(current, "List", "/v1/web/list").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = listIcon(current, "List", domain.WEB_LIST).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/home_templ.go b/internal/templates/pages/home_templ.go index 6dd1a3e..fc5fac4 100644 --- a/internal/templates/pages/home_templ.go +++ b/internal/templates/pages/home_templ.go @@ -9,6 +9,7 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import "github.com/haydenhargreaves/Potion/internal/templates/components" +import "github.com/haydenhargreaves/Potion/internal/domain/server" func introSection() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -313,7 +314,20 @@ func ctaSection() templ.Component { templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "

Unleash Your Inner Chef!

Have a unique recipe idea? Want to share your culinary masterpiece with the world? It's time to bring your creations to life!

Create Your Recipe!
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "

Unleash Your Inner Chef!

Have a unique recipe idea? Want to share your culinary masterpiece with the world? It's time to bring your creations to life!

Create Your Recipe!
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -337,16 +351,16 @@ func HomePage() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var8 := templ.GetChildren(ctx) - if templ_7745c5c3_Var8 == nil { - templ_7745c5c3_Var8 = templ.NopComponent + templ_7745c5c3_Var9 := templ.GetChildren(ctx) + if templ_7745c5c3_Var9 == nil { + templ_7745c5c3_Var9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = components.Navbar("home").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -370,7 +384,7 @@ func HomePage() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/login_templ.go b/internal/templates/pages/login_templ.go index 177e261..3c5be60 100644 --- a/internal/templates/pages/login_templ.go +++ b/internal/templates/pages/login_templ.go @@ -8,6 +8,8 @@ package templates import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" +import "github.com/haydenhargreaves/Potion/internal/domain/server" + func LoginPage() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context @@ -29,7 +31,20 @@ func LoginPage() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Sign in to Continue

You need to sign in to continue. Don't have an account? Signing in will create one for you!

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Sign in to Continue

You need to sign in to continue. Don't have an account? Signing in will create one for you!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/profile_templ.go b/internal/templates/pages/profile_templ.go index c67af74..8d9a680 100644 --- a/internal/templates/pages/profile_templ.go +++ b/internal/templates/pages/profile_templ.go @@ -9,9 +9,10 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import "github.com/haydenhargreaves/Potion/internal/templates/components" -import "github.com/haydenhargreaves/Potion/internal/domain/user" +import domain "github.com/haydenhargreaves/Potion/internal/domain/server" +import domain_user "github.com/haydenhargreaves/Potion/internal/domain/user" -func userDetailsSection(user domain.User) templ.Component { +func userDetailsSection(user domain_user.User) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -39,7 +40,7 @@ func userDetailsSection(user domain.User) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(user.ImageUrl) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 11, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 12, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -52,7 +53,7 @@ func userDetailsSection(user domain.User) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(user.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 14, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 15, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -65,7 +66,7 @@ func userDetailsSection(user domain.User) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(user.Email) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 15, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 16, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -100,7 +101,20 @@ func logoutSection() templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
Logout
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
Logout
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -108,7 +122,7 @@ func logoutSection() templ.Component { }) } -func ProfilePage(user domain.User) templ.Component { +func ProfilePage(user domain_user.User) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -124,16 +138,16 @@ func ProfilePage(user domain.User) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var6 := templ.GetChildren(ctx) - if templ_7745c5c3_Var6 == nil { - templ_7745c5c3_Var6 = templ.NopComponent + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = components.Navbar(" profile").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -145,7 +159,7 @@ func ProfilePage(user domain.User) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }