             [frontend.datascript :as ds]
             [frontend.datetime :as datetime]
             [frontend.db :as fdb]
+            [frontend.models.issue :as issue-model]
             [frontend.sente :as sente]
             [frontend.urls :as urls]
             [frontend.utils :as utils]

             [:span.issue-vote-count (count (:issue/votes issue))]
             (common/icon :north)]))))))

(defn single-comment [{:keys [comment-id]} owner]
  (reify
    om/IInitState
    (init-state [_] {:listener-key (.getNextUniqueId (.getInstance IdGenerator))})
    om/IDidMount
    (did-mount [_]
      (fdb/add-entity-listener (om/get-shared owner :issue-db)
                               comment-id
                               (om/get-state owner :listener-key)
                               (fn [tx-report]
                                 (om/refresh! owner))))
    om/IWillUnmount
    (will-unmount [_]
      (fdb/remove-entity-listener (om/get-shared owner :issue-db)
                                  comment-id
                                  (om/get-state owner :listener-key)))
    om/IRender
    (render [_]
      (let [{:keys [issue-db cast!]} (om/get-shared owner)
            comment (d/entity @issue-db comment-id)]
        (html
         [:div.comment
          [:div (:comment/body comment)]])))))

(defn comments [{:keys [issue]} owner]
  (reify
    om/IRender
    (render [_]
      (html
       [:div.issue-comments
        (for [{:keys [db/id]} (:issue/comments issue)]
          (om/build single-comment {:comment-id id} {:key :comment-id}))]))))

(defn issue [{:keys [issue-id]} owner]
  (reify

                    :data-placeholder-nil "How can we improve Precursor?"
                    :data-placeholder-busy "Your idea in less than 140 characters?"}]])))))

(defn comment-form [{:keys [issue-id parent-id]} owner {:keys [issue-db]}]
  (reify
    om/IInitState (init-state [_] {:comment-body ""})
    om/IRenderState
