mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-23 22:58:15 +00:00
Show loading spinner for activity feed and bounties view
* show loading spinner instead "no data" text on activity feed view and bounties view when data is being fetched
This commit is contained in:
parent
9b59996cb2
commit
a0b018ab6c
@ -42,12 +42,22 @@
|
||||
[:div.balance-badge (str "ETH " balance )])
|
||||
[:div.time (moment-timestamp updated)]]]])
|
||||
|
||||
(defn activity-page []
|
||||
(let [activity-items (rf/subscribe [:activity-feed])]
|
||||
(fn []
|
||||
|
||||
|
||||
(defn activity-list [activity-items]
|
||||
[:div.ui.container
|
||||
(if (empty? @activity-items)
|
||||
(if (empty? activity-items)
|
||||
[:div.ui.text "No data"]
|
||||
(into [:div.ui.items]
|
||||
(for [item @activity-items]
|
||||
[activity-item item])))])))
|
||||
(for [item activity-items]
|
||||
[activity-item item])))] )
|
||||
|
||||
(defn activity-page []
|
||||
(let [activity-items (rf/subscribe [:activity-feed])
|
||||
activity-feed-loading? (rf/subscribe [:get-in [:activity-feed-loading?]])]
|
||||
(fn []
|
||||
(if @activity-feed-loading?
|
||||
[:container
|
||||
[:div.ui.active.inverted.dimmer
|
||||
[:div.ui.text.loader "Loading"]]]
|
||||
[activity-list @activity-items]))))
|
||||
|
@ -15,8 +15,8 @@
|
||||
balance :balance} bounty
|
||||
full-repo (str owner "/" repo-name)
|
||||
issue-link [:a
|
||||
{:href (issue-url owner repo-name issue-number)}
|
||||
issue-title]]
|
||||
{:href (issue-url owner repo-name issue-number)}
|
||||
issue-title]]
|
||||
[:div.item.activity-item
|
||||
[:div.ui.mini.circular.image
|
||||
[:img {:src avatar-url}]]
|
||||
@ -28,13 +28,21 @@
|
||||
[:div.balance-badge (str "ETH " balance )]
|
||||
[:div.time (moment-timestamp updated)]]]]))
|
||||
|
||||
(defn bounties-list [open-bounties]
|
||||
[:div.ui.container
|
||||
(if (empty? open-bounties)
|
||||
[:div.ui.text "No data"]
|
||||
(into [:div.ui.items]
|
||||
(for [bounty open-bounties]
|
||||
[bounty-item bounty])))])
|
||||
|
||||
|
||||
(defn bounties-page []
|
||||
(let [open-bounties (rf/subscribe [:open-bounties])]
|
||||
(let [open-bounties (rf/subscribe [:open-bounties])
|
||||
open-bounties-loading? (rf/subscribe [:get-in [:open-bounties-loading?]])]
|
||||
(fn []
|
||||
[:div.ui.container
|
||||
(if (empty? @open-bounties)
|
||||
[:div.ui.text "No data"]
|
||||
(into [:div.ui.items]
|
||||
(for [bounty @open-bounties]
|
||||
[bounty-item bounty])))])))
|
||||
(if @open-bounties-loading?
|
||||
[:container
|
||||
[:div.ui.active.inverted.dimmer
|
||||
[:div.ui.text.loader "Loading"]]]
|
||||
[bounties-list @open-bounties]))))
|
||||
|
@ -5,6 +5,8 @@
|
||||
:user nil
|
||||
:repos-loading? false
|
||||
:repos {}
|
||||
:activity-feed-loading? false
|
||||
:open-bounties-loading? false
|
||||
:open-bounties []
|
||||
:owner-bounties {}
|
||||
:top-hunters []
|
||||
|
@ -132,7 +132,7 @@
|
||||
(reg-event-fx
|
||||
:load-activity-feed
|
||||
(fn [{:keys [db]} [_]]
|
||||
{:db db
|
||||
{:db (assoc db :activity-feed-loading? true)
|
||||
:http {:method GET
|
||||
:url "/api/activity-feed"
|
||||
:on-success #(dispatch [:set-activity-feed %])}}))
|
||||
@ -141,12 +141,14 @@
|
||||
(reg-event-db
|
||||
:set-activity-feed
|
||||
(fn [db [_ activity-feed]]
|
||||
(assoc db :activity-feed activity-feed)))
|
||||
(assoc db
|
||||
:activity-feed activity-feed
|
||||
:activity-feed-loading? false)))
|
||||
|
||||
(reg-event-fx
|
||||
:load-open-bounties
|
||||
(fn [{:keys [db]} [_]]
|
||||
{:db db
|
||||
{:db (assoc db :open-bounties-loading? true)
|
||||
:http {:method GET
|
||||
:url "/api/open-bounties"
|
||||
:on-success #(dispatch [:set-open-bounties %])}}))
|
||||
@ -154,7 +156,9 @@
|
||||
(reg-event-db
|
||||
:set-open-bounties
|
||||
(fn [db [_ issues]]
|
||||
(assoc db :open-bounties issues)))
|
||||
(assoc db
|
||||
:open-bounties issues
|
||||
:open-bounties-loading? false)))
|
||||
|
||||
|
||||
(reg-event-fx
|
||||
|
Loading…
x
Reference in New Issue
Block a user