diff --git a/src/computersandblues/lodestone/app.cljs b/src/computersandblues/lodestone/app.cljs index c5cd57f..ed236ff 100644 --- a/src/computersandblues/lodestone/app.cljs +++ b/src/computersandblues/lodestone/app.cljs @@ -442,7 +442,7 @@ [:path.arc {:d "M50,0 A50,50 180 0,1 100,50"}]])) (defn posts-section [{:keys [posts]}] - (let [{:keys [per-page query total displayed-posts]} posts + (let [{:keys [per-page query total displayed-posts loading]} posts n-displayed (count displayed-posts)] [:section.posts [:h2 "Favorites"] @@ -456,28 +456,14 @@ " matches")))))] [:section.search-form [search] - [loading-indicator (select-keys posts [:loading])] + [loading-indicator {:loading loading}] #_(cond (= api-state :loading) " …" (= api-state :error) " API Error!")] [:section.buttons - [:button.control-button {:on-click fetch-more-posts!} "⇓ Fetch more"] + [:button.control-button {:on-click fetch-more-posts! :disabled (boolean (seq loading))} "⇓ Fetch more"] [:button.control-button {:on-click disconnect-account!} "▤ Disconnect account"]]] [:ul.results (map-indexed (fn [idx p] - ^{:key idx} [:li.result [post {:post p}]]) displayed-posts)] - #_[:div.load-buttons - [:button - {:on-click (fn [_] - (let [num-posts (count posts)] - (fetch-posts! {:continue? (fn [response] - (and (seq (:body response)) - (< (count (:favorites @state)) (+ num-posts 1000))))})))} - "Load more"] - " " - [:button - {:on-click (fn [_] - (fetch-posts! {:continue? (fn [response] - (seq (:body response)))}))} - "Load all"]]])) + ^{:key idx} [:li.result [post {:post p}]]) displayed-posts)]])) ;; help section