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"
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 ""
}
}
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) {
{ user.Email } { recipeCount } recipes 0 favorites Favorites section is under construction! Activity section is under construction!
} else {
}
{ user.Name }
My Recipes
if len(recipes) <= 4 { for _, recipe :=range recipes { @recipeListItem(recipe) } } else { for _, recipe :=range
recipes[:4] { @recipeListItem(recipe) } }
My Favorites
Recent Activity
for _, eng := range engagement {
@activityListItem(eng)
}
Difficulty: { displayDifficulty(recipe.Difficulty) } | Duration: { recipe.Duration.Total } min | Category: { recipe.Category }
Difficulty: { displayDifficulty(recipe.Difficulty) }
Duration: { recipe.Duration.Total } min
Category: { recipe.Category }
if len(recipe.Tags) > 0 {Tags: { displayTags(recipe.Tags) }
}{ engagement.Message }
{ engagement.Created.Format("01/02/2006") }