Fork me on GitHub

Good day, How can I render each game in its own div rather than the set of vectors xtdb gives me. e.g go from #{["game1"]["game2"]["game3"]} #{["game1"]["game2"]["game3"]} #{["game1"]["game2"]["game3"]} to: game1 game2 game3

(defn list-games [{:keys [biff/db] :as sys}]
  (let [games (biff/q db
                      '{:find [title]
                        :where [[_ :game/title title]]})]
     (for [game games]
       [:div.text-green-600 games]))))

;; schema.clj
(def schema
  {:game/id :uuid
   :game/title :string
   :game [:map {:closed true}
          [:xt/id :game/id]

Jacob O'Bryant02:09:26

almost there--you can change the for bit to this:

(for [[title] games]
  [:div.text-green-600 title])

🙏 1

Hello, How are new features implemented in Biff? If add the following handler to an existing feature it works fine, but I get a 404 when it's implemented as it's own feature (no console error of note). email.clj

   (:require [com.biffweb :as biff]
             [ :as ui]))

 (defn email [_]
    [:div.flex.items-center.justify-center "Email"]))

 (def features
   {:routes [["/email" {:get email}]]})

Jacob O'Bryant20:09:02

You'll need to add the new feature map to this vector in your app's main namespace:

🙏 1

Thanks, as an aside how are image paths handled in Biff? if I have the following image:

What's the correct way to specify it's path? i.e
(defn email [_]
   [:img {:src "img/email.jpg}]])

Jacob O'Bryant21:09:12

the resources/public/ directory (and also target/resources/public, for generated files) is used as a root for static files ( is the relevant line in Biff's internals). The path you'd use for that file is "/img/email.jpg" . i.e. add a slash at the beginning so it's an absolute path instead of relative.

🙏 1
Jacob O'Bryant20:09:26

Final draft is done: I'm also trying out using Github Discussions for blog comments:

👍 1