From f030a32679e7291eeb3ec4925a6354767bed3694 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 1 Jun 2025 22:02:24 +0200 Subject: Add content to recipe page --- src/chef/pages/recipe.clj | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/chef/pages/recipe.clj') diff --git a/src/chef/pages/recipe.clj b/src/chef/pages/recipe.clj index 71dd4b2..f1c1a21 100644 --- a/src/chef/pages/recipe.clj +++ b/src/chef/pages/recipe.clj @@ -1,6 +1,7 @@ (ns chef.pages.recipe (:require [chef.database :as cdb] [chef.utils :as cutils] + [clojure.string :as cstr] [hiccup2.core :as html] [honey.sql :as sql] [next.jdbc :as jdbc] @@ -19,7 +20,24 @@ sql/format (jdbc/execute! @cdb/db) first))]] - [:b "TODO"]])) + [:h2 (str "Zutaten" + (condp = (:recipes/unit recipe) + 0 " pro Portion" + 1 " pro Person" + "") + ":")] + [:ul (for [ingredient (-> recipe + :recipes/ingredients + cutils/parse-ingredients)] + [:li + [:b (:description ingredient)] ": " + (:amount ingredient) (:unit ingredient)])] + [:h2 "Zubereitung"] + (->> (:recipes/preparation recipe) + cstr/split-lines + (map #(if (cstr/blank? %) + [:br] + [:p %])))])) (defn handler [req] (->> {:select [:*] -- cgit v1.2.3