From ab555ed09057af8f1c17122118074271350fdfe8 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Wed, 23 Jul 2025 18:27:14 -0700 Subject: [PATCH] (FIX): Removed activity section coming soon prompt. --- internal/templates/pages/profile.templ | 305 +++++++++++----------- internal/templates/pages/profile_templ.go | 44 ++-- 2 files changed, 180 insertions(+), 169 deletions(-) diff --git a/internal/templates/pages/profile.templ b/internal/templates/pages/profile.templ index 3b540f1..106559f 100644 --- a/internal/templates/pages/profile.templ +++ b/internal/templates/pages/profile.templ @@ -9,177 +9,190 @@ import domainUser "github.com/haydenhargreaves/Potion/internal/domain/user" import domainEngagement "github.com/haydenhargreaves/Potion/internal/domain/engagement" func displayDifficulty(diff int) string { - switch diff { - case 1: - return "Beginner" - case 2: - return "Easy" - case 3: - return "Intermediate" - case 4: - return "Challenging" - case 5: - return "Extreme" - default: - return "" - } + switch diff { + case 1: + return "Beginner" + case 2: + return "Easy" + case 3: + return "Intermediate" + case 4: + return "Challenging" + case 5: + return "Extreme" + default: + return "" + } } func displayTags(tags []domainRecipe.Tag) string { - names := make([]string, 0, len(tags)) - for _, tag := range tags { - names = append(names, tag.Name) - } - return strings.Join(names, ", ") + names := make([]string, 0, len(tags)) + for _, tag := range tags { + names = append(names, tag.Name) + } + return strings.Join(names, ", ") } templ userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int) { -
-
- if user.ImageUrl != "" { - - } else { - - } -
-
-

{ user.Name }

-

{ user.Email }

-
-
-

{ recipeCount } recipes

-

{ favoriteCount } favorites

-
-
-
-
+
+
+ if user.ImageUrl != "" { + + } else { + + } +
+
+

{ user.Name }

+

{ user.Email }

+
+
+

{ recipeCount } recipes

+

{ favoriteCount } favorites

+
+
+
+
} templ recipesSection(recipes []domainRecipe.Recipe) { -
-

My Recipes

- -
+
+

My Recipes

+ +
} templ favoritesSection(recipes []domainRecipe.Recipe) { -
-

My Favorites

- -
+
+

My Favorites

+ +
} templ activitySection(engagement []domainEngagement.Engagement) { -
-

Recent Activity

-

Activity section is under construction!

- -
+
+

Recent Activity

+ +
} templ recipeListItem(recipe domainRecipe.Recipe) { -
  • -

    - { recipe.Title } -

    - -

    - Difficulty: { displayDifficulty(recipe.Difficulty) } -

    -

    - Duration: { recipe.Duration.Total } min -

    -

    - Category: { recipe.Category } -

    - if len(recipe.Tags) > 0 { -

    - Tags: { displayTags(recipe.Tags) } -

    - } -
  • +
  • +

    + { recipe.Title } +

    + +

    + Difficulty: { displayDifficulty(recipe.Difficulty) } +

    +

    + Duration: { recipe.Duration.Total } min +

    +

    + Category: { recipe.Category } +

    + if len(recipe.Tags) > 0 { +

    + Tags: { displayTags(recipe.Tags) } +

    + } +
  • } templ activityListItem(engagement domainEngagement.Engagement) { -
  • -

    - { engagement.Message } -

    -

    - { engagement.Created.Format("01/02/2006") } -

    -
  • +
  • +

    + { engagement.Message } +

    +

    + { engagement.Created.Format("01/02/2006") } +

    +
  • } templ logoutSection() { -
    - - Logout - -
    +
    + + Logout + +
    } templ ProfilePage(user domainUser.User, recipes []domainRecipe.Recipe, favorites []domainRecipe.Recipe, engagement []domainEngagement.Engagement) { -@components.Navbar(" profile") -
    -
    - @userDetailsSection(user, len(recipes), len(favorites)) - @recipesSection(recipes) - @favoritesSection(favorites) - @activitySection(engagement) - @logoutSection() -
    -
    + @components.Navbar(" profile") +
    +
    + @userDetailsSection(user, len(recipes), len(favorites)) + @recipesSection(recipes) + @favoritesSection(favorites) + @activitySection(engagement) + @logoutSection() +
    +
    } diff --git a/internal/templates/pages/profile_templ.go b/internal/templates/pages/profile_templ.go index 83f7515..b652521 100644 --- a/internal/templates/pages/profile_templ.go +++ b/internal/templates/pages/profile_templ.go @@ -72,10 +72,9 @@ func userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int 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: 41, Col: 19} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 42, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -91,11 +90,10 @@ func userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs( - fmt.Sprintf("https://ui-avatars.com/api/?name=%s+%s&size=150", strings.Split(user.Name, " ")[0], - strings.Split(user.Name, " ")[1])) + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("https://ui-avatars.com/api/?name=%s+%s&size=150", strings.Split(user.Name, " ")[0], + strings.Split(user.Name, " ")[1])) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 45, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 48, Col: 40} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -113,7 +111,7 @@ func userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, 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: 49, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 53, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -126,7 +124,7 @@ func userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, 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: 50, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 54, Col: 47} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -139,7 +137,7 @@ func userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(recipeCount) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 53, Col: 75} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 57, Col: 72} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -152,7 +150,7 @@ func userDetailsSection(user domainUser.User, recipeCount int, favoriteCount int var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(favoriteCount) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 54, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 58, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -301,7 +299,7 @@ func activitySection(engagement []domainEngagement.Engagement) templ.Component { templ_7745c5c3_Var12 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "

    Recent Activity

    Activity section is under construction!