Add :user-profile-loaded? event/sub

This commit is contained in:
Vitaliy Vlasov 2018-02-08 18:08:44 +02:00
parent 8a75d5d68c
commit 8b0622480d
4 changed files with 17 additions and 3 deletions

View File

@ -3,6 +3,7 @@
(def default-db
{:page :bounties
:user nil
:user-profile-loaded? false
:repos-loading? false
:repos {}
:activity-feed-loading? false

View File

@ -222,7 +222,8 @@
:set-user-profile
(fn [{:keys [db]} [_ user-profile]]
{:db
(assoc db :user (:user user-profile))
(assoc db :user (:user user-profile)
:user-profile-loaded? true)
:dispatch-n [[:load-user-repos]
[:load-owner-bounties]]}))

View File

@ -16,6 +16,11 @@
(fn [db _]
(:user db)))
(reg-sub
:user-profile-loaded?
(fn [db _]
(:user-profile-loaded? db)))
(reg-sub
:repos-loading?
(fn [db _]

View File

@ -6,8 +6,7 @@
[clojure.string :as str]
[cljs-web3.eth :as web3-eth]))
(defn update-address-page []
(defn update-address-page-contents []
(let [db (rf/subscribe [:db])
user (rf/subscribe [:user])
updating-address (rf/subscribe [:get-in [:updating-address]])
@ -55,3 +54,11 @@
(when @updating-address
" busy loading"))})
"UPDATE"]]]))))
(defn update-address-page []
(let [loaded? @(rf/subscribe [:user-profile-loaded?])]
(if loaded?
[update-address-page-contents]
[:div.view-loading-container
[:div.ui.active.inverted.dimmer
[:div.ui.text.loader.view-loading-label "Loading"]]])))