        (when @show-details
          [:div.card__details
           (:description card)
-          [render-tasks (:tasks card)]
+          [render-tasks (:card-id card) (:tasks card)]
           [render-add-list (:card-id card)]
          ])
        ])

(defn render-app
  []
  (let [search-text (r/atom "")
        on-search-enter (fn [e] (reset! search-text (.. e -target -value)))]
    (fn []
      [:div
       [:input.search-input


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; TODO - Separate concerns:
; - cards values and their id, and the order in which they appear
; - tasks values and their id

(def card-list (r/atom []))

(defn add-task-to!
  "Add a new task in the card"
  [card-id task]
  (defn add-if! [card]
    (if (= card-id (:card-id card))
      (update-in card [:tasks] conj (create-task! task false))
      card))
  (swap! card-list #(mapv add-if! %)))

(defn remove-task-from!
  "Remove a task from a card"
  [card-id task-id]
  (defn remove-if! [card]
    (if (= card-id (:card-id card))
      (update-in card [:tasks]
        (fn [tasks]
          (filterv #(not= (:task-id %) task-id) tasks)))
      card))
  (swap! card-list #(mapv remove-if! %)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

