diff --git a/src/cljs/commiteth/db.cljs b/src/cljs/commiteth/db.cljs index c0ebfb8..c92b2a1 100644 --- a/src/cljs/commiteth/db.cljs +++ b/src/cljs/commiteth/db.cljs @@ -4,6 +4,7 @@ (def default-db {:page :bounties :user nil + :user-profile-loaded? false :repos-loading? false :repos {} :activity-feed-loading? false diff --git a/src/cljs/commiteth/handlers.cljs b/src/cljs/commiteth/handlers.cljs index eb61374..20fdd74 100644 --- a/src/cljs/commiteth/handlers.cljs +++ b/src/cljs/commiteth/handlers.cljs @@ -225,7 +225,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]]})) diff --git a/src/cljs/commiteth/subscriptions.cljs b/src/cljs/commiteth/subscriptions.cljs index bb2a82a..6337976 100644 --- a/src/cljs/commiteth/subscriptions.cljs +++ b/src/cljs/commiteth/subscriptions.cljs @@ -19,6 +19,11 @@ (fn [db _] (:user db))) +(reg-sub + :user-profile-loaded? + (fn [db _] + (:user-profile-loaded? db))) + (reg-sub :repos-loading? (fn [db _] diff --git a/src/cljs/commiteth/update_address.cljs b/src/cljs/commiteth/update_address.cljs index 6134bde..b5eb0af 100644 --- a/src/cljs/commiteth/update_address.cljs +++ b/src/cljs/commiteth/update_address.cljs @@ -5,8 +5,7 @@ [reagent.crypt :as crypt] [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]]) @@ -42,3 +41,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"]]])))