package templates import "github.com/haydenhargreaves/Potion/internal/templates/components" import "fmt" import "strings" import domain "github.com/haydenhargreaves/Potion/internal/domain/server" import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe" import domainUser "github.com/haydenhargreaves/Potion/internal/domain/user" 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 "" } } 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, ", ") } templ userDetailsSection(user domainUser.User, recipeCount int) {
if user.ImageUrl != "" { } else { }

{ user.Name }

{ user.Email }

{ recipeCount } recipes

0 favorites

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

My Recipes

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

My Favorites

Favorites section is under construction!

} templ activitySection() {

Recent Activity

Activity section is under construction!

} 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) }

    }
  • } templ activityListItem() {
  • Rated "Spicy Chicken Wings"

    2 days ago

  • } templ logoutSection() {
    Logout
    } templ ProfilePage(user domainUser.User, recipes []domainRecipe.Recipe) { @components.Navbar(" profile")
    @userDetailsSection(user, len(recipes)) @recipesSection(recipes) @favoritesSection(recipes) @activitySection() @logoutSection()
    }