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) {
{ user.Email } { recipeCount } recipes 0 favorites
{ user.Name }
My Recipes
if len(recipes) <= 4 {
for _, recipe := range recipes {
@recipeListItem(recipe)
}
} else {
for _, recipe := range recipes[:4] {
@recipeListItem(recipe)
}
}
My Favorites
if len(recipes) <= 4 {
for _, recipe := range recipes {
@recipeListItem(recipe)
}
} else {
for _, recipe := range recipes[:4] {
@recipeListItem(recipe)
}
}
Recent Activity
@activityListItem()
@activityListItem()
@activityListItem()
@activityListItem()
@activityListItem()
@activityListItem()
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) }
}Rated "Spicy Chicken Wings"
2 days ago