diff --git a/internal/app/service/recipe_service.go b/internal/app/service/recipe_service.go index 063db48..fc89a87 100644 --- a/internal/app/service/recipe_service.go +++ b/internal/app/service/recipe_service.go @@ -136,7 +136,7 @@ func (s *RecipeService) GetRecipe(id int, userId *int) (*domain.Recipe, error) { recipe, err := s.recipeRepository.GetRecipe(id, userId) if recipe == nil { - return nil, fmt.Errorf("Failed to get recipe from database. Nil result.") + return nil, fmt.Errorf("Recipe does not exist or has been relocated. Please try again.") } return recipe, err diff --git a/internal/templates/components/banner_templ.go b/internal/templates/components/banner_templ.go index bf8cab0..39dd247 100644 --- a/internal/templates/components/banner_templ.go +++ b/internal/templates/components/banner_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/templates/components/cards_templ.go b/internal/templates/components/cards_templ.go index 65fb91b..e5a7372 100644 --- a/internal/templates/components/cards_templ.go +++ b/internal/templates/components/cards_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -170,8 +170,12 @@ func ContentCardSmall(content, target string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var9 templ.SafeURL = templ.SafeURL(target) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var9))) + var templ_7745c5c3_Var9 templ.SafeURL + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(target)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/cards.templ`, Line: 49, Col: 52} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/components/dropdowns_templ.go b/internal/templates/components/dropdowns_templ.go index 723c9a8..7f1c7d8 100644 --- a/internal/templates/components/dropdowns_templ.go +++ b/internal/templates/components/dropdowns_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/templates/components/navbar_templ.go b/internal/templates/components/navbar_templ.go index 9a3c7c2..42f7a39 100644 --- a/internal/templates/components/navbar_templ.go +++ b/internal/templates/components/navbar_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -36,8 +36,12 @@ func navLink(current, name, url string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var2 templ.SafeURL = templ.SafeURL(url) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2))) + var templ_7745c5c3_Var2 templ.SafeURL + templ_7745c5c3_Var2, 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: 8, Col: 27} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -102,8 +106,12 @@ func dropdownLink(name, url string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var5 templ.SafeURL = templ.SafeURL(url) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5))) + var templ_7745c5c3_Var5 templ.SafeURL + templ_7745c5c3_Var5, 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: 20, Col: 42} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -153,8 +161,12 @@ func listIcon(current, name, url string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var8 templ.SafeURL = templ.SafeURL(url) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var8))) + var templ_7745c5c3_Var8 templ.SafeURL + templ_7745c5c3_Var8, 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: 26, Col: 29} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -206,8 +218,12 @@ func Navbar(current string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var10 templ.SafeURL = domain.WEB_HOME - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var10))) + var templ_7745c5c3_Var10 templ.SafeURL + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_HOME) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/navbar.templ`, Line: 50, Col: 29} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/components/search_bar_templ.go b/internal/templates/components/search_bar_templ.go index 308643d..b67bc8d 100644 --- a/internal/templates/components/search_bar_templ.go +++ b/internal/templates/components/search_bar_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/templates/layouts/app_layout_templ.go b/internal/templates/layouts/app_layout_templ.go index e87c188..e5cff7f 100644 --- a/internal/templates/layouts/app_layout_templ.go +++ b/internal/templates/layouts/app_layout_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/templates/pages/create.templ b/internal/templates/pages/create.templ index ee26f4f..309f40c 100644 --- a/internal/templates/pages/create.templ +++ b/internal/templates/pages/create.templ @@ -25,7 +25,7 @@ templ Page() { share your masterpiece!

* -
-
+
    +
  • -
-
+ + `; list.appendChild(item); } + function removeIngredient(index) { + const list = document.getElementById("ingredient-list"); + + // List contents, ensure valid items + const listElement = list.querySelector(`#ingredient-${index}`); + if (listElement) listElement.remove(); + } + function addInstruction() { const list = document.getElementById("instruction-list"); const itemNum = list.querySelectorAll("textarea").length + 1; - const item = document.createElement("textarea"); - item.id = "instructions"; - item.name = "instructions"; - item.className = "border border-gray-300 my-2 px-4 py-2 rounded-lg focus:outline-none focus:ring-blue-500 focus:ring-2 duration-200 ease-in-out transition-all resize-none shadow-sm"; - item.rows = "3"; - item.placeholder = `Step ${itemNum}: Describe this step...`; - list.appendChild(item); + const div = document.createElement("div"); + div.id = `instruction-${itemNum}`; + div.className = "flex"; + + div.innerHTML = ` + + + + `; + + list.appendChild(div); } - + + function removeInstruction (num) { + const list = document.getElementById("instruction-list"); + const item = list.querySelector(`#instruction-${num}`); + if (item) item.remove(); + + // This list will start at 2, since the first element is not included + const remainingItems = list.querySelectorAll("div"); + + for (let i = 2; i < remainingItems.length + 2; i++) { + // Get the old content + const textContent = remainingItems[i - 2].querySelector("textarea").value; + + // Create a new element + const div = document.createElement("div"); + div.id = `instruction-${i}`; + div.className = "flex"; + div.innerHTML = ` + + + + `; + + remainingItems[i - 2].replaceWith(div); + } + } + } diff --git a/internal/templates/pages/create_templ.go b/internal/templates/pages/create_templ.go index 0ed069d..799bdc7 100644 --- a/internal/templates/pages/create_templ.go +++ b/internal/templates/pages/create_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -84,26 +84,26 @@ func Page() templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(domain.API_CREATE_RECIPE) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/create.templ`, Line: 28, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/create.templ`, Line: 28, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" hx-swap=\"outerHTML\" hx-target=\"#response\" hx-trigger=\"submit\" hx-encoding=\"multipart/form-data\">

Please enter a title. Between 1-128 characters.

Please enter a description. Between 1-1000 characters.

Please enter a title. Between 1-128 characters.

Please enter a description. Between 1-1000 characters.

    Please enter a time (minutes).

    Please enter a time (minutes).

    Please enter a serving size.

    Please select a category.

    Please select a difficulty.

    Please enter at least one ingredient.

    Please provide a quantity.

    Please enter at least one step.

    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" maxlength=\"32\" hx-trigger=\"keyup[keyCode==13]\" hx-on::after-request=\"this.value=''\" hx-swap=\"innerHTML\" hx-target=\"#tag-list\" enterkeyhint=\"done\" type=\"text\" id=\"tag\" name=\"tag\" placeholder=\"e.g., Healthy\">

    Please enter a time (minutes).

    Please enter a time (minutes).

    Please enter a serving size.

    Please select a category.

    Please select a difficulty.

    Please enter at least one step.

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/favorites.templ b/internal/templates/pages/favorites.templ index b51f075..eb5f65c 100644 --- a/internal/templates/pages/favorites.templ +++ b/internal/templates/pages/favorites.templ @@ -6,73 +6,72 @@ import "github.com/haydenhargreaves/Potion/internal/domain/recipe" import domainServer "github.com/haydenhargreaves/Potion/internal/domain/server" templ FavoriteList(recipes []domain.Recipe) { -
    - for _, recipe := range recipes { - @favoriteResult(recipe) - } - if len(recipes) == 0 || recipes == nil { -

    No results

    - } else { -

    End of results

    - } -
    +
    + for _, recipe := range recipes { + @favoriteResult(recipe) + } + if len(recipes) == 0 || recipes == nil { +

    No results

    + } else { +

    End of results

    + } +
    } templ favoriteResult(recipe domain.Recipe) { -
    - -
    -
    -
    -

    - { recipe.Title } -

    -
    - - @timeIconSm() - { recipe.Duration.Total } min - - - for _ = range(recipe.Difficulty) { - @starIconSm(true) - } - for _ = range(5 - recipe.Difficulty) { - @starIconSm(false) - } - - - @servingIconSm() - Serves { recipe.Serves } - -
    -
    - -
    -

    { recipe.Description }

    -
    -
    +
    + +
    +
    +
    +

    + { recipe.Title } +

    +
    + + @timeIconSm() + { recipe.Duration.Total } min + + + for _ = range(recipe.Difficulty) { + @starIconSm(true) + } + for _ = range(5 - recipe.Difficulty) { + @starIconSm(false) + } + + + @servingIconSm() + Serves { recipe.Serves } + +
    +
    + +
    +

    + { recipe.Description } +

    +
    +
    } templ FavoritesPage(filters *domain.SearchFilters) { - @components.Navbar("favorites") -
    -
    - @components.BannerText("Favorites") - @components.SearchBar(filters, false, true, true) -
    - @FavoriteList(nil) -
    -
    +@components.Navbar("favorites") +
    +
    + @components.BannerText("Favorites") + @components.SearchBar(filters, false, true, true) +
    + @FavoriteList(nil) +
    +
    } diff --git a/internal/templates/pages/favorites_templ.go b/internal/templates/pages/favorites_templ.go index a3fffd0..4fbb7ed 100644 --- a/internal/templates/pages/favorites_templ.go +++ b/internal/templates/pages/favorites_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -91,7 +91,7 @@ func favoriteResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(domainServer.API_ENGAGEMENT_VIEW, recipe.Id)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 23, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 22, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -104,7 +104,7 @@ func favoriteResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 33, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 30, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -117,7 +117,7 @@ func favoriteResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Category) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 33, Col: 91} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 30, Col: 95} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -134,7 +134,7 @@ func favoriteResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Duration.Total) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 38, Col: 30} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 35, Col: 35} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -171,20 +171,20 @@ func favoriteResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Serves) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 50, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 47, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "

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

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 63, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/favorites.templ`, Line: 61, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { diff --git a/internal/templates/pages/home_templ.go b/internal/templates/pages/home_templ.go index 179c7aa..668a9e5 100644 --- a/internal/templates/pages/home_templ.go +++ b/internal/templates/pages/home_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -199,8 +199,12 @@ func listsSection(loggedIn bool, viewed, made []domainRecipe.Recipe) templ.Compo if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var5 templ.SafeURL = domain.WEB_LOGIN - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5))) + var templ_7745c5c3_Var5 templ.SafeURL + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_LOGIN) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/home.templ`, Line: 71, Col: 50} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -248,8 +252,12 @@ func listsSection(loggedIn bool, viewed, made []domainRecipe.Recipe) templ.Compo if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var6 templ.SafeURL = domain.WEB_LOGIN - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var6))) + var templ_7745c5c3_Var6 templ.SafeURL + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_LOGIN) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/home.templ`, Line: 90, Col: 50} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -291,8 +299,12 @@ func ctaSection() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var8 templ.SafeURL = domain.WEB_CREATE - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var8))) + var templ_7745c5c3_Var8 templ.SafeURL + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_CREATE) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/home.templ`, Line: 109, Col: 29} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/list_templ.go b/internal/templates/pages/list_templ.go index 003bea5..8bc3a18 100644 --- a/internal/templates/pages/list_templ.go +++ b/internal/templates/pages/list_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/templates/pages/login_templ.go b/internal/templates/pages/login_templ.go index 7adc048..8fbefb8 100644 --- a/internal/templates/pages/login_templ.go +++ b/internal/templates/pages/login_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -35,8 +35,12 @@ func LoginPage() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var2 templ.SafeURL = domain.API_AUTH_LOGIN - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2))) + var templ_7745c5c3_Var2 templ.SafeURL + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinURLErrs(domain.API_AUTH_LOGIN) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/login.templ`, Line: 20, Col: 33} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/notFound_templ.go b/internal/templates/pages/notFound_templ.go index f6afbe0..e4723dd 100644 --- a/internal/templates/pages/notFound_templ.go +++ b/internal/templates/pages/notFound_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -40,8 +40,12 @@ func NotFoundPage() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var2 templ.SafeURL = domain.WEB_HOME - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2))) + var templ_7745c5c3_Var2 templ.SafeURL + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_HOME) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/notFound.templ`, Line: 28, Col: 82} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) 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 b652521..b3ac659 100644 --- a/internal/templates/pages/profile_templ.go +++ b/internal/templates/pages/profile_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -208,8 +208,12 @@ func recipesSection(recipes []domainRecipe.Recipe) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var9 templ.SafeURL = domain.WEB_NOT_FOUND - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var9))) + var templ_7745c5c3_Var9 templ.SafeURL + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_NOT_FOUND) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 78, Col: 33} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -265,8 +269,12 @@ func favoritesSection(recipes []domainRecipe.Recipe) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var11 templ.SafeURL = domain.WEB_FAVORITES - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var11))) + var templ_7745c5c3_Var11 templ.SafeURL + templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_FAVORITES) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 102, Col: 33} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -313,8 +321,12 @@ func activitySection(engagement []domainEngagement.Engagement) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var13 templ.SafeURL = domain.WEB_NOT_FOUND - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var13))) + var templ_7745c5c3_Var13 templ.SafeURL + templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinURLErrs(domain.WEB_NOT_FOUND) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 120, Col: 33} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -562,8 +574,12 @@ func logoutSection() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var28 templ.SafeURL = domain.API_AUTH_LOGOUT - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var28))) + var templ_7745c5c3_Var28 templ.SafeURL + templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinURLErrs(domain.API_AUTH_LOGOUT) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/profile.templ`, Line: 179, Col: 32} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/templates/pages/recipe_templ.go b/internal/templates/pages/recipe_templ.go index 10be9fc..a3e403b 100644 --- a/internal/templates/pages/recipe_templ.go +++ b/internal/templates/pages/recipe_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/templates/pages/search.templ b/internal/templates/pages/search.templ index 6ec50ef..050fb3d 100644 --- a/internal/templates/pages/search.templ +++ b/internal/templates/pages/search.templ @@ -1,146 +1,123 @@ package templates import ( - "fmt" - "github.com/haydenhargreaves/Potion/internal/domain/recipe" - domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe" - domainServer "github.com/haydenhargreaves/Potion/internal/domain/server" - "github.com/haydenhargreaves/Potion/internal/templates/components" +"fmt" +"github.com/haydenhargreaves/Potion/internal/domain/recipe" +domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe" +domainServer "github.com/haydenhargreaves/Potion/internal/domain/server" +"github.com/haydenhargreaves/Potion/internal/templates/components" ) templ SearchPage(filters *domainRecipe.SearchFilters, searchOnLoad bool) { - @components.Navbar("") -

    -
    - @components.BannerText("Recipe Search") - @components.SearchBar(filters, false, searchOnLoad, false) -
    - @ResultList(nil) -
    -
    + @components.Navbar("") +
    +
    + @components.BannerText("Recipe Search") + @components.SearchBar(filters, false, searchOnLoad, false) +
    + @ResultList(nil) +
    +
    } templ ResultList(recipes []domain.Recipe) { -
    - for _, recipe := range recipes { - @searchResult(recipe) - } - if len(recipes) == 0 || recipes == nil { -

    No results

    - } else { -

    End of results

    - } -
    +
    + for _, recipe := range recipes { + @searchResult(recipe) + } + if len(recipes) == 0 || recipes == nil { +

    No results

    + } else { +

    End of results

    + } +
    } templ searchResult(recipe domain.Recipe) { -
    - -
    -
    -
    -

    - { recipe.Title } -

    -
    - - @timeIconSm() - { recipe.Duration.Total } min - - - for _ = range(recipe.Difficulty) { - @starIconSm(true) - } - for _ = range(5 - recipe.Difficulty) { - @starIconSm(false) - } - - - @servingIconSm() - Serves { recipe.Serves } - -
    -
    - -
    -

    { recipe.Description }

    -
    -
    +
    + +
    +
    +
    +

    + { recipe.Title } +

    +
    + + @timeIconSm() + { recipe.Duration.Total } min + + + for _ = range(recipe.Difficulty) { + @starIconSm(true) + } + for _ = range(5 - recipe.Difficulty) { + @starIconSm(false) + } + + + @servingIconSm() + Serves { recipe.Serves } + +
    +
    + +
    +

    + { recipe.Description } +

    +
    +
    } templ servingIconSm() { - - - - - - - + + + + + + + } templ timeIconSm() { - - - + + + } templ starIconSm(filled bool) { - if filled { - - - - - } else { - - - - - } + if filled { + + + + + + } else { + + + + + + } } diff --git a/internal/templates/pages/search_templ.go b/internal/templates/pages/search_templ.go index 0dd6fc0..275bd90 100644 --- a/internal/templates/pages/search_templ.go +++ b/internal/templates/pages/search_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.865 +// templ: version: v0.3.924 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -41,7 +41,7 @@ func SearchPage(filters *domainRecipe.SearchFilters, searchOnLoad bool) templ.Co if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -147,7 +147,7 @@ func searchResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(domainServer.API_ENGAGEMENT_VIEW, recipe.Id)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 41, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 38, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -160,7 +160,7 @@ func searchResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 55, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 46, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -173,7 +173,7 @@ func searchResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Category) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 55, Col: 91} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 46, Col: 97} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -190,7 +190,7 @@ func searchResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Duration.Total) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 60, Col: 30} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 51, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -227,7 +227,7 @@ func searchResult(recipe domain.Recipe) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Serves) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 72, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 63, Col: 36} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -243,14 +243,14 @@ func searchResult(recipe domain.Recipe) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "

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

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 87, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 79, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -285,7 +285,7 @@ func servingIconSm() templ.Component { templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/web/static/css/tailwind.css b/web/static/css/tailwind.css index 080b507..fe3d6ea 100644 --- a/web/static/css/tailwind.css +++ b/web/static/css/tailwind.css @@ -1,4 +1,4 @@ -/*! tailwindcss v4.1.7 | MIT License | https://tailwindcss.com */ +/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */ @layer properties; @layer theme, base, components, utilities; @layer theme { @@ -412,9 +412,6 @@ .h-screen { height: 100vh; } - .min-h-72 { - min-height: calc(var(--spacing) * 72); - } .min-h-screen { min-height: 100vh; } @@ -760,6 +757,9 @@ .pb-1 { padding-bottom: calc(var(--spacing) * 1); } + .pl-4 { + padding-left: calc(var(--spacing) * 4); + } .pl-10 { padding-left: calc(var(--spacing) * 10); }