Просмотр исходного кода

fix: rtc downloading graph indicator

Tienson Qin 1 год назад
Родитель
Сommit
7c3a129c3a
1 измененных файлов с 21 добавлено и 14 удалено
  1. 21 14
      src/main/frontend/components/rtc/indicator.cljs

+ 21 - 14
src/main/frontend/components/rtc/indicator.cljs

@@ -7,7 +7,7 @@
             [frontend.util :as util]))
 
 (rum/defc details
-  [{:keys [unpushed-block-update-count]} uploading?]
+  [{:keys [unpushed-block-update-count]} uploading? downloading?]
   [:div.cp__rtc-sync-details.text-sm.p-1
    (cond
      uploading?
@@ -22,18 +22,25 @@
   (let [_                       (state/sub :auth/id-token)
         online?                 (state/sub :network/online?)
         uploading?              (state/sub :rtc/uploading?)
+        downloading?            (state/sub :rtc/downloading-graph-uuid)
         {:keys [graph-uuid rtc-state unpushed-block-update-count] :as state}
         (state/sub :rtc/state)]
-    (when graph-uuid
-      [:div.cp__rtc-sync
-       [:div.cp__rtc-sync-indicator
-        [:a.button.cloud
-         {:on-click #(shui/popup-show! (.-target %)
-                                       (details state uploading?)
-                                       {:align "end"})
-          :class    (util/classnames [{:on (and online? (= :open rtc-state))
-                                       :idle (and online? (= :open rtc-state) (zero? unpushed-block-update-count)
-                                                  (not uploading?))
-                                       :queuing (or uploading? (pos? unpushed-block-update-count))}])}
-         [:span.flex.items-center
-          (ui/icon "cloud" {:size ui/icon-size})]]]])))
+    (when (or graph-uuid downloading?)
+      (if downloading?
+        (shui/button
+         {:variant :ghost
+          :size :sm}
+         "Downloading...")
+        [:div.cp__rtc-sync
+         [:div.cp__rtc-sync-indicator
+          [:a.button.cloud
+           {:on-click #(shui/popup-show! (.-target %)
+                                         (details state uploading? downloading?)
+                                         {:align "end"})
+            :class    (util/classnames [{:on (and online? (= :open rtc-state))
+                                         :idle (and online? (= :open rtc-state) (zero? unpushed-block-update-count)
+                                                    (not uploading?)
+                                                    (not downloading?))
+                                         :queuing (or uploading? downloading? (pos? unpushed-block-update-count))}])}
+           [:span.flex.items-center
+            (ui/icon "cloud" {:size ui/icon-size})]]]]))))